1 | import type { Breadcrumb, CaptureContext, CheckIn, Client, CustomSamplingContext, Event, EventHint, Extra, Extras, MonitorConfig, Primitive, Severity, SeverityLevel, TransactionContext, User } from '@sentry/types';
|
2 | import type { Hub } from './hub';
|
3 | import type { Scope } from './scope';
|
4 | import type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';
|
5 | /**
|
6 | * Captures an exception event and sends it to Sentry.
|
7 | * This accepts an event hint as optional second parameter.
|
8 | * Alternatively, you can also pass a CaptureContext directly as second parameter.
|
9 | */
|
10 | export declare function captureException(exception: any, hint?: ExclusiveEventHintOrCaptureContext): ReturnType<Hub['captureException']>;
|
11 | /**
|
12 | * Captures a message event and sends it to Sentry.
|
13 | *
|
14 | * @param message The message to send to Sentry.
|
15 | * @param Severity Define the level of the message.
|
16 | * @returns The generated eventId.
|
17 | */
|
18 | export declare function captureMessage(message: string, captureContext?: CaptureContext | Severity | SeverityLevel): ReturnType<Hub['captureMessage']>;
|
19 | /**
|
20 | * Captures a manually created event and sends it to Sentry.
|
21 | *
|
22 | * @param event The event to send to Sentry.
|
23 | * @returns The generated eventId.
|
24 | */
|
25 | export declare function captureEvent(event: Event, hint?: EventHint): ReturnType<Hub['captureEvent']>;
|
26 | /**
|
27 | * Callback to set context information onto the scope.
|
28 | * @param callback Callback function that receives Scope.
|
29 | */
|
30 | export declare function configureScope(callback: (scope: Scope) => void): ReturnType<Hub['configureScope']>;
|
31 | /**
|
32 | * Records a new breadcrumb which will be attached to future events.
|
33 | *
|
34 | * Breadcrumbs will be added to subsequent events to provide more context on
|
35 | * user's actions prior to an error or crash.
|
36 | *
|
37 | * @param breadcrumb The breadcrumb to record.
|
38 | */
|
39 | export declare function addBreadcrumb(breadcrumb: Breadcrumb): ReturnType<Hub['addBreadcrumb']>;
|
40 | /**
|
41 | * Sets context data with the given name.
|
42 | * @param name of the context
|
43 | * @param context Any kind of data. This data will be normalized.
|
44 | */
|
45 | export declare function setContext(name: string, context: {
|
46 | [key: string]: any;
|
47 | } | null): ReturnType<Hub['setContext']>;
|
48 | /**
|
49 | * Set an object that will be merged sent as extra data with the event.
|
50 | * @param extras Extras object to merge into current context.
|
51 | */
|
52 | export declare function setExtras(extras: Extras): ReturnType<Hub['setExtras']>;
|
53 | /**
|
54 | * Set key:value that will be sent as extra data with the event.
|
55 | * @param key String of extra
|
56 | * @param extra Any kind of data. This data will be normalized.
|
57 | */
|
58 | export declare function setExtra(key: string, extra: Extra): ReturnType<Hub['setExtra']>;
|
59 | /**
|
60 | * Set an object that will be merged sent as tags data with the event.
|
61 | * @param tags Tags context object to merge into current context.
|
62 | */
|
63 | export declare function setTags(tags: {
|
64 | [key: string]: Primitive;
|
65 | }): ReturnType<Hub['setTags']>;
|
66 | /**
|
67 | * Set key:value that will be sent as tags data with the event.
|
68 | *
|
69 | * Can also be used to unset a tag, by passing `undefined`.
|
70 | *
|
71 | * @param key String key of tag
|
72 | * @param value Value of tag
|
73 | */
|
74 | export declare function setTag(key: string, value: Primitive): ReturnType<Hub['setTag']>;
|
75 | /**
|
76 | * Updates user context information for future events.
|
77 | *
|
78 | * @param user User context object to be set in the current context. Pass `null` to unset the user.
|
79 | */
|
80 | export declare function setUser(user: User | null): ReturnType<Hub['setUser']>;
|
81 | /**
|
82 | * Creates a new scope with and executes the given operation within.
|
83 | * The scope is automatically removed once the operation
|
84 | * finishes or throws.
|
85 | *
|
86 | * This is essentially a convenience function for:
|
87 | *
|
88 | * pushScope();
|
89 | * callback();
|
90 | * popScope();
|
91 | *
|
92 | * @param callback that will be enclosed into push/popScope.
|
93 | */
|
94 | export declare function withScope(callback: (scope: Scope) => void): ReturnType<Hub['withScope']>;
|
95 | /**
|
96 | * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
|
97 | *
|
98 | * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
|
99 | * new child span within the transaction or any span, call the respective `.startChild()` method.
|
100 | *
|
101 | * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
|
102 | *
|
103 | * The transaction must be finished with a call to its `.finish()` method, at which point the transaction with all its
|
104 | * finished child spans will be sent to Sentry.
|
105 | *
|
106 | * NOTE: This function should only be used for *manual* instrumentation. Auto-instrumentation should call
|
107 | * `startTransaction` directly on the hub.
|
108 | *
|
109 | * @param context Properties of the new `Transaction`.
|
110 | * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
|
111 | * default values). See {@link Options.tracesSampler}.
|
112 | *
|
113 | * @returns The transaction which was just started
|
114 | */
|
115 | export declare function startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): ReturnType<Hub['startTransaction']>;
|
116 | /**
|
117 | * Create a cron monitor check in and send it to Sentry.
|
118 | *
|
119 | * @param checkIn An object that describes a check in.
|
120 | * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
|
121 | * to create a monitor automatically when sending a check in.
|
122 | */
|
123 | export declare function captureCheckIn(checkIn: CheckIn, upsertMonitorConfig?: MonitorConfig): string;
|
124 | /**
|
125 | * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.
|
126 | *
|
127 | * @param monitorSlug The distinct slug of the monitor.
|
128 | * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
|
129 | * to create a monitor automatically when sending a check in.
|
130 | */
|
131 | export declare function withMonitor<T>(monitorSlug: CheckIn['monitorSlug'], callback: () => T, upsertMonitorConfig?: MonitorConfig): T;
|
132 | /**
|
133 | * Call `flush()` on the current client, if there is one. See {@link Client.flush}.
|
134 | *
|
135 | * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause
|
136 | * the client to wait until all events are sent before resolving the promise.
|
137 | * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
|
138 | * doesn't (or if there's no client defined).
|
139 | */
|
140 | export declare function flush(timeout?: number): Promise<boolean>;
|
141 | /**
|
142 | * Call `close()` on the current client, if there is one. See {@link Client.close}.
|
143 | *
|
144 | * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this
|
145 | * parameter will cause the client to wait until all events are sent before disabling itself.
|
146 | * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
|
147 | * doesn't (or if there's no client defined).
|
148 | */
|
149 | export declare function close(timeout?: number): Promise<boolean>;
|
150 | /**
|
151 | * This is the getter for lastEventId.
|
152 | *
|
153 | * @returns The last event id of a captured event.
|
154 | */
|
155 | export declare function lastEventId(): string | undefined;
|
156 | /**
|
157 | * Get the currently active client.
|
158 | */
|
159 | export declare function getClient<C extends Client>(): C | undefined;
|
160 | //# sourceMappingURL=exports.d.ts.map |
\ | No newline at end of file |