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

ref: Unify TracesSampler #498

Merged
merged 9 commits into from Nov 29, 2022
Merged

ref: Unify TracesSampler #498

merged 9 commits into from Nov 29, 2022

Conversation

cleptric
Copy link
Member

@cleptric cleptric commented Nov 14, 2022

In order to implement Dynamic Sampling, I had to make changes to how the TracesSampler works in the SDK.
I'm aware that this is a breaking change, but it is required at this point.

For Dynamic Sampling, a sample_rate item needs to be present in the trace envelope header.
With the current implementation, accessing these values was not possible.

  • Unify the TracesSampler to always return a float64. This is in line with the implementation of all other SDKs and https://develop.sentry.dev/sdk/performance/#tracessampler
  • I made the sample method quite verbose, if debug: true, as this is a constant pain point for developers to figure out what is happening.
  • As we can't denote TracesSampleRate: 0.0/nil, I introduced a new ClientOption called EnableTracing, which turns off tracing completely by default. This setting is required, as we need a way to allow developers to turn off sampling that could be started by a sentry-trace header with a true sampling decision. I did consider using a pointer, but this was too clunky.

Open questions:

  • The old and new implementations would also sample spans if the TracesSampler option is set. I hence would vote for only calling sample() on transactions. @AbhiPrasad Do I miss the use-case of sampling spans separately to a transaction? I missed this when making my changes. Not an issue anymore, I kept the old logic in place.

client.go Show resolved Hide resolved
client.go Show resolved Hide resolved
@cleptric cleptric marked this pull request as ready for review November 29, 2022 10:42
@cleptric cleptric changed the title [WIP] ref: Unify TracesSampler ref: Unify TracesSampler Nov 29, 2022
client.go Show resolved Hide resolved
client.go Show resolved Hide resolved
tracing.go Show resolved Hide resolved
@@ -1,5 +1,7 @@
# Changelog

- *[breaking]* ref: Unify TracesSampler (#444)
Copy link
Member

Choose a reason for hiding this comment

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

Can we add migration docs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, this is just a reminder for me when doing the release. I’ll try to match the Ruby standard going forward in Go

@cleptric cleptric merged commit c5a9734 into master Nov 29, 2022
@cleptric cleptric deleted the traces-sampler branch November 29, 2022 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants