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

Added missing messaging semantic attributes on the consumer spans #856

Conversation

ppatierno
Copy link
Member

The current bridge implementation uses the Kafka producer interceptor way for injecting span on producing (by using the OpenTelemetry implementation) but it doesn't the same on the consumer side (because producer and consumers span are not linked the right way, as the OTel community is working to fix for the future).
For this reason we generate the Kafka consumer span manually but right now we are missing some "messaging" related smantic attributes which are added by the OTel interceptor on producer automatically.
This PR fixes this problem.

@ppatierno ppatierno added this to the 0.28.0 milestone Dec 19, 2023
@ppatierno ppatierno requested a review from scholzj December 19, 2023 11:33
@@ -90,8 +91,11 @@ private SpanBuilder getSpanBuilder(RoutingContext routingContext, String operati

@Override
public <K, V> void handleRecordSpan(ConsumerRecord<K, V> record) {
String operationName = record.topic() + " " + MessageOperation.RECEIVE;
String operationName = record.topic() + " " + MessageOperation.RECEIVE.name().toLowerCase(Locale.ROOT);
Copy link
Member

Choose a reason for hiding this comment

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

What is the motivation behind using Locale.ROOT? I do not think we use it in many other places.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the way the official interceptor applies the lowecase, I was just applying the same.

@ppatierno ppatierno merged commit 8376fe4 into strimzi:main Dec 20, 2023
13 checks passed
@ppatierno ppatierno deleted the add-messaging-semantic-attributes-to-consumer-span branch December 20, 2023 05:58
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.

2 participants