diff --git a/input/otlp/metadata.go b/input/otlp/metadata.go index 3d528a91..2a1e854c 100644 --- a/input/otlp/metadata.go +++ b/input/otlp/metadata.go @@ -66,7 +66,8 @@ func translateResourceMetadata(resource pcommon.Resource, out *modelpb.APMEvent) out.Service.Node.Name = truncate(v.Str()) // deployment.* - case semconv.AttributeDeploymentEnvironment: + // deployment.environment is deprecated, use deployment.environment.name instead + case semconv.AttributeDeploymentEnvironment, "deployment.environment.name": if out.Service == nil { out.Service = &modelpb.Service{} } diff --git a/input/otlp/metadata_test.go b/input/otlp/metadata_test.go index df0a914e..db5a48cf 100644 --- a/input/otlp/metadata_test.go +++ b/input/otlp/metadata_test.go @@ -43,7 +43,7 @@ func TestResourceConventions(t *testing.T) { attrs: nil, expected: &modelpb.APMEvent{Agent: &defaultAgent, Service: &defaultService}, }, - "service": { + "service with deprecated deployment.environment": { attrs: map[string]interface{}{ "service.name": "service_name", "service.version": "service_version", @@ -61,6 +61,24 @@ func TestResourceConventions(t *testing.T) { }, }, }, + "service": { + attrs: map[string]interface{}{ + "service.name": "service_name", + "service.version": "service_version", + "service.instance.id": "service_node_name", + "deployment.environment.name": "service_environment", + }, + expected: &modelpb.APMEvent{ + Agent: &modelpb.Agent{Name: "otlp", Version: "unknown"}, + Service: &modelpb.Service{ + Name: "service_name", + Version: "service_version", + Environment: "service_environment", + Node: &modelpb.ServiceNode{Name: "service_node_name"}, + Language: &modelpb.Language{Name: "unknown"}, + }, + }, + }, "agent": { attrs: map[string]interface{}{ "telemetry.sdk.name": "sdk_name",