Skip to content

feat: update to otel semconv 1.40.0#719

Open
epbensimpson wants to merge 2 commits intoFarfetch:masterfrom
epbensimpson:otel-conventions-1.4.0
Open

feat: update to otel semconv 1.40.0#719
epbensimpson wants to merge 2 commits intoFarfetch:masterfrom
epbensimpson:otel-conventions-1.4.0

Conversation

@epbensimpson
Copy link
Copy Markdown

@epbensimpson epbensimpson commented Apr 2, 2026

Description

Updates KafkaFlow.OpenTelemetry to the OTEL Semantic Conventions 1.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

Attribute Reason
peer.service Contained the bootstrap server list, which does not represent the broker that handled a given message

Renamed

Old New Where
messaging.operation = "publish" messaging.operation.type = "send" + messaging.operation.name = "publish" Producer
messaging.operation = "process" messaging.operation.type = "receive" + messaging.operation.name = "process" Consumer
messaging.source.name messaging.destination.name Consumer
messaging.kafka.consumer.group messaging.consumer.group.name Consumer
messaging.kafka.message.offset messaging.kafka.offset Both
messaging.kafka.source.partition messaging.destination.partition.id Consumer
messaging.kafka.destination.partition messaging.destination.partition.id Producer

Added

Attribute Where Notes
messaging.client.id Consumer Set to ConsumerContext.ConsumerName — closest available proxy for the Kafka client ID, which is not exposed by IConsumerContext
messaging.kafka.message.tombstone = true Both Only emitted when message value is null
messaging.message.body.size Consumer Only emitted when the message value is still byte[] (i.e. before deserialization middleware has run)
error.type Both Emitted in error handlers only; value is the exception's fully-qualified type name

Bug fix

messaging.kafka.message.key: the consumer previously always emitted this tag (empty string for null keys, with an unsafe cast to byte[]), and the producer emitted the raw
object. Both now share a FormatMessageKey helper that UTF-8 decodes byte[] keys, calls ToString() on other types, and omits the tag entirely when the key is null.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have made corresponding changes to the documentation

Disclaimer

By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants