diff --git a/.chloggen/add_es_exporter_deploy_name_ecs.yaml b/.chloggen/add_es_exporter_deploy_name_ecs.yaml new file mode 100644 index 000000000000..fd9691fedc91 --- /dev/null +++ b/.chloggen/add_es_exporter_deploy_name_ecs.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: elasticsearchexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add translation for k8s.deployment.name resource attribute + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [33622] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/exporter/elasticsearchexporter/model.go b/exporter/elasticsearchexporter/model.go index 36702776e791..6f29f031a252 100644 --- a/exporter/elasticsearchexporter/model.go +++ b/exporter/elasticsearchexporter/model.go @@ -43,10 +43,11 @@ var resourceAttrsConversionMap = map[string]string{ semconv.AttributeOSType: "host.os.platform", semconv.AttributeOSDescription: "host.os.full", semconv.AttributeOSVersion: "host.os.version", - "k8s.namespace.name": "kubernetes.namespace", - "k8s.node.name": "kubernetes.node.name", - "k8s.pod.name": "kubernetes.pod.name", - "k8s.pod.uid": "kubernetes.pod.uid", + semconv.AttributeK8SDeploymentName: "kubernetes.deployment.name", + semconv.AttributeK8SNamespaceName: "kubernetes.namespace", + semconv.AttributeK8SNodeName: "kubernetes.node.name", + semconv.AttributeK8SPodName: "kubernetes.pod.name", + semconv.AttributeK8SPodUID: "kubernetes.pod.uid", } // resourceAttrsToPreserve contains conventions that should be preserved in ECS mode. diff --git a/exporter/elasticsearchexporter/model_test.go b/exporter/elasticsearchexporter/model_test.go index 5fb15b05f6fa..2c1d1434ce99 100644 --- a/exporter/elasticsearchexporter/model_test.go +++ b/exporter/elasticsearchexporter/model_test.go @@ -299,6 +299,7 @@ func TestEncodeLogECSMode(t *testing.T) { "k8s.node.name": "node-1", "k8s.pod.name": "opentelemetry-pod-autoconf", "k8s.pod.uid": "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff", + "k8s.deployment.name": "coredns", }) require.NoError(t, err) @@ -321,44 +322,45 @@ func TestEncodeLogECSMode(t *testing.T) { expectedDocFields := pcommon.NewMap() err = expectedDocFields.FromRaw(map[string]any{ - "service.name": "foo.bar", - "service.version": "1.1.0", - "service.node.name": "i-103de39e0a", - "agent.name": "opentelemetry/perl", - "agent.version": "7.9.12", - "cloud.provider": "gcp", - "cloud.account.id": "19347013", - "cloud.region": "us-west-1", - "cloud.availability_zone": "us-west-1b", - "cloud.service.name": "gke", - "container.name": "happy-seger", - "container.id": "e69cc5d3dda", - "container.image.name": "my-app", - "container.runtime": "docker", - "host.hostname": "i-103de39e0a.gke.us-west-1b.cloud.google.com", - "host.name": "i-103de39e0a.gke.us-west-1b.cloud.google.com", - "host.id": "i-103de39e0a", - "host.type": "t2.medium", - "host.architecture": "x86_64", - "process.pid": 9833, - "process.command_line": "/usr/bin/ssh -l user 10.0.0.16", - "process.executable": "/usr/bin/ssh", - "service.runtime.name": "OpenJDK Runtime Environment", - "service.runtime.version": "14.0.2", - "host.os.platform": "darwin", - "host.os.full": "Mac OS Mojave", - "host.os.name": "Mac OS X", - "host.os.version": "10.14.1", - "host.os.type": "macos", - "device.id": "00000000-54b3-e7c7-0000-000046bffd97", - "device.model.identifier": "SM-G920F", - "device.model.name": "Samsung Galaxy S6", - "device.manufacturer": "Samsung", - "event.action": "user-password-change", - "kubernetes.namespace": "default", - "kubernetes.node.name": "node-1", - "kubernetes.pod.name": "opentelemetry-pod-autoconf", - "kubernetes.pod.uid": "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff", + "service.name": "foo.bar", + "service.version": "1.1.0", + "service.node.name": "i-103de39e0a", + "agent.name": "opentelemetry/perl", + "agent.version": "7.9.12", + "cloud.provider": "gcp", + "cloud.account.id": "19347013", + "cloud.region": "us-west-1", + "cloud.availability_zone": "us-west-1b", + "cloud.service.name": "gke", + "container.name": "happy-seger", + "container.id": "e69cc5d3dda", + "container.image.name": "my-app", + "container.runtime": "docker", + "host.hostname": "i-103de39e0a.gke.us-west-1b.cloud.google.com", + "host.name": "i-103de39e0a.gke.us-west-1b.cloud.google.com", + "host.id": "i-103de39e0a", + "host.type": "t2.medium", + "host.architecture": "x86_64", + "process.pid": 9833, + "process.command_line": "/usr/bin/ssh -l user 10.0.0.16", + "process.executable": "/usr/bin/ssh", + "service.runtime.name": "OpenJDK Runtime Environment", + "service.runtime.version": "14.0.2", + "host.os.platform": "darwin", + "host.os.full": "Mac OS Mojave", + "host.os.name": "Mac OS X", + "host.os.version": "10.14.1", + "host.os.type": "macos", + "device.id": "00000000-54b3-e7c7-0000-000046bffd97", + "device.model.identifier": "SM-G920F", + "device.model.name": "Samsung Galaxy S6", + "device.manufacturer": "Samsung", + "event.action": "user-password-change", + "kubernetes.namespace": "default", + "kubernetes.node.name": "node-1", + "kubernetes.pod.name": "opentelemetry-pod-autoconf", + "kubernetes.pod.uid": "275ecb36-5aa8-4c2a-9c47-d8bb681b9aff", + "kubernetes.deployment.name": "coredns", }) require.NoError(t, err)