1 | import type { Breadcrumb, BreadcrumbHint } from './breadcrumb';
|
2 | import type { ErrorEvent, Event, EventHint, TransactionEvent } from './event';
|
3 | import type { Instrumenter } from './instrumenter';
|
4 | import type { Integration } from './integration';
|
5 | import type { CaptureContext } from './scope';
|
6 | import type { SdkMetadata } from './sdkmetadata';
|
7 | import type { StackLineParser, StackParser } from './stacktrace';
|
8 | import type { SamplingContext } from './transaction';
|
9 | import type { BaseTransportOptions, Transport } from './transport';
|
10 | export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOptions> {
|
11 | /**
|
12 | * Enable debug functionality in the SDK itself
|
13 | */
|
14 | debug?: boolean;
|
15 | /**
|
16 | * Specifies whether this SDK should send events to Sentry.
|
17 | * Defaults to true.
|
18 | */
|
19 | enabled?: boolean;
|
20 | /** Attaches stacktraces to pure capture message / log integrations */
|
21 | attachStacktrace?: boolean;
|
22 | /**
|
23 | * A flag enabling Sessions Tracking feature.
|
24 | * By default, Sessions Tracking is enabled.
|
25 | */
|
26 | autoSessionTracking?: boolean;
|
27 | /**
|
28 | * Send SDK Client Reports.
|
29 | * By default, Client Reports are enabled.
|
30 | */
|
31 | sendClientReports?: boolean;
|
32 | /**
|
33 | * The Dsn used to connect to Sentry and identify the project. If omitted, the
|
34 | * SDK will not send any data to Sentry.
|
35 | */
|
36 | dsn?: string;
|
37 | /**
|
38 | * The release identifier used when uploading respective source maps. Specify
|
39 | * this value to allow Sentry to resolve the correct source maps when
|
40 | * processing events.
|
41 | */
|
42 | release?: string;
|
43 | /** The current environment of your application (e.g. "production"). */
|
44 | environment?: string;
|
45 | /** Sets the distribution for all events */
|
46 | dist?: string;
|
47 | /**
|
48 | * List of integrations that should be installed after SDK was initialized.
|
49 | */
|
50 | integrations: Integration[];
|
51 | /**
|
52 | * The instrumenter to use. Defaults to `sentry`.
|
53 | * When not set to `sentry`, auto-instrumentation inside of Sentry will be disabled,
|
54 | * in favor of using external auto instrumentation.
|
55 | *
|
56 | * NOTE: Any option except for `sentry` is highly experimental and subject to change!
|
57 | */
|
58 | instrumenter?: Instrumenter;
|
59 | /**
|
60 | * A function that takes transport options and returns the Transport object which is used to send events to Sentry.
|
61 | * The function is invoked internally when the client is initialized.
|
62 | */
|
63 | transport: (transportOptions: TO) => Transport;
|
64 | /**
|
65 | * A stack parser implementation
|
66 | * By default, a stack parser is supplied for all supported platforms
|
67 | */
|
68 | stackParser: StackParser;
|
69 | /**
|
70 | * Options for the default transport that the SDK uses.
|
71 | */
|
72 | transportOptions?: Partial<TO>;
|
73 | /**
|
74 | * Sample rate to determine trace sampling.
|
75 | *
|
76 | * 0.0 = 0% chance of a given trace being sent (send no traces) 1.0 = 100% chance of a given trace being sent (send
|
77 | * all traces)
|
78 | *
|
79 | * Tracing is enabled if either this or `tracesSampler` is defined. If both are defined, `tracesSampleRate` is
|
80 | * ignored.
|
81 | */
|
82 | tracesSampleRate?: number;
|
83 | /**
|
84 | * If this is enabled, transactions and trace data will be generated and captured.
|
85 | * This will set the `tracesSampleRate` to the recommended default of `1.0` if `tracesSampleRate` is undefined.
|
86 | * Note that `tracesSampleRate` and `tracesSampler` take precedence over this option.
|
87 | */
|
88 | enableTracing?: boolean;
|
89 | /**
|
90 | * Initial data to populate scope.
|
91 | */
|
92 | initialScope?: CaptureContext;
|
93 | /**
|
94 | * The maximum number of breadcrumbs sent with events. Defaults to 100.
|
95 | * Sentry has a maximum payload size of 1MB and any events exceeding that payload size will be dropped.
|
96 | */
|
97 | maxBreadcrumbs?: number;
|
98 | /**
|
99 | * A global sample rate to apply to all events.
|
100 | *
|
101 | * 0.0 = 0% chance of a given event being sent (send no events) 1.0 = 100% chance of a given event being sent (send
|
102 | * all events)
|
103 | */
|
104 | sampleRate?: number;
|
105 | /** Maximum number of chars a single value can have before it will be truncated. */
|
106 | maxValueLength?: number;
|
107 | /**
|
108 | * Maximum number of levels that normalization algorithm will traverse in objects and arrays.
|
109 | * Used when normalizing an event before sending, on all of the listed attributes:
|
110 | * - `breadcrumbs.data`
|
111 | * - `user`
|
112 | * - `contexts`
|
113 | * - `extra`
|
114 | * Defaults to `3`. Set to `0` to disable.
|
115 | */
|
116 | normalizeDepth?: number;
|
117 | /**
|
118 | * Maximum number of properties or elements that the normalization algorithm will output in any single array or object included in the normalized event.
|
119 | * Used when normalizing an event before sending, on all of the listed attributes:
|
120 | * - `breadcrumbs.data`
|
121 | * - `user`
|
122 | * - `contexts`
|
123 | * - `extra`
|
124 | * Defaults to `1000`
|
125 | */
|
126 | normalizeMaxBreadth?: number;
|
127 | /**
|
128 | * Controls how many milliseconds to wait before shutting down. The default is
|
129 | * SDK-specific but typically around 2 seconds. Setting this too low can cause
|
130 | * problems for sending events from command line applications. Setting it too
|
131 | * high can cause the application to block for users with network connectivity
|
132 | * problems.
|
133 | */
|
134 | shutdownTimeout?: number;
|
135 | /**
|
136 | * A pattern for error messages which should not be sent to Sentry.
|
137 | * By default, all errors will be sent.
|
138 | */
|
139 | ignoreErrors?: Array<string | RegExp>;
|
140 | /**
|
141 | * A pattern for transaction names which should not be sent to Sentry.
|
142 | * By default, all transactions will be sent.
|
143 | */
|
144 | ignoreTransactions?: Array<string | RegExp>;
|
145 | /**
|
146 | * A URL to an envelope tunnel endpoint. An envelope tunnel is an HTTP endpoint
|
147 | * that accepts Sentry envelopes for forwarding. This can be used to force data
|
148 | * through a custom server independent of the type of data.
|
149 | */
|
150 | tunnel?: string;
|
151 | /**
|
152 | * Controls if potentially sensitive data should be sent to Sentry by default.
|
153 | * Note that this only applies to data that the SDK is sending by default
|
154 | * but not data that was explicitly set (e.g. by calling `Sentry.setUser()`).
|
155 | *
|
156 | * Defaults to `false`.
|
157 | *
|
158 | * NOTE: This option currently controls only a few data points in a selected
|
159 | * set of SDKs. The goal for this option is to eventually control all sensitive
|
160 | * data the SDK sets by default. However, this would be a breaking change so
|
161 | * until the next major update this option only controls data points which were
|
162 | * added in versions above `7.9.0`.
|
163 | */
|
164 | sendDefaultPii?: boolean;
|
165 | /**
|
166 | * Set of metadata about the SDK that can be internally used to enhance envelopes and events,
|
167 | * and provide additional data about every request.
|
168 | */
|
169 | _metadata?: SdkMetadata;
|
170 | /**
|
171 | * Options which are in beta, or otherwise not guaranteed to be stable.
|
172 | */
|
173 | _experiments?: {
|
174 | [key: string]: any;
|
175 | };
|
176 | /**
|
177 | * A pattern for error URLs which should exclusively be sent to Sentry.
|
178 | * This is the opposite of {@link Options.denyUrls}.
|
179 | * By default, all errors will be sent.
|
180 | *
|
181 | * Requires the use of the `InboundFilters` integration.
|
182 | */
|
183 | allowUrls?: Array<string | RegExp>;
|
184 | /**
|
185 | * A pattern for error URLs which should not be sent to Sentry.
|
186 | * To allow certain errors instead, use {@link Options.allowUrls}.
|
187 | * By default, all errors will be sent.
|
188 | *
|
189 | * Requires the use of the `InboundFilters` integration.
|
190 | */
|
191 | denyUrls?: Array<string | RegExp>;
|
192 | /**
|
193 | * Function to compute tracing sample rate dynamically and filter unwanted traces.
|
194 | *
|
195 | * Tracing is enabled if either this or `tracesSampleRate` is defined. If both are defined, `tracesSampleRate` is
|
196 | * ignored.
|
197 | *
|
198 | * Will automatically be passed a context object of default and optional custom data. See
|
199 | * {@link Transaction.samplingContext} and {@link Hub.startTransaction}.
|
200 | *
|
201 | * @returns A sample rate between 0 and 1 (0 drops the trace, 1 guarantees it will be sent). Returning `true` is
|
202 | * equivalent to returning 1 and returning `false` is equivalent to returning 0.
|
203 | */
|
204 | tracesSampler?: (samplingContext: SamplingContext) => number | boolean;
|
205 | /**
|
206 | * An event-processing callback for error and message events, guaranteed to be invoked after all other event
|
207 | * processors, which allows an event to be modified or dropped.
|
208 | *
|
209 | * Note that you must return a valid event from this callback. If you do not wish to modify the event, simply return
|
210 | * it at the end. Returning `null` will cause the event to be dropped.
|
211 | *
|
212 | * @param event The error or message event generated by the SDK.
|
213 | * @param hint Event metadata useful for processing.
|
214 | * @returns A new event that will be sent | null.
|
215 | */
|
216 | beforeSend?: (event: ErrorEvent, hint: EventHint) => PromiseLike<Event | null> | Event | null;
|
217 | /**
|
218 | * An event-processing callback for transaction events, guaranteed to be invoked after all other event
|
219 | * processors. This allows an event to be modified or dropped before it's sent.
|
220 | *
|
221 | * Note that you must return a valid event from this callback. If you do not wish to modify the event, simply return
|
222 | * it at the end. Returning `null` will cause the event to be dropped.
|
223 | *
|
224 | * @param event The error or message event generated by the SDK.
|
225 | * @param hint Event metadata useful for processing.
|
226 | * @returns A new event that will be sent | null.
|
227 | */
|
228 | beforeSendTransaction?: (event: TransactionEvent, hint: EventHint) => PromiseLike<Event | null> | Event | null;
|
229 | /**
|
230 | * A callback invoked when adding a breadcrumb, allowing to optionally modify
|
231 | * it before adding it to future events.
|
232 | *
|
233 | * Note that you must return a valid breadcrumb from this callback. If you do
|
234 | * not wish to modify the breadcrumb, simply return it at the end.
|
235 | * Returning null will cause the breadcrumb to be dropped.
|
236 | *
|
237 | * @param breadcrumb The breadcrumb as created by the SDK.
|
238 | * @returns The breadcrumb that will be added | null.
|
239 | */
|
240 | beforeBreadcrumb?: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb | null;
|
241 | }
|
242 | /** Base configuration options for every SDK. */
|
243 | export interface Options<TO extends BaseTransportOptions = BaseTransportOptions> extends Omit<Partial<ClientOptions<TO>>, 'integrations' | 'transport' | 'stackParser'> {
|
244 | /**
|
245 | * If this is set to false, default integrations will not be added, otherwise this will internally be set to the
|
246 | * recommended default integrations.
|
247 | */
|
248 | defaultIntegrations?: false | Integration[];
|
249 | /**
|
250 | * List of integrations that should be installed after SDK was initialized.
|
251 | * Accepts either a list of integrations or a function that receives
|
252 | * default integrations and returns a new, updated list.
|
253 | */
|
254 | integrations?: Integration[] | ((integrations: Integration[]) => Integration[]);
|
255 | /**
|
256 | * A function that takes transport options and returns the Transport object which is used to send events to Sentry.
|
257 | * The function is invoked internally during SDK initialization.
|
258 | * By default, the SDK initializes its default transports.
|
259 | */
|
260 | transport?: (transportOptions: TO) => Transport;
|
261 | /**
|
262 | * A stack parser implementation or an array of stack line parsers
|
263 | * By default, a stack parser is supplied for all supported browsers
|
264 | */
|
265 | stackParser?: StackParser | StackLineParser[];
|
266 | }
|
267 | //# sourceMappingURL=options.d.ts.map |
\ | No newline at end of file |