Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement messaging.kafka.* attributes spec (part 1) #7824

Merged

Conversation

mateuszrzeszutek
Copy link
Member

Part 1 of #7771

It's a lot more than I initially expected it to be; I'll introduce the clientId attribute in part 2

@mateuszrzeszutek mateuszrzeszutek requested a review from a team as a code owner February 15, 2023 16:55
@mateuszrzeszutek mateuszrzeszutek changed the title Implement messaging.kafka.* attributes spec (part 1) Implement messaging.kafka.* attributes spec (part 1) Feb 15, 2023
@AutoValue
public abstract class ConsumerAndRecord<R> {

public static <R> ConsumerAndRecord<R> create(@Nullable Consumer<?, ?> consumer, R record) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried implementing the same metrics. Instead of consumer + record I went with record + consumerGroup + clientId. I suspect it will be hard to get access to consumer/producer in TracingConsumerInterceptor and TracingProducerInterceptor while the string values can be extracted in configure method.
Another potential issue is that ConsumerAndRecord could potentially be injected in multiple class loaders if for example kafka client is in parent and spring is in child. We have soled similar issues by moving such shared classes to bootstrap, but then we'd have library module depending on a bootstrap module which I think we don't have elsewhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect it will be hard to get access to consumer/producer in TracingConsumerInterceptor and TracingProducerInterceptor while the string values can be extracted in configure method.

👍

Another potential issue is that ConsumerAndRecord could potentially be injected in multiple class loaders if for example kafka client is in parent and spring is in child.

This shouldn't be a problem; ConsumerAndRecord is not shared between different instrumentations, each one of them constructs a new value as needed.

@trask trask merged commit 12ea869 into open-telemetry:main Feb 16, 2023
@mateuszrzeszutek mateuszrzeszutek deleted the messaging-kafka-attributes branch February 17, 2023 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants