UNPKG

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