1 | import type { Breadcrumb, BreadcrumbHint } from './breadcrumb';
|
2 | import type { CheckIn, MonitorConfig } from './checkin';
|
3 | import type { EventDropReason } from './clientreport';
|
4 | import type { DataCategory } from './datacategory';
|
5 | import type { DsnComponents } from './dsn';
|
6 | import type { DynamicSamplingContext, Envelope } from './envelope';
|
7 | import type { Event, EventHint } from './event';
|
8 | import type { EventProcessor } from './eventprocessor';
|
9 | import type { FeedbackEvent } from './feedback';
|
10 | import type { Integration, IntegrationClass } from './integration';
|
11 | import type { MetricBucketItem } from './metrics';
|
12 | import type { ClientOptions } from './options';
|
13 | import type { ParameterizedString } from './parameterize';
|
14 | import type { Scope } from './scope';
|
15 | import type { SdkMetadata } from './sdkmetadata';
|
16 | import type { Session, SessionAggregates } from './session';
|
17 | import type { Severity, SeverityLevel } from './severity';
|
18 | import type { StartSpanOptions } from './startSpanOptions';
|
19 | import type { Transaction } from './transaction';
|
20 | import type { Transport, TransportMakeRequestResponse } from './transport';
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export interface Client<O extends ClientOptions = ClientOptions> {
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | captureException(exception: any, hint?: EventHint, scope?: Scope): string | undefined;
|
40 | |
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | captureMessage(message: string, level?: Severity | SeverityLevel, hint?: EventHint, scope?: Scope): string | undefined;
|
50 | |
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | captureEvent(event: Event, hint?: EventHint, scope?: Scope): string | undefined;
|
59 | |
60 |
|
61 |
|
62 |
|
63 |
|
64 | captureSession?(session: Session): void;
|
65 | |
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | captureCheckIn?(checkIn: CheckIn, monitorConfig?: MonitorConfig, scope?: Scope): string;
|
75 |
|
76 | getDsn(): DsnComponents | undefined;
|
77 |
|
78 | getOptions(): O;
|
79 | |
80 |
|
81 |
|
82 |
|
83 |
|
84 | getSdkMetadata?(): SdkMetadata | undefined;
|
85 | |
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 | getTransport(): Transport | undefined;
|
92 | |
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | close(timeout?: number): PromiseLike<boolean>;
|
101 | |
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | flush(timeout?: number): PromiseLike<boolean>;
|
110 | |
111 |
|
112 |
|
113 |
|
114 |
|
115 | addEventProcessor?(eventProcessor: EventProcessor): void;
|
116 | |
117 |
|
118 |
|
119 |
|
120 |
|
121 | getEventProcessors?(): EventProcessor[];
|
122 | |
123 |
|
124 |
|
125 |
|
126 | getIntegration<T extends Integration>(integration: IntegrationClass<T>): T | null;
|
127 |
|
128 | getIntegrationByName?<T extends Integration = Integration>(name: string): T | undefined;
|
129 | |
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 | addIntegration?(integration: Integration): void;
|
138 | |
139 |
|
140 |
|
141 |
|
142 | setupIntegrations(forceInitialize?: boolean): void;
|
143 | |
144 |
|
145 |
|
146 |
|
147 | init?(): void;
|
148 |
|
149 | eventFromException(exception: any, hint?: EventHint): PromiseLike<Event>;
|
150 |
|
151 | eventFromMessage(message: ParameterizedString, level?: Severity | SeverityLevel, hint?: EventHint): PromiseLike<Event>;
|
152 |
|
153 | sendEvent(event: Event, hint?: EventHint): void;
|
154 |
|
155 | sendSession(session: Session | SessionAggregates): void;
|
156 | |
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | recordDroppedEvent(reason: EventDropReason, dataCategory: DataCategory, event?: Event): void;
|
164 | |
165 |
|
166 |
|
167 |
|
168 |
|
169 | captureAggregateMetrics?(metricBucketItems: Array<MetricBucketItem>): void;
|
170 | |
171 |
|
172 |
|
173 |
|
174 | on?(hook: 'startTransaction', callback: (transaction: Transaction) => void): void;
|
175 | /**
|
176 | * Register a callback for transaction finish.
|
177 | * Receives the transaction as argument.
|
178 | */
|
179 | on?(hook: 'finishTransaction', callback: (transaction: Transaction) => void): void;
|
180 | /**
|
181 | * Register a callback for transaction start and finish.
|
182 | */
|
183 | on?(hook: 'beforeEnvelope', callback: (envelope: Envelope) => void): void;
|
184 | /**
|
185 | * Register a callback for before sending an event.
|
186 | * This is called right before an event is sent and should not be used to mutate the event.
|
187 | * Receives an Event & EventHint as arguments.
|
188 | */
|
189 | on?(hook: 'beforeSendEvent', callback: (event: Event, hint?: EventHint | undefined) => void): void;
|
190 | /**
|
191 | * Register a callback for preprocessing an event,
|
192 | * before it is passed to (global) event processors.
|
193 | * Receives an Event & EventHint as arguments.
|
194 | */
|
195 | on?(hook: 'preprocessEvent', callback: (event: Event, hint?: EventHint | undefined) => void): void;
|
196 | /**
|
197 | * Register a callback for when an event has been sent.
|
198 | */
|
199 | on?(hook: 'afterSendEvent', callback: (event: Event, sendResponse: TransportMakeRequestResponse | void) => void): void;
|
200 | /**
|
201 | * Register a callback before a breadcrumb is added.
|
202 | */
|
203 | on?(hook: 'beforeAddBreadcrumb', callback: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => void): void;
|
204 | /**
|
205 | * Register a callback when a DSC (Dynamic Sampling Context) is created.
|
206 | */
|
207 | on?(hook: 'createDsc', callback: (dsc: DynamicSamplingContext) => void): void;
|
208 | /**
|
209 | * Register a callback when an OpenTelemetry span is ended (in @sentry/opentelemetry-node).
|
210 | * The option argument may be mutated to drop the span.
|
211 | */
|
212 | on?(hook: 'otelSpanEnd', callback: (otelSpan: unknown, mutableOptions: {
|
213 | drop: boolean;
|
214 | }) => void): void;
|
215 | /**
|
216 | * Register a callback when a Feedback event has been prepared.
|
217 | * This should be used to mutate the event. The options argument can hint
|
218 | * about what kind of mutation it expects.
|
219 | */
|
220 | on?(hook: 'beforeSendFeedback', callback: (feedback: FeedbackEvent, options?: {
|
221 | includeReplay?: boolean;
|
222 | }) => void): void;
|
223 | /**
|
224 | * A hook for BrowserTracing to trigger a span start for a page load.
|
225 | */
|
226 | on?(hook: 'startPageLoadSpan', callback: (options: StartSpanOptions) => void): void;
|
227 | /**
|
228 | * A hook for BrowserTracing to trigger a span for a navigation.
|
229 | */
|
230 | on?(hook: 'startNavigationSpan', callback: (options: StartSpanOptions) => void): void;
|
231 | /**
|
232 | * Fire a hook event for transaction start.
|
233 | * Expects to be given a transaction as the second argument.
|
234 | */
|
235 | emit?(hook: 'startTransaction', transaction: Transaction): void;
|
236 | /**
|
237 | * Fire a hook event for transaction finish.
|
238 | * Expects to be given a transaction as the second argument.
|
239 | */
|
240 | emit?(hook: 'finishTransaction', transaction: Transaction): void;
|
241 | emit?(hook: 'beforeEnvelope', envelope: Envelope): void;
|
242 | /**
|
243 | * Fire a hook event before sending an event.
|
244 | * This is called right before an event is sent and should not be used to mutate the event.
|
245 | * Expects to be given an Event & EventHint as the second/third argument.
|
246 | */
|
247 | emit?(hook: 'beforeSendEvent', event: Event, hint?: EventHint): void;
|
248 | /**
|
249 | * Fire a hook event to process events before they are passed to (global) event processors.
|
250 | * Expects to be given an Event & EventHint as the second/third argument.
|
251 | */
|
252 | emit?(hook: 'preprocessEvent', event: Event, hint?: EventHint): void;
|
253 | emit?(hook: 'afterSendEvent', event: Event, sendResponse: TransportMakeRequestResponse | void): void;
|
254 | /**
|
255 | * Fire a hook for when a breadcrumb is added. Expects the breadcrumb as second argument.
|
256 | */
|
257 | emit?(hook: 'beforeAddBreadcrumb', breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void;
|
258 | /**
|
259 | * Fire a hook for when a DSC (Dynamic Sampling Context) is created. Expects the DSC as second argument.
|
260 | */
|
261 | emit?(hook: 'createDsc', dsc: DynamicSamplingContext): void;
|
262 | /**
|
263 | * Fire a hook for when an OpenTelemetry span is ended (in @sentry/opentelemetry-node).
|
264 | * Expects the OTEL span & as second argument, and an option object as third argument.
|
265 | * The option argument may be mutated to drop the span.
|
266 | */
|
267 | emit?(hook: 'otelSpanEnd', otelSpan: unknown, mutableOptions: {
|
268 | drop: boolean;
|
269 | }): void;
|
270 | /**
|
271 | * Fire a hook event for after preparing a feedback event. Events to be given
|
272 | * a feedback event as the second argument, and an optional options object as
|
273 | * third argument.
|
274 | */
|
275 | emit?(hook: 'beforeSendFeedback', feedback: FeedbackEvent, options?: {
|
276 | includeReplay?: boolean;
|
277 | }): void;
|
278 | /**
|
279 | * Emit a hook event for BrowserTracing to trigger a span start for a page load.
|
280 | */
|
281 | emit?(hook: 'startPageLoadSpan', options: StartSpanOptions): void;
|
282 | /**
|
283 | * Emit a hook event for BrowserTracing to trigger a span for a navigation.
|
284 | */
|
285 | emit?(hook: 'startNavigationSpan', options: StartSpanOptions): void;
|
286 | }
|
287 | //# sourceMappingURL=client.d.ts.map |
\ | No newline at end of file |