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

fix(sampling): Remove stray sampling data tags #3197

Merged
merged 6 commits into from Feb 1, 2021

Conversation

lobsterkatie
Copy link
Member

Follow up to #3068.

In that PR, tags were used as a temporary way to get data through the event processors to the point where envelope headers are created. Once used, they were deleted from event.tags. Unfortunately, by that point they'd already been copied into contexts.trace, from which they weren't being deleted, causing them to show up in the UI.

This PR fixes that by using debug_meta instead of tags (which means that even if something goes wrong, it's only visible in the event JSON, not the UI) and adds a test to ensure that the data isn't where it shouldn't be. (It also does some cleanup work in that test suite to simplify things.)

transactionSampling: {
method: TransactionSamplingMethod.Sampler,
// cast to number in case it's a boolean
rate: Number(sampleRate),
Copy link
Member Author

Choose a reason for hiding this comment

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

@jan-auer Once consequence of this change is that rates will come through as numbers rather than strings. (When I did the original PR, tags had to be strings, which is why I stringified the value in the first place.) LMK if that's not good from a relay perspective and I can turn them back into strings.

Copy link
Member

@jan-auer jan-auer Jan 29, 2021

Choose a reason for hiding this comment

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

Is this what you put into the sample_rates item header? The schema in there is:

type SampleRate = {
  id: String,
  rate: Number,
}

If this goes into the header, let's rather keep it consistent to avoid mistakes please. As for the rate, that should be a number all along.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 20.34 KB (+0.04% 🔺)
@sentry/browser - Webpack 21.22 KB (+0.06% 🔺)
@sentry/react - Webpack 21.24 KB (+0.05% 🔺)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 27.28 KB (+0.08% 🔺)

@@ -3,6 +3,7 @@
**/
export interface DebugMeta {
images?: Array<DebugImage>;
transactionSampling?: { rate?: number; method?: string };
Copy link
Contributor

Choose a reason for hiding this comment

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

If we call it rate and id in the protocol, couldn't we unify it here as well? It'd make some object deconstruction easier.

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 would make object deconstruction easier. I didn't do it because id is opaque. What's it the id of? Unless you feel strongly I'd rather keep it as is.

Copy link
Contributor

Choose a reason for hiding this comment

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

I totally agree, but why is Relay using it in the first place? :P

Copy link
Member Author

Choose a reason for hiding this comment

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

You'll have to take that up with @jan-auer 😛

Copy link
Member

Choose a reason for hiding this comment

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

See also #3197 (comment). Relay doesn't use this field, but it also sample in its own way. The id field identifies not only the method but in case of Relay also the rule which applied.

Ultimately, this all ends up in Sentry and in our data pipeline.

@kamilogorek kamilogorek self-requested a review January 26, 2021 16:15
@lobsterkatie lobsterkatie force-pushed the kmclb-fix-sampling-metadata-tags branch from 75ee7af to ab8e93b Compare January 28, 2021 23:56
This was referenced Mar 14, 2021
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.

None yet

3 participants