Skip to content

Commit

Permalink
fix: update container list to latest docker dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
pat-git committed Sep 13, 2024
1 parent e2f50ad commit 3042da4
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 2,559 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,4 @@ build/
#*

### Direnv
.direnv/

.idea/
.direnv/
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 17 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/noopdles/docker_state_exporter

go 1.17
go 1.22

toolchain go1.23.1

require (
github.com/alecthomas/kingpin/v2 v2.4.0
Expand All @@ -11,23 +13,26 @@ require (
)

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/containerd v1.6.26 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gorilla/mux v1.7.3 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
Expand All @@ -38,18 +43,22 @@ require (
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/sdk v1.3.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools v2.2.0+incompatible // indirect
gotest.tools/v3 v3.5.0 // indirect
)
2,577 changes: 31 additions & 2,546 deletions go.sum

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/alecthomas/kingpin/v2"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
tcontainer "github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"
"github.com/go-kit/log"
Expand Down Expand Up @@ -65,7 +66,7 @@ var (
restartcountDesc = descSource{
"container_restartcount",
"Number of times the container has been restarted"}
combinedStatusDesc = descSource{
combinedStatusDesc = descSource{
namespace + "combined_status",
"Combined container status and health status."}
lastseenDesc = descSource{
Expand Down Expand Up @@ -163,7 +164,8 @@ func (c *dockerHealthCollector) collectMetrics(ch chan<- prometheus.Metric) {

func (c *dockerHealthCollector) collectContainers() {
// Get list of containers that currently exist in the docker daemon
containers, err := c.containerClient.ContainerList(context.Background(), types.ContainerListOptions{All: true})
containers, err := c.containerClient.ContainerList(context.Background(), container.ListOptions{All: true})

errCheck(err)
c.containerInfoCache = []types.ContainerJSON{}

Expand Down

0 comments on commit 3042da4

Please sign in to comment.