Skip to content

Commit

Permalink
Translate awsentity processor last when translating pipelines (#1428)
Browse files Browse the repository at this point in the history
Co-authored-by: Lisa Guo <[email protected]>
  • Loading branch information
phugay and lisguo authored Nov 19, 2024
1 parent 4ec6d35 commit dd23711
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
Expand All @@ -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"},
},
Expand All @@ -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"},
},
Expand Down

0 comments on commit dd23711

Please sign in to comment.