UNPKG

7.24 kBTypeScriptView Raw
1import { Breadcrumb, BreadcrumbHint } from './breadcrumb';
2import { Event, EventHint } from './event';
3import { Integration } from './integration';
4import { CaptureContext } from './scope';
5import { SdkMetadata } from './sdkmetadata';
6import { SamplingContext } from './transaction';
7import { Transport, TransportClass, TransportOptions } from './transport';
8/** Base configuration options for every SDK. */
9export interface Options {
10 /**
11 * Enable debug functionality in the SDK itself
12 */
13 debug?: boolean;
14 /**
15 * Specifies whether this SDK should send events to Sentry.
16 * Defaults to true.
17 */
18 enabled?: boolean;
19 /**
20 * The Dsn used to connect to Sentry and identify the project. If omitted, the
21 * SDK will not send any data to Sentry.
22 */
23 dsn?: string;
24 /**
25 * If this is set to false, default integrations will not be added, otherwise this will internally be set to the
26 * recommended default integrations.
27 * TODO: We should consider changing this to `boolean | Integration[]`
28 */
29 defaultIntegrations?: false | Integration[];
30 /**
31 * List of integrations that should be installed after SDK was initialized.
32 * Accepts either a list of integrations or a function that receives
33 * default integrations and returns a new, updated list.
34 */
35 integrations?: Integration[] | ((integrations: Integration[]) => Integration[]);
36 /**
37 * A pattern for error messages which should not be sent to Sentry.
38 * By default, all errors will be sent.
39 */
40 ignoreErrors?: Array<string | RegExp>;
41 /**
42 * Transport object that should be used to send events to Sentry
43 */
44 transport?: TransportClass<Transport>;
45 /**
46 * Options for the default transport that the SDK uses.
47 */
48 transportOptions?: TransportOptions;
49 /**
50 * A URL to an envelope tunnel endpoint. An envelope tunnel is an HTTP endpoint
51 * that accepts Sentry envelopes for forwarding. This can be used to force data
52 * through a custom server independent of the type of data.
53 */
54 tunnel?: string;
55 /**
56 * The release identifier used when uploading respective source maps. Specify
57 * this value to allow Sentry to resolve the correct source maps when
58 * processing events.
59 */
60 release?: string;
61 /** The current environment of your application (e.g. "production"). */
62 environment?: string;
63 /** Sets the distribution for all events */
64 dist?: string;
65 /**
66 * The maximum number of breadcrumbs sent with events. Defaults to 100.
67 * Values over 100 will be ignored and 100 used instead.
68 */
69 maxBreadcrumbs?: number;
70 /** A global sample rate to apply to all events (0 - 1). */
71 sampleRate?: number;
72 /** Attaches stacktraces to pure capture message / log integrations */
73 attachStacktrace?: boolean;
74 /** Maximum number of chars a single value can have before it will be truncated. */
75 maxValueLength?: number;
76 /**
77 * Maximum number of levels that normalization algorithm will traverse in objects and arrays.
78 * Used when normalizing an event before sending, on all of the listed attributes:
79 * - `breadcrumbs.data`
80 * - `user`
81 * - `contexts`
82 * - `extra`
83 * Defaults to `3`. Set to `0` to disable.
84 */
85 normalizeDepth?: number;
86 /**
87 * Maximum number of properties or elements that the normalization algorithm will output in any single array or object included in the normalized event.
88 * Used when normalizing an event before sending, on all of the listed attributes:
89 * - `breadcrumbs.data`
90 * - `user`
91 * - `contexts`
92 * - `extra`
93 * Defaults to `1000`
94 */
95 normalizeMaxBreadth?: number;
96 /**
97 * Controls how many milliseconds to wait before shutting down. The default is
98 * SDK-specific but typically around 2 seconds. Setting this too low can cause
99 * problems for sending events from command line applications. Setting it too
100 * high can cause the application to block for users with network connectivity
101 * problems.
102 */
103 shutdownTimeout?: number;
104 /**
105 * Sample rate to determine trace sampling.
106 *
107 * 0.0 = 0% chance of a given trace being sent (send no traces) 1.0 = 100% chance of a given trace being sent (send
108 * all traces)
109 *
110 * Tracing is enabled if either this or `tracesSampler` is defined. If both are defined, `tracesSampleRate` is
111 * ignored.
112 */
113 tracesSampleRate?: number;
114 /**
115 * A flag enabling Sessions Tracking feature.
116 * By default, Sessions Tracking is enabled.
117 */
118 autoSessionTracking?: boolean;
119 /**
120 * Send SDK Client Reports.
121 * By default, Client Reports are enabled.
122 */
123 sendClientReports?: boolean;
124 /**
125 * Initial data to populate scope.
126 */
127 initialScope?: CaptureContext;
128 /**
129 * Set of metadata about the SDK that can be internally used to enhance envelopes and events,
130 * and provide additional data about every request.
131 * */
132 _metadata?: SdkMetadata;
133 /**
134 * Options which are in beta, or otherwise not guaranteed to be stable.
135 */
136 _experiments?: {
137 [key: string]: any;
138 };
139 /**
140 * Function to compute tracing sample rate dynamically and filter unwanted traces.
141 *
142 * Tracing is enabled if either this or `tracesSampleRate` is defined. If both are defined, `tracesSampleRate` is
143 * ignored.
144 *
145 * Will automatically be passed a context object of default and optional custom data. See
146 * {@link Transaction.samplingContext} and {@link Hub.startTransaction}.
147 *
148 * @returns A sample rate between 0 and 1 (0 drops the trace, 1 guarantees it will be sent). Returning `true` is
149 * equivalent to returning 1 and returning `false` is equivalent to returning 0.
150 */
151 tracesSampler?: (samplingContext: SamplingContext) => number | boolean;
152 /**
153 * A callback invoked during event submission, allowing to optionally modify
154 * the event before it is sent to Sentry.
155 *
156 * Note that you must return a valid event from this callback. If you do not
157 * wish to modify the event, simply return it at the end.
158 * Returning null will cause the event to be dropped.
159 *
160 * @param event The error or message event generated by the SDK.
161 * @param hint May contain additional information about the original exception.
162 * @returns A new event that will be sent | null.
163 */
164 beforeSend?: (event: Event, hint?: EventHint) => PromiseLike<Event | null> | Event | null;
165 /**
166 * A callback invoked when adding a breadcrumb, allowing to optionally modify
167 * it before adding it to future events.
168 *
169 * Note that you must return a valid breadcrumb from this callback. If you do
170 * not wish to modify the breadcrumb, simply return it at the end.
171 * Returning null will cause the breadcrumb to be dropped.
172 *
173 * @param breadcrumb The breadcrumb as created by the SDK.
174 * @returns The breadcrumb that will be added | null.
175 */
176 beforeBreadcrumb?: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb | null;
177}
178//# sourceMappingURL=options.d.ts.map
\No newline at end of file