From 8f449ac641a2ca6423ce5b4cc708126788f65560 Mon Sep 17 00:00:00 2001 From: Vastin He Date: Tue, 17 Oct 2023 23:57:34 +0000 Subject: [PATCH] Renaming APM/Pulse to AppSignals --- exporter/awsemfexporter/config.go | 4 ++-- exporter/awsemfexporter/config_test.go | 28 ++++++++++++------------ exporter/awsemfexporter/emf_exporter.go | 8 +++---- internal/aws/cwlogs/cwlog_client.go | 12 +++++----- internal/aws/cwlogs/cwlog_client_test.go | 22 +++++++++---------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/exporter/awsemfexporter/config.go b/exporter/awsemfexporter/config.go index a8804c334199..e6579b640dc4 100644 --- a/exporter/awsemfexporter/config.go +++ b/exporter/awsemfexporter/config.go @@ -154,12 +154,12 @@ func (config *Config) IsEnhancedContainerInsights() bool { // return config.EnhancedContainerInsights && !config.DisableMetricExtraction } -func (config *Config) IsPulseApmEnabled() bool { +func (config *Config) IsAppSignalsEnabled() bool { if config.LogGroupName == "" || config.Namespace == "" { return false } - if config.Namespace == pulseMetricNamespace && strings.HasPrefix(config.LogGroupName, pulseLogGroupNamePrefix) { + if config.Namespace == appSignalsMetricNamespace && strings.HasPrefix(config.LogGroupName, appSignalsLogGroupNamePrefix) { return true } diff --git a/exporter/awsemfexporter/config_test.go b/exporter/awsemfexporter/config_test.go index 3d5056d5ab2b..0871a83b4548 100644 --- a/exporter/awsemfexporter/config_test.go +++ b/exporter/awsemfexporter/config_test.go @@ -328,7 +328,7 @@ func TestIsEnhancedContainerInsights(t *testing.T) { assert.False(t, cfg.IsEnhancedContainerInsights()) } -func TestIsPulseApmEnabled(t *testing.T) { +func TestIsAppSignalsEnabled(t *testing.T) { tests := []struct { name string metricNameSpace string @@ -336,27 +336,27 @@ func TestIsPulseApmEnabled(t *testing.T) { expectedResult bool }{ { - "validPulseEMF", - "AWS/APM", - "/aws/apm/eks", + "validAppSignalsEMF", + "AppSignals", + "/aws/appsignals/eks", true, }, { - "invalidPulseLogsGroup", - "AWS/APM", - "/nonaws/apm/eks", + "invalidAppSignalsLogsGroup", + "AppSignals", + "/nonaws/appsignals/eks", false, }, { - "invalidPulseMetricNamespace", - "NonAWS/APM", - "/aws/apm/eks", + "invalidAppSignalsMetricNamespace", + "NonAppSignals", + "/aws/appsignals/eks", false, }, { - "invalidPulseEMF", - "NonAWS/APM", - "/nonaws/apm/eks", + "invalidAppSignalsEMF", + "NonAppSignals", + "/nonaws/appsignals/eks", false, }, { @@ -377,7 +377,7 @@ func TestIsPulseApmEnabled(t *testing.T) { cfg.LogGroupName = tc.logGroupName } - assert.Equal(t, cfg.IsPulseApmEnabled(), tc.expectedResult) + assert.Equal(t, cfg.IsAppSignalsEnabled(), tc.expectedResult) }) } } diff --git a/exporter/awsemfexporter/emf_exporter.go b/exporter/awsemfexporter/emf_exporter.go index ba342bb6b004..6f75a39b6888 100644 --- a/exporter/awsemfexporter/emf_exporter.go +++ b/exporter/awsemfexporter/emf_exporter.go @@ -29,9 +29,9 @@ const ( outputDestinationCloudWatch = "cloudwatch" outputDestinationStdout = "stdout" - // Pulse EMF config - pulseMetricNamespace = "AWS/APM" - pulseLogGroupNamePrefix = "/aws/apm/" + // AppSignals EMF config + appSignalsMetricNamespace = "AppSignals" + appSignalsLogGroupNamePrefix = "/aws/appsignals/" ) type emfExporter struct { @@ -69,7 +69,7 @@ func newEmfExporter(config *Config, set exporter.CreateSettings) (*emfExporter, config.Tags, session, cwlogs.WithEnabledContainerInsights(config.IsEnhancedContainerInsights()), - cwlogs.WithEnabledPulseApm(config.IsPulseApmEnabled()), + cwlogs.WithEnabledAppSignals(config.IsAppSignalsEnabled()), ) collectorIdentifier, err := uuid.NewRandom() diff --git a/internal/aws/cwlogs/cwlog_client.go b/internal/aws/cwlogs/cwlog_client.go index 800b59daf5f5..e949c83650ed 100644 --- a/internal/aws/cwlogs/cwlog_client.go +++ b/internal/aws/cwlogs/cwlog_client.go @@ -43,7 +43,7 @@ type UserAgentOption func(*UserAgentFlag) type UserAgentFlag struct { isEnhancedContainerInsights bool - isPulseApm bool + isAppSignals bool } func WithEnabledContainerInsights(flag bool) UserAgentOption { @@ -52,9 +52,9 @@ func WithEnabledContainerInsights(flag bool) UserAgentOption { } } -func WithEnabledPulseApm(flag bool) UserAgentOption { +func WithEnabledAppSignals(flag bool) UserAgentOption { return func(ua *UserAgentFlag) { - ua.isPulseApm = flag + ua.isAppSignals = flag } } @@ -76,7 +76,7 @@ func NewClient(logger *zap.Logger, awsConfig *aws.Config, buildInfo component.Bu // Loop through each option option := &UserAgentFlag{ isEnhancedContainerInsights: false, - isPulseApm: false, + isAppSignals: false, } for _, opt := range opts { opt(option) @@ -229,8 +229,8 @@ func newCollectorUserAgentHandler(buildInfo component.BuildInfo, logGroupName st extraStr = "EnhancedEKSContainerInsights" case containerInsightsRegexPattern.MatchString(logGroupName): extraStr = "ContainerInsights" - case userAgentFlag.isPulseApm: - extraStr = "Pulse" + case userAgentFlag.isAppSignals: + extraStr = "AppSignals" } fn := request.MakeAddToUserAgentHandler(buildInfo.Command, buildInfo.Version, extraStr) diff --git a/internal/aws/cwlogs/cwlog_client_test.go b/internal/aws/cwlogs/cwlog_client_test.go index f6f6158655ae..aef673beb6a0 100644 --- a/internal/aws/cwlogs/cwlog_client_test.go +++ b/internal/aws/cwlogs/cwlog_client_test.go @@ -596,10 +596,10 @@ func TestUserAgent(t *testing.T) { "opentelemetry-collector-contrib/1.0", }, { - "emptyLogGroupPulse", + "emptyLogGroupAppSignals", component.BuildInfo{Command: "opentelemetry-collector-contrib", Version: "1.0"}, "", - WithEnabledPulseApm(false), + WithEnabledAppSignals(false), "opentelemetry-collector-contrib/1.0", }, { @@ -610,10 +610,10 @@ func TestUserAgent(t *testing.T) { "test-collector-contrib/1.0", }, { - "buildInfoCommandUsedPulse", + "buildInfoCommandUsedAppSignals", component.BuildInfo{Command: "test-collector-contrib", Version: "1.0"}, "", - WithEnabledPulseApm(false), + WithEnabledAppSignals(false), "test-collector-contrib/1.0", }, { @@ -660,17 +660,17 @@ func TestUserAgent(t *testing.T) { "opentelemetry-collector-contrib/1.0 (ContainerInsights)", }, { - "validPulseEMFEnabled", + "validAppSignalsEMFEnabled", component.BuildInfo{Command: "opentelemetry-collector-contrib", Version: "1.0"}, - "/aws/apm", - WithEnabledPulseApm(true), - "opentelemetry-collector-contrib/1.0 (Pulse)", + "/aws/appsignals", + WithEnabledAppSignals(true), + "opentelemetry-collector-contrib/1.0 (AppSignals)", }, { - "PulseEMFNotEnabled", + "AppSignalsEMFNotEnabled", component.BuildInfo{Command: "opentelemetry-collector-contrib", Version: "1.0"}, - "/aws/apm", - WithEnabledPulseApm(false), + "/aws/appsignals", + WithEnabledAppSignals(false), "opentelemetry-collector-contrib/1.0", }, }