Skip to content

Commit 573fe73

Browse files
committed
move tracesSampleRate and tracesSampler to be closer in the Options typedef
1 parent 64fde64 commit 573fe73

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

packages/types/src/options.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,6 @@ export interface Options {
7979
/** A global sample rate to apply to all events (0 - 1). */
8080
sampleRate?: number;
8181

82-
/**
83-
* Sample rate to determine trace sampling.
84-
*
85-
* 0.0 = 0% chance of a given trace being sent (send no traces)
86-
* 1.0 = 100% chance of a given trace being sent (send all traces)
87-
*
88-
* Can be omitted without disabling tracing if `tracesSampler` is defined. If neither is defined, tracing is disabled.
89-
*/
90-
tracesSampleRate?: number;
91-
9282
/** Attaches stacktraces to pure capture message / log integrations */
9383
attachStacktrace?: boolean;
9484

@@ -119,6 +109,29 @@ export interface Options {
119109
[key: string]: any;
120110
};
121111

112+
/**
113+
* Sample rate to determine trace sampling.
114+
*
115+
* 0.0 = 0% chance of a given trace being sent (send no traces) 1.0 = 100% chance of a given trace being sent (send
116+
* all traces)
117+
*
118+
* Tracing is enabled if either this or `tracesSampler` is defined. If both are defined, `tracesSampleRate` is
119+
* ignored.
120+
*/
121+
tracesSampleRate?: number;
122+
123+
/**
124+
* Function to compute tracing sample rate dynamically and filter unwanted traces.
125+
*
126+
* Tracing is enabled if either this or `tracesSampleRate` is defined. If both are defined, `tracesSampleRate` is
127+
* ignored.
128+
*
129+
* Will automatically be passed a context object of default and optional custom data. See {@link Hub.startTransaction}.
130+
*
131+
* @returns A sample rate between 0 and 1 (0 drops the trace, 1 guarantees it will be sent).
132+
*/
133+
tracesSampler?(sampleContext: SampleContext): number;
134+
122135
/**
123136
* A callback invoked during event submission, allowing to optionally modify
124137
* the event before it is sent to Sentry.
@@ -145,17 +158,4 @@ export interface Options {
145158
* @returns The breadcrumb that will be added | null.
146159
*/
147160
beforeBreadcrumb?(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null;
148-
149-
/**
150-
* Function to compute tracing sample rate dynamically and filter unwanted traces.
151-
*
152-
* Can be defined in place of `tracesSampleRate`. If neither is defined, tracing is disabled.
153-
*
154-
* `startTransaction` or `startIdleTransaction` accept a `sampleContext` argument, which is then passed to this
155-
* function, meant to provide information on which to make a sampling decision. Additional information may be included
156-
* automatically, depending on the SDK and any included integrations.
157-
*
158-
* @returns A sample rate between 0 and 1 (0 drops the trace, 1 guarantees it will be sent).
159-
*/
160-
tracesSampler?(sampleContext: SampleContext): number;
161161
}

0 commit comments

Comments
 (0)