elastic / apm-data

apm-data holds definitions and code for manipulating Elastic APM data
Apache License 2.0
12 stars 25 forks source link

feat: support latest `messaging.destination.name` attribute #298

Closed kyungeunni closed 2 months ago

kyungeunni commented 2 months ago

addresses #284

latest semconv attributes introduced messaging.destination.name to replace messaging.destination. This PR will support the latest semconv attribute for mapping while keep supporting the old attribute for backward compatibility.

note: updating the semconv to the latest is not done due to the lack of defined process issue

carsonip commented 1 month ago

Testing

:heavy_check_mark: test-plan-ok

Setup: use a modified sendotlp to send transaction/span with specific attributes.

Result: both messaging.destination and messaging.destination.name sets {transaction,span}.{type,message.queue.name} correctly

transaction with messaging.destination="foo"

ES document ```json { "_index": ".ds-traces-apm-default-2024.07.18-000001", "_id": "hEwXxZABLjQNWnzvHfM3", "_version": 1, "_score": 0, "_source": { "observer": { "hostname": "928b4bafd551", "type": "apm-server", "version": "8.15.0" }, "agent": { "name": "opentelemetry/go", "version": "1.27.0" }, "trace": { "id": "185b8f36752e7f7113d39b81aa736489" }, "@timestamp": "2024-07-18T09:05:42.706Z", "data_stream": { "namespace": "default", "type": "traces", "dataset": "apm" }, "service": { "framework": { "name": "sendotlp" }, "name": "unknown_service____2sendotlp_ess", "language": { "name": "go" } }, "event": { "success_count": 1, "outcome": "success" }, "processor": { "event": "transaction" }, "transaction": { "result": "Success", "duration": { "us": 1124913 }, "representative_count": 1, "name": "parent", "id": "b37b05183a45793f", "message": { "queue": { "name": "foo" } }, "type": "messaging", "sampled": true }, "span": { "id": "b37b05183a45793f" }, "timestamp": { "us": 1721293542706683 } }, "fields": { "transaction.name.text": [ "parent" ], "transaction.message.queue.name.text": [ "foo" ], "transaction.representative_count": [ 1 ], "service.language.name": [ "go" ], "transaction.result": [ "Success" ], "transaction.sampled": [ true ], "transaction.id": [ "b37b05183a45793f" ], "trace.id": [ "185b8f36752e7f7113d39b81aa736489" ], "agent.name.text": [ "opentelemetry/go" ], "event.success_count": [ 1 ], "processor.event": [ "transaction" ], "agent.name": [ "opentelemetry/go" ], "event.outcome": [ "success" ], "service.name": [ "unknown_service____2sendotlp_ess" ], "service.framework.name": [ "sendotlp" ], "data_stream.namespace": [ "default" ], "service.language.name.text": [ "go" ], "transaction.duration.us": [ 1124913 ], "span.id": [ "b37b05183a45793f" ], "data_stream.type": [ "traces" ], "observer.hostname": [ "928b4bafd551" ], "service.framework.name.text": [ "sendotlp" ], "transaction.type": [ "messaging" ], "transaction.message.queue.name": [ "foo" ], "timestamp.us": [ 1721293542706683 ], "@timestamp": [ "2024-07-18T09:05:42.706Z" ], "observer.type": [ "apm-server" ], "observer.version": [ "8.15.0" ], "service.name.text": [ "unknown_service____2sendotlp_ess" ], "data_stream.dataset": [ "apm" ], "agent.version": [ "1.27.0" ], "transaction.name": [ "parent" ] } } ```

transaction with messaging.destination.name="foo"

ES document ```json { "_index": ".ds-traces-apm-default-2024.07.18-000001", "_id": "lkwbxZABLjQNWnzvgvNp", "_version": 1, "_score": 0, "_source": { "observer": { "hostname": "928b4bafd551", "type": "apm-server", "version": "8.15.0" }, "agent": { "name": "opentelemetry/go", "version": "1.27.0" }, "trace": { "id": "af03aec8e645214f6259c906f840812b" }, "@timestamp": "2024-07-18T09:10:30.840Z", "data_stream": { "namespace": "default", "type": "traces", "dataset": "apm" }, "service": { "framework": { "name": "sendotlp" }, "name": "unknown_service____2sendotlp_ess", "language": { "name": "go" } }, "event": { "success_count": 1, "outcome": "success" }, "processor": { "event": "transaction" }, "transaction": { "result": "Success", "duration": { "us": 942704 }, "representative_count": 1, "name": "parent", "id": "010c31597f02b40a", "message": { "queue": { "name": "foo" } }, "type": "messaging", "sampled": true }, "span": { "id": "010c31597f02b40a" }, "timestamp": { "us": 1721293830840598 } }, "fields": { "transaction.name.text": [ "parent" ], "transaction.message.queue.name.text": [ "foo" ], "transaction.representative_count": [ 1 ], "service.language.name": [ "go" ], "transaction.result": [ "Success" ], "transaction.sampled": [ true ], "transaction.id": [ "010c31597f02b40a" ], "trace.id": [ "af03aec8e645214f6259c906f840812b" ], "agent.name.text": [ "opentelemetry/go" ], "event.success_count": [ 1 ], "processor.event": [ "transaction" ], "agent.name": [ "opentelemetry/go" ], "event.outcome": [ "success" ], "service.name": [ "unknown_service____2sendotlp_ess" ], "service.framework.name": [ "sendotlp" ], "data_stream.namespace": [ "default" ], "service.language.name.text": [ "go" ], "transaction.duration.us": [ 942704 ], "span.id": [ "010c31597f02b40a" ], "data_stream.type": [ "traces" ], "observer.hostname": [ "928b4bafd551" ], "service.framework.name.text": [ "sendotlp" ], "transaction.type": [ "messaging" ], "transaction.message.queue.name": [ "foo" ], "timestamp.us": [ 1721293830840598 ], "@timestamp": [ "2024-07-18T09:10:30.840Z" ], "observer.type": [ "apm-server" ], "observer.version": [ "8.15.0" ], "service.name.text": [ "unknown_service____2sendotlp_ess" ], "data_stream.dataset": [ "apm" ], "agent.version": [ "1.27.0" ], "transaction.name": [ "parent" ] } } ```

span with messaging.destination="foo"

ES document ```json { "_index": ".ds-traces-apm-default-2024.07.18-000001", "_id": "nkwcxZABLjQNWnzvrvOv", "_version": 1, "_score": 0, "_source": { "observer": { "hostname": "928b4bafd551", "type": "apm-server", "version": "8.15.0" }, "parent": { "id": "8c67d7a7c326cb3d" }, "agent": { "name": "opentelemetry/go", "version": "1.27.0" }, "trace": { "id": "bd2575fa1811ff517937d014ca979d3a" }, "@timestamp": "2024-07-18T09:11:47.828Z", "data_stream": { "namespace": "default", "type": "traces", "dataset": "apm" }, "service": { "name": "unknown_service____2sendotlp_ess", "language": { "name": "go" }, "target": { "name": "foo", "type": "messaging" } }, "event": { "success_count": 1, "outcome": "success" }, "processor": { "event": "span" }, "span": { "duration": { "us": 10668 }, "representative_count": 1, "name": "child1", "id": "48505703693f29b2", "message": { "queue": { "name": "foo" } }, "type": "messaging" }, "timestamp": { "us": 1721293907828740 } }, "fields": { "span.name": [ "child1" ], "service.target.name.text": [ "foo" ], "service.language.name": [ "go" ], "trace.id": [ "bd2575fa1811ff517937d014ca979d3a" ], "span.duration.us": [ 10668 ], "agent.name.text": [ "opentelemetry/go" ], "event.success_count": [ 1 ], "span.message.queue.name": [ "foo" ], "processor.event": [ "span" ], "span.name.text": [ "child1" ], "service.target.type": [ "messaging" ], "agent.name": [ "opentelemetry/go" ], "event.outcome": [ "success" ], "service.name": [ "unknown_service____2sendotlp_ess" ], "data_stream.namespace": [ "default" ], "service.language.name.text": [ "go" ], "span.id": [ "48505703693f29b2" ], "service.target.name": [ "foo" ], "span.message.queue.name.text": [ "foo" ], "data_stream.type": [ "traces" ], "observer.hostname": [ "928b4bafd551" ], "span.type": [ "messaging" ], "timestamp.us": [ 1721293907828740 ], "@timestamp": [ "2024-07-18T09:11:47.828Z" ], "observer.type": [ "apm-server" ], "observer.version": [ "8.15.0" ], "service.name.text": [ "unknown_service____2sendotlp_ess" ], "data_stream.dataset": [ "apm" ], "agent.version": [ "1.27.0" ], "parent.id": [ "8c67d7a7c326cb3d" ], "span.representative_count": [ 1 ] } } ```

span with messaging.destination.name="foo"

ES document ```json { "_index": ".ds-traces-apm-default-2024.07.18-000001", "_id": "q0wexZABLjQNWnzve_P_", "_version": 1, "_score": 0, "_source": { "observer": { "hostname": "928b4bafd551", "type": "apm-server", "version": "8.15.0" }, "parent": { "id": "e46b08786b811404" }, "agent": { "name": "opentelemetry/go", "version": "1.27.0" }, "trace": { "id": "ce2e8453342d0924ff793eed13a2cb46" }, "@timestamp": "2024-07-18T09:13:46.066Z", "data_stream": { "namespace": "default", "type": "traces", "dataset": "apm" }, "service": { "name": "unknown_service____2sendotlp_ess", "language": { "name": "go" }, "target": { "name": "foo", "type": "messaging" } }, "event": { "success_count": 1, "outcome": "success" }, "processor": { "event": "span" }, "span": { "duration": { "us": 10447 }, "representative_count": 1, "name": "child1", "id": "5b6f2248b60147ca", "message": { "queue": { "name": "foo" } }, "type": "messaging" }, "timestamp": { "us": 1721294026066278 } }, "fields": { "span.name": [ "child1" ], "service.target.name.text": [ "foo" ], "service.language.name": [ "go" ], "trace.id": [ "ce2e8453342d0924ff793eed13a2cb46" ], "span.duration.us": [ 10447 ], "agent.name.text": [ "opentelemetry/go" ], "event.success_count": [ 1 ], "span.message.queue.name": [ "foo" ], "processor.event": [ "span" ], "span.name.text": [ "child1" ], "service.target.type": [ "messaging" ], "agent.name": [ "opentelemetry/go" ], "event.outcome": [ "success" ], "service.name": [ "unknown_service____2sendotlp_ess" ], "data_stream.namespace": [ "default" ], "service.language.name.text": [ "go" ], "span.id": [ "5b6f2248b60147ca" ], "service.target.name": [ "foo" ], "span.message.queue.name.text": [ "foo" ], "data_stream.type": [ "traces" ], "observer.hostname": [ "928b4bafd551" ], "span.type": [ "messaging" ], "timestamp.us": [ 1721294026066278 ], "@timestamp": [ "2024-07-18T09:13:46.066Z" ], "observer.type": [ "apm-server" ], "observer.version": [ "8.15.0" ], "service.name.text": [ "unknown_service____2sendotlp_ess" ], "data_stream.dataset": [ "apm" ], "agent.version": [ "1.27.0" ], "parent.id": [ "e46b08786b811404" ], "span.representative_count": [ 1 ] } } ```