From 3d1af3f5036bd3e835b3f9dd76aa08a46123df94 Mon Sep 17 00:00:00 2001 From: JonasBa Date: Wed, 8 Mar 2023 11:02:29 -0500 Subject: [PATCH] feat(types): add profilesSampler option to node client type --- packages/node/src/types.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/node/src/types.ts b/packages/node/src/types.ts index 4d384bc54cf3..dd4713e97952 100644 --- a/packages/node/src/types.ts +++ b/packages/node/src/types.ts @@ -1,4 +1,4 @@ -import type { ClientOptions, Options, TracePropagationTargets } from '@sentry/types'; +import type { ClientOptions, Options, SamplingContext, TracePropagationTargets } from '@sentry/types'; import type { NodeTransportOptions } from './transports'; @@ -8,6 +8,20 @@ export interface BaseNodeOptions { */ profilesSampleRate?: number; + /** + * Function to compute profiling sample rate dynamically and filter unwanted profiles. + * + * Profiling is enabled if either this or `profilesSampleRate` is defined. If both are defined, `profilesSampleRate` is + * ignored. + * + * Will automatically be passed a context object of default and optional custom data. See + * {@link Transaction.samplingContext} and {@link Hub.startTransaction}. + * + * @returns A sample rate between 0 and 1 (0 drops the profile, 1 guarantees it will be sent). Returning `true` is + * equivalent to returning 1 and returning `false` is equivalent to returning 0. + */ + profilesSampler?: (samplingContext: SamplingContext) => number | boolean; + /** Sets an optional server name (device name) */ serverName?: string;