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

types(node): add profilesSampleRate #6318

Merged
merged 3 commits into from
Nov 30, 2022
Merged

Conversation

JonasBa
Copy link
Member

@JonasBa JonasBa commented Nov 28, 2022

Adds profilesSampleRate to the Node SDK init options.

Adding this because we got 3 emails last week about the typescript error by our customers and asking them to @ts-expect-error is not really acceptable.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.53 KB (-0.01% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 60.42 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.21 KB (+0.03% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 53.76 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 19.94 KB (0%)
@sentry/browser - Webpack (minified) 65.25 KB (0%)
@sentry/react - Webpack (gzipped + minified) 19.96 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.96 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.41 KB (0%)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.83 KB (+0.02% 🔺)
@sentry/replay index.js 62.13 KB (-2.03% 🔽)
@sentry/replay - Webpack (gzipped + minified) 62.13 KB (-2.03% 🔽)
@sentry/replay - Webpack (minified) 200.15 KB (-2.31% 🔽)

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.

So full disclosure, I haven't had a look at how profiling works under the hood but given that users have to add the ProfilingIntegration in their init options, wouldn't it make more sense to pass the profilesSampleRate as an option in the constructor of the integration? WDYT?

Replay is doing it this way at the moment: Replay Setup

@AbhiPrasad
Copy link
Member

So I elected for initially going with #6310, but I think it makes sense to keep it node only for now and do it in the browser later.

A top level option for profiling matches tracing, and the other SDKs at the moment, so I would prefer that so that JavaScript is not the only SDK that works this way.

@JonasBa can we add a doc string for this? We also need to update https://docs.sentry.io/platforms/node/configuration/options/

@Lms24
Copy link
Member

Lms24 commented Nov 29, 2022

A top level option for profiling matches tracing, and the other SDKs at the moment, so I would prefer that so that JavaScript is not the only SDK that works this way.

I didn't know this, so yes, in that case it makes sense to keep it as a top level option in the Node SDK.

@@ -56,4 +56,6 @@ export interface NodeOptions extends Options<NodeTransportOptions>, BaseNodeOpti
* Configuration options for the Sentry Node SDK Client class
* @see NodeClient for more information.
*/
export interface NodeClientOptions extends ClientOptions<NodeTransportOptions>, BaseNodeOptions {}
export interface NodeClientOptions extends ClientOptions<NodeTransportOptions>, BaseNodeOptions {
profilesSampleRate?: number;
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a JSDoc here, explaining what this option does?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, I added it

@AbhiPrasad AbhiPrasad merged commit d710b2c into master Nov 30, 2022
@AbhiPrasad AbhiPrasad deleted the jb/types/profiles-sample-rate branch November 30, 2022 10:58
@tomgrossman
Copy link

Hey @JonasBa @Lms24 @AbhiPrasad
Why did you add it only to NodeClientOptions and not to NodeOptions? Sentry.init is using NodeOptions and it still throws TS errors... Am I missing something?

@AbhiPrasad
Copy link
Member

Hey @tomgrossman, thanks for writing in! We will fix this!

@AbhiPrasad
Copy link
Member

This is addressed by #6409, will be part of the next release.

@JonasBa
Copy link
Member Author

JonasBa commented Dec 5, 2022

@tomgrossman oversight on my part - I should have double checked the type name 😞

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