Skip to content

Commit

Permalink
[chore] bump testcontainers and address api changes (#34815)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten authored Aug 22, 2024
1 parent 51553ff commit fc99d26
Show file tree
Hide file tree
Showing 38 changed files with 172 additions and 224 deletions.
4 changes: 2 additions & 2 deletions cmd/otelcontribcol/go.sum

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

4 changes: 2 additions & 2 deletions connector/datadogconnector/go.sum

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

5 changes: 2 additions & 3 deletions exporter/clickhouseexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/jmoiron/sqlx v1.4.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.107.0
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.32.0
github.com/testcontainers/testcontainers-go v0.33.0
go.opentelemetry.io/collector/component v0.107.1-0.20240821120936-6764622672bc
go.opentelemetry.io/collector/config/configopaque v1.13.1-0.20240821120936-6764622672bc
go.opentelemetry.io/collector/config/configretry v1.13.1-0.20240821120936-6764622672bc
Expand All @@ -25,13 +25,12 @@ require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/ClickHouse/ch-go v0.61.5 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.11.5 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/containerd v1.7.18 // indirect
github.com/containerd/errdefs v0.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
Expand Down
10 changes: 4 additions & 6 deletions exporter/clickhouseexporter/go.sum

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

2 changes: 1 addition & 1 deletion exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ require (
github.com/dennwc/varint v1.0.0 // indirect
github.com/digitalocean/godo v1.118.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v27.0.3+incompatible // indirect
github.com/docker/docker v27.1.2+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand Down
18 changes: 8 additions & 10 deletions exporter/datadogexporter/go.sum

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

2 changes: 1 addition & 1 deletion exporter/datadogexporter/integrationtest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ require (
github.com/dennwc/varint v1.0.0 // indirect
github.com/digitalocean/godo v1.118.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/docker v27.0.3+incompatible // indirect
github.com/docker/docker v27.1.2+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/integrationtest/go.sum

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

2 changes: 0 additions & 2 deletions extension/observer/dockerobserver/go.sum

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

20 changes: 10 additions & 10 deletions internal/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Container struct {
// Client provides the core metric gathering functionality from the Docker Daemon.
// It retrieves container information in two forms to produce metric data: dtypes.ContainerJSON
// from client.ContainerInspect() for container information (id, name, hostname, labels, and env)
// and dtypes.StatsJSON from client.ContainerStats() for metric values.
// and container.StatsResponse from client.ContainerStats() for metric values.
type Client struct {
client *docker.Client
config *Config
Expand Down Expand Up @@ -135,7 +135,7 @@ func (dc *Client) LoadContainerList(ctx context.Context) error {
func (dc *Client) FetchContainerStatsAsJSON(
ctx context.Context,
container Container,
) (*dtypes.StatsJSON, error) {
) (*container.StatsResponse, error) {
containerStats, err := dc.FetchContainerStats(ctx, container)
if err != nil {
return nil, err
Expand All @@ -154,7 +154,7 @@ func (dc *Client) FetchContainerStatsAsJSON(
func (dc *Client) FetchContainerStats(
ctx context.Context,
container Container,
) (dtypes.ContainerStats, error) {
) (container.StatsResponseReader, error) {
dc.logger.Debug("Fetching container stats.", zap.String("id", container.ID))
statsCtx, cancel := context.WithTimeout(ctx, dc.config.Timeout)
containerStats, err := dc.client.ContainerStats(statsCtx, container.ID, false)
Expand All @@ -179,10 +179,10 @@ func (dc *Client) FetchContainerStats(
}

func (dc *Client) toStatsJSON(
containerStats dtypes.ContainerStats,
container *Container,
) (*dtypes.StatsJSON, error) {
var statsJSON dtypes.StatsJSON
containerStats container.StatsResponseReader,
ctr *Container,
) (*container.StatsResponse, error) {
var statsJSON container.StatsResponse
err := json.NewDecoder(containerStats.Body).Decode(&statsJSON)
containerStats.Body.Close()
if err != nil {
Expand All @@ -193,7 +193,7 @@ func (dc *Client) toStatsJSON(
}
dc.logger.Error(
"Could not parse docker containerStats for container id",
zap.String("id", container.ID),
zap.String("id", ctr.ID),
zap.Error(err),
)
return nil, err
Expand All @@ -204,7 +204,7 @@ func (dc *Client) toStatsJSON(
// Events exposes the underlying Docker clients Events channel.
// Caller should close the events channel by canceling the context.
// If an error occurs, processing stops and caller must reinvoke this method.
func (dc *Client) Events(ctx context.Context, options dtypes.EventsOptions) (<-chan devents.Message, <-chan error) {
func (dc *Client) Events(ctx context.Context, options devents.ListOptions) (<-chan devents.Message, <-chan error) {
return dc.client.Events(ctx, options)
}

Expand All @@ -224,7 +224,7 @@ func (dc *Client) ContainerEventLoop(ctx context.Context) {

EVENT_LOOP:
for {
options := dtypes.EventsOptions{
options := devents.ListOptions{
Filters: filters,
Since: lastTime.Format(time.RFC3339Nano),
}
Expand Down
5 changes: 3 additions & 2 deletions internal/docker/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"time"

dtypes "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
Expand Down Expand Up @@ -160,15 +161,15 @@ func TestToStatsJSONErrorHandling(t *testing.T) {
}

statsJSON, err := cli.toStatsJSON(
dtypes.ContainerStats{
container.StatsResponseReader{
Body: io.NopCloser(strings.NewReader("")),
}, dc,
)
assert.Nil(t, statsJSON)
assert.Equal(t, io.EOF, err)

statsJSON, err = cli.toStatsJSON(
dtypes.ContainerStats{
container.StatsResponseReader{
Body: io.NopCloser(strings.NewReader("{\"Networks\": 123}")),
}, dc,
)
Expand Down
2 changes: 0 additions & 2 deletions internal/docker/go.sum

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

2 changes: 0 additions & 2 deletions internal/k8stest/go.sum

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

Loading

0 comments on commit fc99d26

Please sign in to comment.