chore: update to non-deprecated Docker SDK types
- Use container.Summary instead of types.Container - Use swarmtypes.ServiceListOptions instead of types.ServiceListOptions - Use swarmtypes.TaskListOptions instead of types.TaskListOptions These types were deprecated in favor of package-specific types.
This commit is contained in:
parent
d7d1631e1c
commit
60cd019d33
2 changed files with 3 additions and 5 deletions
|
|
@ -22,7 +22,6 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
containertypes "github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
systemtypes "github.com/docker/docker/api/types/system"
|
systemtypes "github.com/docker/docker/api/types/system"
|
||||||
|
|
@ -766,7 +765,7 @@ func (a *Agent) pruneStaleCPUSamples(active map[string]struct{}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) collectContainer(ctx context.Context, summary types.Container) (agentsdocker.Container, error) {
|
func (a *Agent) collectContainer(ctx context.Context, summary containertypes.Summary) (agentsdocker.Container, error) {
|
||||||
const perContainerTimeout = 15 * time.Second
|
const perContainerTimeout = 15 * time.Second
|
||||||
|
|
||||||
containerCtx, cancel := context.WithTimeout(ctx, perContainerTimeout)
|
containerCtx, cancel := context.WithTimeout(ctx, perContainerTimeout)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
swarmtypes "github.com/docker/docker/api/types/swarm"
|
swarmtypes "github.com/docker/docker/api/types/swarm"
|
||||||
systemtypes "github.com/docker/docker/api/types/system"
|
systemtypes "github.com/docker/docker/api/types/system"
|
||||||
|
|
@ -159,7 +158,7 @@ func (a *Agent) collectSwarmData(ctx context.Context, info systemtypes.Info, con
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) collectSwarmDataFromManager(ctx context.Context, info systemtypes.Info, scope string, containers map[string]agentsdocker.Container, includeServices, includeTasks bool) ([]agentsdocker.Service, []agentsdocker.Task, error) {
|
func (a *Agent) collectSwarmDataFromManager(ctx context.Context, info systemtypes.Info, scope string, containers map[string]agentsdocker.Container, includeServices, includeTasks bool) ([]agentsdocker.Service, []agentsdocker.Task, error) {
|
||||||
serviceList, err := a.docker.ServiceList(ctx, types.ServiceListOptions{Status: true})
|
serviceList, err := a.docker.ServiceList(ctx, swarmtypes.ServiceListOptions{Status: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +183,7 @@ func (a *Agent) collectSwarmDataFromManager(ctx context.Context, info systemtype
|
||||||
taskFilters.Add("node", info.Swarm.NodeID)
|
taskFilters.Add("node", info.Swarm.NodeID)
|
||||||
}
|
}
|
||||||
|
|
||||||
taskList, err := a.docker.TaskList(ctx, types.TaskListOptions{Filters: taskFilters})
|
taskList, err := a.docker.TaskList(ctx, swarmtypes.TaskListOptions{Filters: taskFilters})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return services, nil, err
|
return services, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue