diff --git a/plugins/processors/awsappsignals/internal/resolver/attributesresolver.go b/plugins/processors/awsappsignals/internal/resolver/attributesresolver.go index fb7b172b6a..3531545ec1 100644 --- a/plugins/processors/awsappsignals/internal/resolver/attributesresolver.go +++ b/plugins/processors/awsappsignals/internal/resolver/attributesresolver.go @@ -17,7 +17,8 @@ import ( const AttributePlatformGeneric = "Generic" var DefaultHostedInAttributes = map[string]string{ - attr.AWSHostedInEnvironment: attr.HostedInEnvironment, + attr.AWSHostedInEnvironment: attr.HostedInEnvironment, + attr.ResourceDetectionHostName: attr.ResourceDetectionHostName, } type subResolver interface { diff --git a/plugins/processors/awsappsignals/internal/resolver/attributesresolver_test.go b/plugins/processors/awsappsignals/internal/resolver/attributesresolver_test.go index 5f5d4868aa..336ce57ad7 100644 --- a/plugins/processors/awsappsignals/internal/resolver/attributesresolver_test.go +++ b/plugins/processors/awsappsignals/internal/resolver/attributesresolver_test.go @@ -66,6 +66,19 @@ func TestHostedInAttributeResolverWithConflictedName(t *testing.T) { assert.Equal(t, "self-defined", envAttr.AsString()) } +func TestHostedInAttributeResolverWithHostname(t *testing.T) { + resolver := newHostedInAttributeResolver("test", DefaultHostedInAttributes) + + attributes := pcommon.NewMap() + resourceAttributes := pcommon.NewMap() + resourceAttributes.PutStr(attr.ResourceDetectionHostName, "hostname") + + resolver.Process(attributes, resourceAttributes) + envAttr, ok := attributes.Get(attr.ResourceDetectionHostName) + assert.True(t, ok) + assert.Equal(t, "hostname", envAttr.AsString()) +} + func TestAttributesResolver_Process(t *testing.T) { attributes := pcommon.NewMap() resourceAttributes := pcommon.NewMap() diff --git a/translator/tocwconfig/sampleConfig/base_appsignals_config.yaml b/translator/tocwconfig/sampleConfig/base_appsignals_config.yaml index 1be9802cd8..2618bb0467 100644 --- a/translator/tocwconfig/sampleConfig/base_appsignals_config.yaml +++ b/translator/tocwconfig/sampleConfig/base_appsignals_config.yaml @@ -26,6 +26,10 @@ exporters: - aws.span.kind regex: ^(SERVER|LOCAL_ROOT)$ separator: ; + - label_names: + - host.name + regex: .* + separator: ; metric_name_selectors: - Latency - Fault @@ -66,6 +70,10 @@ exporters: - aws.span.kind regex: ^(CLIENT|PRODUCER|CONSUMER)$ separator: ; + - label_names: + - host.name + regex: .* + separator: ; metric_name_selectors: - Latency - Fault diff --git a/translator/translate/otel/exporter/awsemf/appsignals_config_generic.yaml b/translator/translate/otel/exporter/awsemf/appsignals_config_generic.yaml index 942faf6d81..1063db22fb 100644 --- a/translator/translate/otel/exporter/awsemf/appsignals_config_generic.yaml +++ b/translator/translate/otel/exporter/awsemf/appsignals_config_generic.yaml @@ -10,6 +10,9 @@ metric_declarations: - label_names: - aws.span.kind regex: '^(SERVER|LOCAL_ROOT)$' + - label_names: + - host.name + regex: '.*' metric_name_selectors: - Latency - Fault @@ -27,6 +30,9 @@ metric_declarations: - label_names: - aws.span.kind regex: '^(CLIENT|PRODUCER|CONSUMER)$' + - label_names: + - host.name + regex: '.*' metric_name_selectors: - Latency - Fault