Skip to content

Generate only consumer span for sqs receive message#9652

Merged
laurit merged 1 commit into
open-telemetry:mainfrom
laurit:aws-receive-message
Oct 18, 2023
Merged

Generate only consumer span for sqs receive message#9652
laurit merged 1 commit into
open-telemetry:mainfrom
laurit:aws-receive-message

Conversation

@laurit

@laurit laurit commented Oct 11, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
@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