Skip to content

Commit

Permalink
Updates to OTEL Collector v0.111.0 and fixes any issues
Browse files Browse the repository at this point in the history
Removes outdated ballastextension
Remove expandconverter from CollectorSettings
Updates to OTEL v0.111.0 dependency
  • Loading branch information
StefanKurek committed Oct 7, 2024
1 parent f1f132c commit a106c9c
Show file tree
Hide file tree
Showing 53 changed files with 894 additions and 779 deletions.
411 changes: 222 additions & 189 deletions go.mod

Large diffs are not rendered by default.

901 changes: 483 additions & 418 deletions go.sum

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions internal/tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/GoogleCloudPlatform/opentelemetry-operations-collector

go 1.21
go 1.22.0

toolchain go1.21.10
toolchain go1.22.3

require (
github.com/client9/misspell v0.3.4
github.com/golangci/golangci-lint v1.52.1
github.com/google/addlicense v1.1.1
github.com/google/googet v2.13.0+incompatible
go.opentelemetry.io/collector/cmd/mdatagen v0.100.0
go.opentelemetry.io/collector/cmd/mdatagen v0.111.0
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
)

Expand Down Expand Up @@ -37,7 +37,7 @@ require (
github.com/breml/bidichk v0.2.4 // indirect
github.com/breml/errchkjson v0.3.1 // indirect
github.com/butuzov/ireturn v0.1.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charithe/durationcheck v0.0.10 // indirect
github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
Expand All @@ -59,7 +59,7 @@ require (
github.com/go-toolsmith/astp v1.1.0 // indirect
github.com/go-toolsmith/strparse v1.1.0 // indirect
github.com/go-toolsmith/typep v1.1.0 // indirect
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect
github.com/go-viper/mapstructure/v2 v2.1.0 // indirect
github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gofrs/flock v0.8.1 // indirect
Expand Down Expand Up @@ -152,7 +152,7 @@ require (
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
Expand All @@ -174,27 +174,27 @@ require (
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.2.0 // indirect
gitlab.com/bosi/decorder v0.2.3 // indirect
go.opentelemetry.io/collector/component v0.100.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.100.0 // indirect
go.opentelemetry.io/collector/confmap v0.100.0 // indirect
go.opentelemetry.io/collector/confmap/provider/fileprovider v0.100.0 // indirect
go.opentelemetry.io/collector/filter v0.100.0 // indirect
go.opentelemetry.io/collector/pdata v1.7.0 // indirect
go.opentelemetry.io/otel v1.26.0 // indirect
go.opentelemetry.io/otel/metric v1.26.0 // indirect
go.opentelemetry.io/otel/trace v1.26.0 // indirect
go.opentelemetry.io/collector/component v0.111.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.111.0 // indirect
go.opentelemetry.io/collector/confmap v1.17.0 // indirect
go.opentelemetry.io/collector/confmap/provider/fileprovider v1.17.0 // indirect
go.opentelemetry.io/collector/filter v0.111.0 // indirect
go.opentelemetry.io/collector/pdata v1.17.0 // indirect
go.opentelemetry.io/otel v1.30.0 // indirect
go.opentelemetry.io/otel/metric v1.30.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/exp/typeparams v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
google.golang.org/grpc v1.64.1 // indirect
google.golang.org/protobuf v1.34.1 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
87 changes: 43 additions & 44 deletions internal/tools/go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions processor/agentmetricsprocessor/agentmetricsprocessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ func TestAgentMetricsProcessor(t *testing.T) {
})

tmn := &consumertest.MetricsSink{}
rmp, err := processorhelper.NewMetricsProcessor(
rmp, err := processorhelper.NewMetrics(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
&Config{},
tmn,
amp.ProcessMetrics,
Expand Down
4 changes: 2 additions & 2 deletions processor/agentmetricsprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ var processorCapabilities = consumer.Capabilities{MutatesData: true}

func createMetricsProcessor(
ctx context.Context,
params processor.CreateSettings,
params processor.Settings,
cfg component.Config,
nextConsumer consumer.Metrics,
) (processor.Metrics, error) {
// NewMetricsProcess takes an MProcessor, which is what agentMetricsProcessor implements, and returns a MetricsProcessor.
mProcessor := newAgentMetricsProcessor(params.Logger, cfg.(*Config))
return processorhelper.NewMetricsProcessor(
return processorhelper.NewMetrics(
ctx,
params,
cfg,
Expand Down
5 changes: 3 additions & 2 deletions processor/agentmetricsprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ import (
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/processortest"
)

func TestCreateDefaultConfig(t *testing.T) {
assert.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig()))
}

func TestCreateProcessor(t *testing.T) {
mp, err := createMetricsProcessor(context.Background(), processor.CreateSettings{}, createDefaultConfig(), consumertest.NewNop())
cfg := createDefaultConfig().(*Config)
mp, err := createMetricsProcessor(context.Background(), processortest.NewNopSettings(), cfg, consumertest.NewNop())
assert.NoError(t, err)
assert.NotNil(t, mp)
}
4 changes: 2 additions & 2 deletions processor/casttosumprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var processorCapabilities = consumer.Capabilities{MutatesData: true}

func createMetricsProcessor(
ctx context.Context,
params processor.CreateSettings,
params processor.Settings,
cfg component.Config,
nextConsumer consumer.Metrics,
) (processor.Metrics, error) {
Expand All @@ -56,7 +56,7 @@ func createMetricsProcessor(
}

metricsProcessor := newCastToSumProcessor(processorConfig, params.Logger)
return processorhelper.NewMetricsProcessor(
return processorhelper.NewMetrics(
ctx,
params,
cfg,
Expand Down
4 changes: 2 additions & 2 deletions processor/casttosumprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/otelcol/otelcoltest"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/processortest"
)

func TestCreateDefaultConfig(t *testing.T) {
Expand All @@ -41,7 +41,7 @@ func TestCreateProcessor(t *testing.T) {
assert.NotNil(t, config)

for _, cfg := range config.Processors {
mp, err := createMetricsProcessor(context.Background(), processor.CreateSettings{}, cfg, consumertest.NewNop())
mp, err := createMetricsProcessor(context.Background(), processortest.NewNopSettings(), cfg.(*Config), consumertest.NewNop())
assert.NoError(t, err)
assert.NotNil(t, mp)
}
Expand Down
2 changes: 1 addition & 1 deletion processor/casttosumprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestCastToSumProcessor(t *testing.T) {
tmn := &consumertest.MetricsSink{}
rmp, err := processorhelper.NewMetricsProcessor(

Check failure on line 89 in processor/casttosumprocessor/processor_test.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04)

SA1019: processorhelper.NewMetricsProcessor is deprecated: [v0.111.0] use NewMetrics. (staticcheck)
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
cfg,
tmn,
nsp.ProcessMetrics,
Expand Down
2 changes: 1 addition & 1 deletion processor/modifyscopeprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var processorCapabilities = consumer.Capabilities{MutatesData: true}

func createMetricsProcessor(
ctx context.Context,
params processor.CreateSettings,
params processor.Settings,
cfg component.Config,
nextConsumer consumer.Metrics,
) (processor.Metrics, error) {
Expand Down
5 changes: 3 additions & 2 deletions processor/modifyscopeprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ import (
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/processortest"
)

func TestCreateDefaultConfig(t *testing.T) {
assert.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig()))
}
func TestCreateProcessor(t *testing.T) {
mp, err := createMetricsProcessor(context.Background(), processor.CreateSettings{}, createDefaultConfig(), consumertest.NewNop())
cfg := createDefaultConfig().(*Config)
mp, err := createMetricsProcessor(context.Background(), processortest.NewNopSettings(), cfg, consumertest.NewNop())
assert.NoError(t, err)
assert.NotNil(t, mp)
}
2 changes: 1 addition & 1 deletion processor/modifyscopeprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestModifyScopeProcessor(t *testing.T) {
tmn := &consumertest.MetricsSink{}
rmp, err := processorhelper.NewMetricsProcessor(

Check failure on line 54 in processor/modifyscopeprocessor/processor_test.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04)

SA1019: processorhelper.NewMetricsProcessor is deprecated: [v0.111.0] use NewMetrics. (staticcheck)
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
cfg,
tmn,
msp.ProcessMetrics,
Expand Down
2 changes: 1 addition & 1 deletion processor/normalizesumsprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var processorCapabilities = consumer.Capabilities{MutatesData: true}

func createMetricsProcessor(
ctx context.Context,
params processor.CreateSettings,
params processor.Settings,
cfg component.Config,
nextConsumer consumer.Metrics,
) (processor.Metrics, error) {
Expand Down
5 changes: 3 additions & 2 deletions processor/normalizesumsprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ import (
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/processortest"
)

func TestCreateDefaultConfig(t *testing.T) {
assert.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig()))
}
func TestCreateProcessor(t *testing.T) {
mp, err := createMetricsProcessor(context.Background(), processor.CreateSettings{}, createDefaultConfig(), consumertest.NewNop())
cfg := createDefaultConfig().(*Config)
mp, err := createMetricsProcessor(context.Background(), processortest.NewNopSettings(), cfg, consumertest.NewNop())
assert.NoError(t, err)
assert.NotNil(t, mp)
}
2 changes: 1 addition & 1 deletion processor/normalizesumsprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestNormalizeSumsProcessor(t *testing.T) {
tmn := &consumertest.MetricsSink{}
rmp, err := processorhelper.NewMetricsProcessor(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
&Config{},
tmn,
nsp.ProcessMetrics,
Expand Down
12 changes: 6 additions & 6 deletions receiver/dcgmreceiver/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func TestComponentConfigStruct(t *testing.T) {
require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig()))
}

func newCreateSettings(t *testing.T) receiver.CreateSettings {
settings := receivertest.NewNopCreateSettings()
func newCreateSettings(t *testing.T) receiver.Settings {
settings := receivertest.NewNopSettings()
settings.Logger = zaptest.NewLogger(t)
return settings
}
Expand All @@ -57,13 +57,13 @@ func TestComponentLifecycle(t *testing.T) {

tests := []struct {
name string
createFn func(ctx context.Context, set receiver.CreateSettings, cfg component.Config) (component.Component, error)
createFn func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error)
}{

{
name: "metrics",
createFn: func(ctx context.Context, set receiver.CreateSettings, cfg component.Config) (component.Component, error) {
return factory.CreateMetricsReceiver(ctx, set, cfg, consumertest.NewNop())
createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) {
return factory.CreateMetrics(ctx, set, cfg, consumertest.NewNop())
},
},
}
Expand All @@ -73,7 +73,7 @@ func TestComponentLifecycle(t *testing.T) {
cfg := factory.CreateDefaultConfig()
sub, err := cm.Sub("tests::config")
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))
require.NoError(t, sub.Unmarshal(&cfg))

for _, test := range tests {
t.Run(test.name+"-shutdown", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion receiver/dcgmreceiver/factory_gpu_off.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

func createMetricsReceiver(
_ context.Context,
_ receiver.CreateSettings,
_ receiver.Settings,
_ component.Config,
_ consumer.Metrics,
) (receiver.Metrics, error) {
Expand Down
4 changes: 2 additions & 2 deletions receiver/dcgmreceiver/factory_gpu_off_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import (
func TestCreateMetricsReceiverWithGPUSupportOff(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
receiver, err := factory.CreateMetricsReceiver(
receiver, err := factory.CreateMetrics(
context.Background(),
receivertest.NewNopCreateSettings(),
receivertest.NewNopSettings(),
cfg,
consumertest.NewNop())

Expand Down
4 changes: 2 additions & 2 deletions receiver/dcgmreceiver/factory_gpu_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func init() {

func createMetricsReceiver(
_ context.Context,
params receiver.CreateSettings,
params receiver.Settings,
rConf component.Config,
consumer consumer.Metrics,
) (receiver.Metrics, error) {
Expand All @@ -59,7 +59,7 @@ func createMetricsReceiver(

ns := newDcgmScraper(cfg, params)
scraper, err := scraperhelper.NewScraper(
metadata.Type.String(),
metadata.Type,
ns.scrape,
scraperhelper.WithStart(ns.start),
scraperhelper.WithShutdown(ns.stop))
Expand Down
4 changes: 2 additions & 2 deletions receiver/dcgmreceiver/factory_gpu_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ func TestCreateMetricsReceiverOnLinux(t *testing.T) {
cfg := factory.CreateDefaultConfig()
receiverConfig := cfg.(*Config)

receiver, err := factory.CreateMetricsReceiver(
receiver, err := factory.CreateMetrics(
context.Background(),
receivertest.NewNopCreateSettings(),
receivertest.NewNopSettings(),
receiverConfig,
consumertest.NewNop(),
)
Expand Down

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

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

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

Loading

0 comments on commit a106c9c

Please sign in to comment.