Skip to content

[receiver/kafka]: Support access to message key #35231

Open
@SoerenHenning

Description

@SoerenHenning

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions