feat: update to otel semconv 1.40.0#719
Conversation
use "process" for operation.type
c44c60f to
16cbcde
Compare
| activity.SetTag(ActivitySourceAccessor.AttributeMessagingKafkaMessageKey, messageKey); | ||
| activity.SetTag(ActivitySourceAccessor.AttributeMessagingKafkaMessageOffset, context.ConsumerContext.Offset); | ||
| activity.SetTag(AttributeMessagingKafkaSourcePartition, context.ConsumerContext.Partition); | ||
| activity.SetTag(AttributeKeys.OperationType, ProcessString); |
There was a problem hiding this comment.
The messaging.operation.type tag name for consumer is being set with the value process instead of receive like you wrote in your PR description
There was a problem hiding this comment.
Ah I think I made that change after raising the PR, I spotted the list of well-known values and process seems like the more appropriate value here:
| Value | Description |
|---|---|
| process | One or more messages are processed by a consumer. |
| receive | One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages. |
I'll update the PR description
| internal static class AttributeKeys | ||
| { | ||
| public const string ClientId = "messaging.client.id"; | ||
| public const string ConsumerGroupName = "messaging.consumer.group.name"; |
There was a problem hiding this comment.
I would put this consumer specific attribute in the consumer handler, just like the process attribute, or else move all consumer/producer attributes to this class. What's your opinion @brmagadutra @joelfoliveira ?
There was a problem hiding this comment.
I may be missing something but I'm fairly sure all of the attribute keys are defined here? Except for messaging.system which is still inline in SetGenericTags (and could probably be moved for consistency)
The only strings defined in the Producer/Consumer handlers are for tag values, not keys.
Description
Updates
KafkaFlow.OpenTelemetryto the OTEL Semantic Conventions1.40.0(current version at time of writing).https://github.com/open-telemetry/semantic-conventions/blob/v1.40.0/docs/messaging/kafka.md
This contains some breaking changes to attribute names due to the unstable nature of the spec.
Implements #470
Summary of changes
Removed
peer.serviceRenamed
messaging.operation="publish"messaging.operation.type="send"+messaging.operation.name="publish"messaging.source.namemessaging.destination.namemessaging.kafka.consumer.groupmessaging.consumer.group.namemessaging.kafka.message.offsetmessaging.kafka.offsetmessaging.kafka.source.partitionmessaging.destination.partition.idmessaging.kafka.destination.partitionmessaging.destination.partition.idAdded
messaging.client.idConsumerContext.ConsumerName— closest available proxy for the Kafka client ID, which is not exposed byIConsumerContextmessaging.kafka.message.tombstone=truemessaging.message.body.sizebyte[](i.e. before deserialization middleware has run)error.typeBug fix
messaging.kafka.message.key: the consumer previously always emitted this tag (empty string for null keys, with an unsafe cast tobyte[]), and the producer emitted the rawobject. Both now share aFormatMessageKeyhelper that UTF-8 decodesbyte[]keys, callsToString()on other types, and omits the tag entirely when the key is null.Checklist
Disclaimer
By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement