Skip to content

Conversation

@AbhiPrasad
Copy link
Member

Previously the Sentry Propagator was setting the sample rate on the opentelemetry span context based on the incoming traceparent from sentry-trace. This is problematic because it a span is unsampled, it does not enter a span processor. This means that we could create transactions erroneously (for example, unnecessarily promote a child span to a transaction).

To fix this, we move the sampling decision from the propagator to the span processor.

Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

change is fine for me, but asked a question so we have some discussion on the edge case

};

// Only inherit sample rate if `traceId` is the same
if (traceparentData && traceId === traceparentData.traceId) {
Copy link
Member

Choose a reason for hiding this comment

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

this state is obviously possible but it's not clear to me

  • when that happens
  • if there's a mismatch, we don't take the sampled decision, but what are the consequences of that in the later flow?

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'm going to sleep on this and come back to it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, so the only way there is a possible mismatch is if there is user mis-configuration - like they override span attributes themselves or do some custom logic. From what I read through, the SDK itself should not make this possible in any way.

With that in mind, I'm going to keep this guard anyway because I don't wanna re-run tests, but I don't think this check is necessary in other SDKs.

Copy link
Member

Choose a reason for hiding this comment

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

alright sounds good

@AbhiPrasad AbhiPrasad merged commit 24cfda2 into master Nov 9, 2022
@AbhiPrasad AbhiPrasad deleted the abhi-otel-sampling branch November 9, 2022 12:40
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.

3 participants