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): Add spanGetMetadata() & spanSetMetadata() APIs #10041

Closed
wants to merge 2 commits into from

Conversation

mydea
Copy link
Member

@mydea mydea commented Jan 3, 2024

To replace transaction.setMetadata().

I decided to make the metadata shapeless, so you can theoretically store anything there - but are also required to guard when reading this. Other than this, it feels a bit weird to store the transaction-related data we need right now there... 🤔

@mydea mydea self-assigned this Jan 3, 2024
Copy link
Contributor

github-actions bot commented Jan 3, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 76.19 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 67.56 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 61.19 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 32.17 KB (+0.13% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 30.5 KB (+0.03% 🔺)
@sentry/browser - Webpack (gzipped) 22.21 KB (+0.03% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 73.63 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 65.27 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 31.46 KB (+0.13% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 23.36 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 204.54 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 94.43 KB (+0.07% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 69.23 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 34.43 KB (+0.13% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 67.96 KB (+0.05% 🔺)
@sentry/react - Webpack (gzipped) 22.24 KB (+0.03% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 84.63 KB (+0.04% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.23 KB (+0.08% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 16.73 KB (+0.02% 🔺)

@mydea mydea force-pushed the fn/span-metadata branch 3 times, most recently from ae86c48 to 4f1bd80 Compare January 4, 2024 10:39
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

2 questions:

@mydea
Copy link
Member Author

mydea commented Jan 5, 2024

2 questions:

Re: naming: No strong opinions 🤔 My thought was to make auto-complete a bit easier by typing span... and seeing what exists, but no strong feelings about getSpanMetadata() either 🤷

Re: your second point: I think not, as the metadata is not part of the span serialization. IMHO it's ok to have this separate, as it's basically a way to store arbitrary data that needs to be attached to a span for us internally during serialization only 🤔

@Lms24
Copy link
Member

Lms24 commented Jan 8, 2024

Re: naming: No strong opinions 🤔 My thought was to make auto-complete a bit easier by typing span... and seeing what exists, but no strong feelings about getSpanMetadata() either 🤷

I just think we should be consistent and names should make sense after we move away from v7 and forget that this function was a replacement for a span method. If we already have span<Action> naming conventions, we can also leave it as is for consistency.

Re: your second point: I think not, as the metadata is not part of the span serialization. IMHO it's ok to have this separate, as it's basically a way to store arbitrary data that needs to be attached to a span for us internally during serialization only 🤔

Ah good point, didn't think about this.

@mydea mydea closed this Jan 8, 2024
mydea added a commit that referenced this pull request Jan 9, 2024
…0097)

This deprecates any usage of `metadata` on transactions.

The main usages we have are to set `sampleRate` and `source` in there.
These I replaced with semantic attributes. For backwards compatibility,
when creating the transaction event we still check the metadata there as
well.

Other usage of metadata (mostly around `request`) remains intact for
now, we need to replace this in v8 - e.g. put this on the isolation
scope, probably.

This is the first usage of [Semantic
Attributes](https://github.com/getsentry/rfcs/blob/main/text/0116-sentry-semantic-conventions.md)
in the SDK!

This replaces #10041
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