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

feat(core): Deprecate Span.op in favor of op attribute #10189

Merged
merged 6 commits into from
Jan 17, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 15, 2024

This PR deprecates Span.op in favour of:

  • spanToJson to get the span op
  • startSpan functions to set the initial span op
  • setAttribute('SEMANTIC_ATTRIBUTE_SENTRY_OP', ...) to update the span op

Going forward, the span op will become a semantic, Sentry-specific span attribute. With this PR we already set, get and update the attribute but still provide the deprecated op getter and setter for v7 backwards compatibility.

Added behaviour:
spanToJson currently writes attributes into span.data, meaning sentry.op becomes a new field on the data object in addition to being set on the top level op property. After discussing this, it's probably okay to have this duplication at the moment. In an only-spans future, we'll likely remove the top level op property all together so we should be good.
The side effect is that I imagine a new sentry.op field could be visible in the product UI when looking at span/transaction data.

ref #10184

Comment on lines +88 to +92
data: {
'sentry.op': 'test op',
},
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 noticed that spanToJson sets the op also in data because it's saved as an attribute. Should we change this in the spanToJson implementation? I'd imagine, this would just be duplicated data in the product as we still need the top level event.op field anyway.
thoughts @mydea @AbhiPrasad?

Copy link
Member

Choose a reason for hiding this comment

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

I would leave it in, I think - rather if we don't want to send this, we can/should remove it wherever we generate the event 🤔 eventually (after v8? let's see..) I think any special handling of op & origin should go away and they should only be kept as attributes everywhere. But for now we can just keep both I believe...?

Copy link
Member Author

@Lms24 Lms24 Jan 16, 2024

Choose a reason for hiding this comment

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

eventually (after v8? let's see..) I think any special handling of op & origin should go away and they should only be kept as attributes everywhere

Agreed, that makes sense to me, thanks! Ok, I'll leave it in then and adjust the tests to accomodate the new behaviour. Worth pointing out that this isn't breaking anything, it's just adding a new data item anyhow.

Copy link
Contributor

github-actions bot commented Jan 15, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 77.35 KB (+0.1% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 68.66 KB (+0.1% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 62.3 KB (+0.1% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 32.67 KB (+0.17% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 31.13 KB (0%)
@sentry/browser - Webpack (gzipped) 22.48 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 75.01 KB (+0.08% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 66.65 KB (+0.12% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 32.48 KB (+0.2% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 24.19 KB (+0.03% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 209.83 KB (+0.09% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 97.89 KB (+0.18% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 72.34 KB (+0.03% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 35.49 KB (+0.14% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 69.04 KB (+0.09% 🔺)
@sentry/react - Webpack (gzipped) 22.52 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 85.66 KB (+0.06% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.81 KB (+0.15% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 17.11 KB (0%)

@Lms24 Lms24 force-pushed the lms/feat-core-deprecate-span-op branch from 840c720 to d65726c Compare January 16, 2024 12:58
@Lms24 Lms24 marked this pull request as ready for review January 16, 2024 13:48
@Lms24 Lms24 requested review from mydea and AbhiPrasad January 16, 2024 13:48
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
Copy link
Member

Choose a reason for hiding this comment

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

is this on purpose here? Just to clarify!

Copy link
Member Author

Choose a reason for hiding this comment

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

huh no, no idea how this happened, thx for catching!

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah maybe because I ran the NextJS integration tests locally.

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

very nice!

@Lms24 Lms24 force-pushed the lms/feat-core-deprecate-span-op branch 2 times, most recently from cd9f4a8 to 29c0ce5 Compare January 16, 2024 16:35
@Lms24 Lms24 force-pushed the lms/feat-core-deprecate-span-op branch 3 times, most recently from 9606c1d to bfdd5a6 Compare January 17, 2024 12:49
@Lms24 Lms24 force-pushed the lms/feat-core-deprecate-span-op branch from bfdd5a6 to 7b687f6 Compare January 17, 2024 13:00
@Lms24 Lms24 merged commit fb7e516 into develop Jan 17, 2024
96 checks passed
@Lms24 Lms24 deleted the lms/feat-core-deprecate-span-op branch January 17, 2024 13:48
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