From d7f7f3a25cba2831cf1057547f9609b5a4fc5e03 Mon Sep 17 00:00:00 2001 From: Pranjali Hugay Date: Fri, 15 Nov 2024 09:53:59 -0500 Subject: [PATCH] Translate awsentity processor last when translating pipelines --- .../otel/pipeline/applicationsignals/translator.go | 5 +++-- .../otel/pipeline/applicationsignals/translator_test.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/translator/translate/otel/pipeline/applicationsignals/translator.go b/translator/translate/otel/pipeline/applicationsignals/translator.go index 9540c9844e..239823937c 100644 --- a/translator/translate/otel/pipeline/applicationsignals/translator.go +++ b/translator/translate/otel/pipeline/applicationsignals/translator.go @@ -60,11 +60,12 @@ func (t *translator) Translate(conf *confmap.Conf) (*common.ComponentTranslators } mode := context.CurrentContext().KubernetesMode() + translators.Processors.Set(resourcedetection.NewTranslator(resourcedetection.WithDataType(t.dataType))) + translators.Processors.Set(awsapplicationsignals.NewTranslator(awsapplicationsignals.WithDataType(t.dataType))) + if t.dataType == component.DataTypeMetrics && mode != "" { translators.Processors.Set(awsentity.NewTranslatorWithEntityType(awsentity.Service, common.AppSignals, false)) } - translators.Processors.Set(resourcedetection.NewTranslator(resourcedetection.WithDataType(t.dataType))) - translators.Processors.Set(awsapplicationsignals.NewTranslator(awsapplicationsignals.WithDataType(t.dataType))) if enabled, _ := common.GetBool(conf, common.AgentDebugConfigKey); enabled { translators.Exporters.Set(debug.NewTranslator(common.WithName(common.AppSignals))) diff --git a/translator/translate/otel/pipeline/applicationsignals/translator_test.go b/translator/translate/otel/pipeline/applicationsignals/translator_test.go index 23119032eb..a28c93b19e 100644 --- a/translator/translate/otel/pipeline/applicationsignals/translator_test.go +++ b/translator/translate/otel/pipeline/applicationsignals/translator_test.go @@ -126,7 +126,7 @@ func TestTranslatorMetricsForKubernetes(t *testing.T) { }, want: &want{ receivers: []string{"otlp/application_signals"}, - processors: []string{"metricstransform/application_signals", "awsentity/service/application_signals", "resourcedetection", "awsapplicationsignals"}, + processors: []string{"metricstransform/application_signals", "resourcedetection", "awsapplicationsignals", "awsentity/service/application_signals"}, exporters: []string{"awsemf/application_signals"}, extensions: []string{"agenthealth/logs"}, }, @@ -147,7 +147,7 @@ func TestTranslatorMetricsForKubernetes(t *testing.T) { }, want: &want{ receivers: []string{"otlp/application_signals"}, - processors: []string{"metricstransform/application_signals", "awsentity/service/application_signals", "resourcedetection", "awsapplicationsignals"}, + processors: []string{"metricstransform/application_signals", "resourcedetection", "awsapplicationsignals", "awsentity/service/application_signals"}, exporters: []string{"debug/application_signals", "awsemf/application_signals"}, extensions: []string{"agenthealth/logs"}, }, @@ -165,7 +165,7 @@ func TestTranslatorMetricsForKubernetes(t *testing.T) { }, want: &want{ receivers: []string{"otlp/application_signals"}, - processors: []string{"metricstransform/application_signals", "awsentity/service/application_signals", "resourcedetection", "awsapplicationsignals"}, + processors: []string{"metricstransform/application_signals", "resourcedetection", "awsapplicationsignals", "awsentity/service/application_signals"}, exporters: []string{"awsemf/application_signals"}, extensions: []string{"agenthealth/logs"}, },