Skip to content

Commit

Permalink
Addressed comments...
Browse files Browse the repository at this point in the history
  • Loading branch information
okankoAMZ committed Aug 5, 2024
1 parent a33f109 commit 40d2b8f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand Down
7 changes: 0 additions & 7 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 1 addition & 2 deletions service/configprovider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 40d2b8f

Please sign in to comment.