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(tracing): Include transaction in DSC if transaction source is not an unparameterized URL #5392

Merged
merged 4 commits into from
Jul 8, 2022

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jul 8, 2022

This PR re-introduces the transaction field in the Dynamic Sampling Context (DSC). However, its presence is now determined by the transaction source which was introduced in #5367.

As of this PR, we add the transaction field, if the source indicates that the tranasaction name is not an unparameterized URL.

While making the changes, I decided to clean up the previously commented out references to user_id (from #5363) in both, source code and tests. Given that user_id was ditched from DS, we probably won't need them going forward.

Additionally, the PR (once again) adjusts our unit and integration tests to reflect this change. Repurposed some DSC<=>sendDefaultPii tests that we previously skipped to now cover the transaction<=>transaction source dependence.

Develop Spec is updated here: getsentry/develop#635

Ultimately, this PR also removes the 'unknown' field from the TransactionSource type because it is only used by Relay and SDKs shouldn't set it.

resolves: #5383

@Lms24 Lms24 self-assigned this Jul 8, 2022
@Lms24 Lms24 added this to the Dynamic Sampling Context milestone Jul 8, 2022
const { segment: user_segment } = (scope && scope.getUser()) || {};

const source = this.metadata.source;
const transaction = source && source !== 'url' && source !== 'unknown' ? this.name : undefined;
Copy link
Member Author

@Lms24 Lms24 Jul 8, 2022

Choose a reason for hiding this comment

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

Was debating whether to include unknown in this condition. According to the spec Relay treats this value equally as transactions without a source. Which IMO means we shouldn't add the transaction name to the DSC.

Can remove it though if we agree that we never set unknown as a source value

Copy link
Member

Choose a reason for hiding this comment

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

For now I think this logic is fine. I would even argue that we should remove 'unknown' from the TransactionSource type, as it's only a fallback value that relay uses for older SDKs, which our's isn't because we're always on the new version (🤔).

If we decide to remove 'unknown' from TransactionSource we should do that before the next release, because that's breaking.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes that's a very good point. Thoughts about removing 'unknown' @AbhiPrasad?

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.34 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 59.86 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.94 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified) 52.78 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.71 KB (0%)
@sentry/browser - Webpack (minified) 64.15 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.73 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 43.95 KB (+0.06% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 25.72 KB (+0.09% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24 KB (+0.09% 🔺)

Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

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

Thank you! No blocking remarks!

const { segment: user_segment } = (scope && scope.getUser()) || {};

const source = this.metadata.source;
const transaction = source && source !== 'url' && source !== 'unknown' ? this.name : undefined;
Copy link
Member

Choose a reason for hiding this comment

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

For now I think this logic is fine. I would even argue that we should remove 'unknown' from the TransactionSource type, as it's only a fallback value that relay uses for older SDKs, which our's isn't because we're always on the new version (🤔).

If we decide to remove 'unknown' from TransactionSource we should do that before the next release, because that's breaking.

packages/node/test/integrations/http.test.ts Outdated Show resolved Hide resolved
packages/tracing/test/span.test.ts Show resolved Hide resolved
packages/tracing/test/span.test.ts Outdated Show resolved Hide resolved
@@ -162,8 +162,6 @@ export type TransactionSource =
| 'route'
/** Name of the view handling the request */
| 'view'
/** This is the default value set by Relay for legacy SDKs. */
| 'unknown'
Copy link
Member

Choose a reason for hiding this comment

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

@Lms24 Lms24 merged commit e97a639 into master Jul 8, 2022
@Lms24 Lms24 deleted the lms-dsc-resurrect-transaction branch July 8, 2022 15:05
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.

Include transaction in DSC iff transaction source is not a raw URL
3 participants