Skip to content

ref(tracing): Make metadata property on Transaction class public #3557

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

Merged
merged 3 commits into from
May 20, 2021

Conversation

lobsterkatie
Copy link
Member

Pulling this in from https://github.com/getsentry/sentry-javascript/tree/kmclb-dynamic-sampling-data-in-envelopes. It makes the metadata property on the Transaction class public, and allows it to be passed in at transaction creation time, which at this moment would be helpful for nextjs tracing work.

@lobsterkatie lobsterkatie requested a review from kamilogorek as a code owner May 18, 2021 02:36
@github-actions
Copy link
Contributor

github-actions bot commented May 18, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 20.76 KB (-0.01% 🔽)
@sentry/browser - Webpack 21.98 KB (0%)
@sentry/react - Webpack 22.01 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.16 KB (+0.02% 🔺)

/** JSDoc */
export class Transaction extends SpanClass implements TransactionInterface {
public name: string;

private _metadata: TransactionMetadata = {};
public metadata: TransactionMetadata;
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to the previous comment. If we already have a setter, do we want to make it public? IMO it seems unnecessary and misleading. I'd either go with the getter/setter or the public attribute.

Copy link
Contributor

Choose a reason for hiding this comment

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

The setter above as you mentioned "merges", so it's helpful method. But I do agree that we could skip it if we'd go with get/set only, and not merge.

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 feels way simpler to me to just have it public. Honestly, IDK why I made it private to begin with.

One thing we might think about (in the long list of things we're thinking about for v7) is having a more coherent strategy for what's public and what's private with setters and getters. I don't feel like I have a great intuitive sense for which is better in cases like this.

@lobsterkatie lobsterkatie force-pushed the kmclb-make-transaction-metadata-public branch from 06054b0 to d7fb1fd Compare May 18, 2021 13:26
@lobsterkatie lobsterkatie force-pushed the kmclb-make-transaction-metadata-public branch from d7fb1fd to bf75a3d Compare May 20, 2021 01:30
@lobsterkatie lobsterkatie merged commit 9af1886 into master May 20, 2021
@lobsterkatie lobsterkatie deleted the kmclb-make-transaction-metadata-public branch May 20, 2021 01:55
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.

4 participants