diff --git a/cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go b/cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go index 5307372f79..0cfe0a0014 100644 --- a/cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go +++ b/cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go @@ -348,7 +348,7 @@ func runAgent(ctx context.Context, // Noticed that args of parent process get passed here to otel collector which causes failures // complaining about unrecognized args. So below change overwrites the args. // The config path below here is actually used that was set in the settings above. - // docs: https://github.com/open-telemetry/opentelemetry-collector/blob/main/otelcol/command.go#L63 + // docs: https://github.com/open-telemetry/opentelemetry-collector/blob/93cbae436ae61b832279dbbb18a0d99214b7d305/otelcol/command.go#L63 // ************************************************************************************************* e := []string{"--config=" + yamlConfigPath} cmd.SetArgs(e) diff --git a/go.mod b/go.mod index a767cb2a24..9acdfee9a0 100644 --- a/go.mod +++ b/go.mod @@ -89,7 +89,7 @@ replace github.com/aws/aws-sdk-go => github.com/aws/aws-sdk-go v1.48.6 require ( github.com/BurntSushi/toml v1.3.2 github.com/Jeffail/gabs v1.4.0 - github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20240709194807-b0f0c0eda01b + github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20240801174630-e08453fb681f github.com/aws/aws-sdk-go v1.53.11 github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.30.2 github.com/bigkevmcd/go-configparser v0.0.0-20200217161103-d137835d2579 @@ -144,7 +144,6 @@ require ( go.opentelemetry.io/collector/exporter v0.103.0 go.opentelemetry.io/collector/exporter/debugexporter v0.103.0 go.opentelemetry.io/collector/extension v0.103.0 - go.opentelemetry.io/collector/featuregate v1.10.0 // indirect go.opentelemetry.io/collector/otelcol v0.103.0 go.opentelemetry.io/collector/pdata v1.10.0 go.opentelemetry.io/collector/processor v0.103.0 @@ -193,7 +192,7 @@ require ( github.com/alecthomas/participle v0.4.1 // indirect github.com/alecthomas/participle/v2 v2.1.1 // indirect github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect - github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20240709194807-b0f0c0eda01b // indirect + github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20240801174630-e08453fb681f // indirect github.com/antchfx/jsonquery v1.1.5 // indirect github.com/antchfx/xmlquery v1.3.9 // indirect github.com/antchfx/xpath v1.2.0 // indirect @@ -401,6 +400,7 @@ require ( go.opentelemetry.io/collector/confmap/provider/yamlprovider v0.103.0 // indirect go.opentelemetry.io/collector/connector v0.103.0 // indirect go.opentelemetry.io/collector/extension/auth v0.103.0 // indirect + go.opentelemetry.io/collector/featuregate v1.10.0 // indirect go.opentelemetry.io/collector/pdata/testdata v0.103.0 // indirect go.opentelemetry.io/contrib/config v0.7.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect diff --git a/go.sum b/go.sum index 134a25c879..6d4644d334 100644 --- a/go.sum +++ b/go.sum @@ -183,8 +183,8 @@ github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfex github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20240801174630-e08453fb681f/go.mod h1:LPWBVdTSNbZkk80v6aCUthS59cnR4VauVRdAIE3ifaY= github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20240801174630-e08453fb681f h1:6t6//SHAwXK2V94MuxLEzmpjnhSyaeSnpDzqboHiMF0= github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20240801174630-e08453fb681f/go.mod h1:GNeNylfr5KMt55XowzSdgbP7z8CkIAfIHtWSd+xxtws= -github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20240709194807-b0f0c0eda01b h1:XqfG8N0PxttnwhO65hDpUK2jO+gIjuqVtZkfCyFbPaQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20240709194807-b0f0c0eda01b/go.mod h1:cDpFSR8i0bjVLkxLxOFABagktk5wd7LdMzU4xX7unPo= +github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20240801174630-e08453fb681f h1:/8f4So+qI4klFbEsHwwRr00egj0bwSebctvfcparHUQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20240801174630-e08453fb681f/go.mod h1:/RaNSxxO06niapGT00snMdgFfjjjW/kV3TZGX8kHuwM= github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20240801174630-e08453fb681f h1:rc/Ux0GFnOHS+soaGGOnYkkqjlWM3NHBkHnwFM8yRkg= github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20240801174630-e08453fb681f/go.mod h1:hRZt1DsvoLDIYBwjFvjwg/9IkaBXeCPG0QI57wbj98Q= github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20240801174630-e08453fb681f h1:VrJJyh1yw+VxWl5W4txtojZJy4Qwy2orioGSmCfODEA= @@ -205,8 +205,8 @@ github.com/amazon-contributing/opentelemetry-collector-contrib/internal/k8sconfi github.com/amazon-contributing/opentelemetry-collector-contrib/internal/k8sconfig v0.0.0-20240801174630-e08453fb681f/go.mod h1:VS66oUydCMwiWl1BFmLs7iNy4lGsfVYsriXr/d1fpAk= github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20240801174630-e08453fb681f h1:tQeYqCjYwH5IisoHRHmRXGarZV/Unwb9cTDLleZ9G4A= github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20240801174630-e08453fb681f/go.mod h1:4qvmHiXPOkOXJdpmmxMqprb2BXxOGPgOG45BwLdipUM= -github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20240709194807-b0f0c0eda01b h1:cCooVxp9OfZaI+j0mfQCmZmNlz2jmJoCvyqN6cEX3wI= -github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20240709194807-b0f0c0eda01b/go.mod h1:t/hYoRTnlPuRjh8y0BwVGgNvNIXpU2QJME5YVppUUHQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20240801174630-e08453fb681f h1:U7zRqrOBMClLENwcasczR254US0op3MlKFjnNoDaxeg= +github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20240801174630-e08453fb681f/go.mod h1:t/hYoRTnlPuRjh8y0BwVGgNvNIXpU2QJME5YVppUUHQ= github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20240801174630-e08453fb681f h1:f5ewI3fLsCKFhw7G4YufgtSKyWJvvLwxG0d10lh+kBM= github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20240801174630-e08453fb681f/go.mod h1:2NSghK+mafMGxM8c4Gff8qcprdMD3YQebZtD9UAdB3E= github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20240801174630-e08453fb681f h1:lqk1TkgI/9wmTf7Y7knRTOeZ4fMWnhGkdgd+24WBvsE= diff --git a/logger/logger.go b/logger/logger.go index c698408bd6..2685719cb8 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -34,13 +34,6 @@ func NewLogger(writer io.Writer, level zap.AtomicLevel) (*zap.Logger, []zap.Opti return logger, []zap.Option{option} } -func NewLoggerOptions(writer io.Writer, level zap.AtomicLevel) []zap.Option { - loggerLevel.SetLevel(level.Level()) - loggingOptions := getLoggingOptions(writer) - - return loggingOptions -} - func getLoggingOptions(writer io.Writer) []zap.Option { core := zapcore.NewCore( createTelegrafWrapperEncoder(), diff --git a/logger/logger_test.go b/logger/logger_test.go index 3949f5888a..9675367fc5 100644 --- a/logger/logger_test.go +++ b/logger/logger_test.go @@ -181,7 +181,7 @@ func TestSetLevel(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { buf := buffer.NewPool().Get() - logger, _ := zap.NewDevelopment(NewLoggerOptions(bufio.NewWriter(buf), zap.NewAtomicLevelAt(zapcore.InfoLevel))...) + logger, _ := NewLogger(bufio.NewWriter(buf),zap.NewAtomicLevelAt(zapcore.InfoLevel)) SetLevel(tt.args.level) logger.Debug("debug") logger.Info("info") diff --git a/service/configprovider/provider.go b/service/configprovider/provider.go index d8574ad652..842a70c824 100644 --- a/service/configprovider/provider.go +++ b/service/configprovider/provider.go @@ -12,11 +12,10 @@ import ( ) func GetSettings(configPath string, logger *zap.Logger) otelcol.ConfigProviderSettings { - fprovider := fileprovider.NewFactory() settings := otelcol.ConfigProviderSettings{ ResolverSettings: confmap.ResolverSettings{ URIs: []string{configPath}, - ProviderFactories: []confmap.ProviderFactory{fprovider}, + ProviderFactories: []confmap.ProviderFactory{fileprovider.NewFactory()}, ProviderSettings: confmap.ProviderSettings{Logger: logger}, ConverterFactories: []confmap.ConverterFactory{expandconverter.NewFactory()}, ConverterSettings: confmap.ConverterSettings{Logger: logger},