UNPKG

6.67 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 * The release identifier used when uploading respective source maps. Specify
53 * this value to allow Sentry to resolve the correct source maps when
54 * processing events.
55 */
56 release?: string;
57 /** The current environment of your application (e.g. "production"). */
58 environment?: string;
59 /** Sets the distribution for all events */
60 dist?: string;
61 /**
62 * The maximum number of breadcrumbs sent with events. Defaults to 100.
63 * Values over 100 will be ignored and 100 used instead.
64 */
65 maxBreadcrumbs?: number;
66 /** Console logging verbosity for the SDK Client. */
67 logLevel?: LogLevel;
68 /** A global sample rate to apply to all events (0 - 1). */
69 sampleRate?: number;
70 /** Attaches stacktraces to pure capture message / log integrations */
71 attachStacktrace?: boolean;
72 /** Maxium number of chars a single value can have before it will be truncated. */
73 maxValueLength?: number;
74 /**
75 * Maximum number of levels that normalization algorithm will traverse in objects and arrays.
76 * Used when normalizing an event before sending, on all of the listed attributes:
77 * - `breadcrumbs.data`
78 * - `user`
79 * - `contexts`
80 * - `extra`
81 * Defaults to `3`. Set to `0` to disable.
82 */
83 normalizeDepth?: number;
84 /**
85 * Controls how many milliseconds to wait before shutting down. The default is
86 * SDK-specific but typically around 2 seconds. Setting this too low can cause
87 * problems for sending events from command line applications. Setting it too
88 * high can cause the application to block for users with network connectivity
89 * problems.
90 */
91 shutdownTimeout?: number;
92 /**
93 * Sample rate to determine trace sampling.
94 *
95 * 0.0 = 0% chance of a given trace being sent (send no traces) 1.0 = 100% chance of a given trace being sent (send
96 * all traces)
97 *
98 * Tracing is enabled if either this or `tracesSampler` is defined. If both are defined, `tracesSampleRate` is
99 * ignored.
100 */
101 tracesSampleRate?: number;
102 /**
103 * A flag enabling Sessions Tracking feature.
104 * By default, Sessions Tracking is enabled.
105 */
106 autoSessionTracking?: boolean;
107 /**
108 * Set data to the inital scope
109 */
110 initialScope?: CaptureContext;
111 /**
112 * Set of metadata about the SDK that can be internally used to enhance envelopes and events,
113 * and provide additional data about every request.
114 * */
115 _metadata?: SdkMetadata;
116 /**
117 * Options which are in beta, or otherwise not guaranteed to be stable.
118 */
119 _experiments?: {
120 [key: string]: any;
121 };
122 /**
123 * Function to compute tracing sample rate dynamically and filter unwanted traces.
124 *
125 * Tracing is enabled if either this or `tracesSampleRate` is defined. If both are defined, `tracesSampleRate` is
126 * ignored.
127 *
128 * Will automatically be passed a context object of default and optional custom data. See
129 * {@link Transaction.samplingContext} and {@link Hub.startTransaction}.
130 *
131 * @returns A sample rate between 0 and 1 (0 drops the trace, 1 guarantees it will be sent). Returning `true` is
132 * equivalent to returning 1 and returning `false` is equivalent to returning 0.
133 */
134 tracesSampler?(samplingContext: SamplingContext): number | boolean;
135 /**
136 * A callback invoked during event submission, allowing to optionally modify
137 * the event before it is sent to Sentry.
138 *
139 * Note that you must return a valid event from this callback. If you do not
140 * wish to modify the event, simply return it at the end.
141 * Returning null will cause the event to be dropped.
142 *
143 * @param event The error or message event generated by the SDK.
144 * @param hint May contain additional information about the original exception.
145 * @returns A new event that will be sent | null.
146 */
147 beforeSend?(event: Event, hint?: EventHint): PromiseLike<Event | null> | Event | null;
148 /**
149 * A callback invoked when adding a breadcrumb, allowing to optionally modify
150 * it before adding it to future events.
151 *
152 * Note that you must return a valid breadcrumb from this callback. If you do
153 * not wish to modify the breadcrumb, simply return it at the end.
154 * Returning null will cause the breadcrumb to be dropped.
155 *
156 * @param breadcrumb The breadcrumb as created by the SDK.
157 * @returns The breadcrumb that will be added | null.
158 */
159 beforeBreadcrumb?(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null;
160}
161//# sourceMappingURL=options.d.ts.map
\No newline at end of file