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

Generate only consumer span for sqs receive message #9652

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Oct 11, 2023

Currently sqs instrumentation generates two spans named SQS.ReceiveMessage. One is the consumer span that is in the same trace as the producer. The other is the rpc/http client span that is in a separate trace, this span is responsible of suppressing the underlying http client instrumentation. This pr skips creating the rpc/http span if there is no parent trace and no error. When there is no parent trace this span would be in its own trace which is not connected to the trace with the messaging spans.

@laurit laurit requested a review from a team October 11, 2023 09:50
if (Context.root() == parentContext
&& "com.amazonaws.services.sqs.model.ReceiveMessageRequest"
.equals(request.getOriginalRequest().getClass().getName())) {
Context context = InstrumenterUtil.suppressSpan(requestInstrumenter, parentContext, request);
Copy link
Member

Choose a reason for hiding this comment

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

This is another good case for the suppressSpan flag mentioned in open-telemetry/opentelemetry-java#5886
For not this hack is probably fine though

@laurit laurit merged commit 3dbc301 into open-telemetry:main Oct 18, 2023
46 checks passed
@laurit laurit deleted the aws-receive-message branch October 18, 2023 09:25
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