Open
Description
Component(s)
receiver/kafka
Is your feature request related to a problem? Please describe.
It looks like there is currently no way to access the key of a Kafka message. This feature would be quite helpful as it is a common pattern to carry non-redundant data in the key and this data should also be exported to an OTel backend. Note that exporting message headers is already supported.
Describe the solution you'd like
The easiest solution would probably be to extract the key and add it to the resource attributes, just like it is already possible with headers. I propose adding the following configuration:
key_extraction
(default = false): Allows user to attach the message key to resource attributes in otel piepline
Describe alternatives you've considered
Alternatively, the key could also be added somehow to the body of a log record, but the specific implementation would depend on the encoding
. I am therefore much more in favor of adding the key to the resource attributes.
Additional context
No response