UNPKG

4.83 kBTypeScriptView Raw
1import { Scope } from '@sentry/hub';
2import { Breadcrumb, CaptureContext, CustomSamplingContext, Event, Extra, Extras, Primitive, Severity, Transaction, TransactionContext, User } from '@sentry/types';
3/**
4 * Captures an exception event and sends it to Sentry.
5 *
6 * @param exception An exception-like object.
7 * @returns The generated eventId.
8 */
9export declare function captureException(exception: any, captureContext?: CaptureContext): string;
10/**
11 * Captures a message event and sends it to Sentry.
12 *
13 * @param message The message to send to Sentry.
14 * @param level Define the level of the message.
15 * @returns The generated eventId.
16 */
17export declare function captureMessage(message: string, captureContext?: CaptureContext | Severity): string;
18/**
19 * Captures a manually created event and sends it to Sentry.
20 *
21 * @param event The event to send to Sentry.
22 * @returns The generated eventId.
23 */
24export declare function captureEvent(event: Event): string;
25/**
26 * Callback to set context information onto the scope.
27 * @param callback Callback function that receives Scope.
28 */
29export declare function configureScope(callback: (scope: Scope) => void): void;
30/**
31 * Records a new breadcrumb which will be attached to future events.
32 *
33 * Breadcrumbs will be added to subsequent events to provide more context on
34 * user's actions prior to an error or crash.
35 *
36 * @param breadcrumb The breadcrumb to record.
37 */
38export declare function addBreadcrumb(breadcrumb: Breadcrumb): void;
39/**
40 * Sets context data with the given name.
41 * @param name of the context
42 * @param context Any kind of data. This data will be normalized.
43 */
44export declare function setContext(name: string, context: {
45 [key: string]: any;
46} | null): void;
47/**
48 * Set an object that will be merged sent as extra data with the event.
49 * @param extras Extras object to merge into current context.
50 */
51export declare function setExtras(extras: Extras): void;
52/**
53 * Set an object that will be merged sent as tags data with the event.
54 * @param tags Tags context object to merge into current context.
55 */
56export declare function setTags(tags: {
57 [key: string]: Primitive;
58}): void;
59/**
60 * Set key:value that will be sent as extra data with the event.
61 * @param key String of extra
62 * @param extra Any kind of data. This data will be normalized.
63 */
64export declare function setExtra(key: string, extra: Extra): void;
65/**
66 * Set key:value that will be sent as tags data with the event.
67 *
68 * Can also be used to unset a tag, by passing `undefined`.
69 *
70 * @param key String key of tag
71 * @param value Value of tag
72 */
73export declare function setTag(key: string, value: Primitive): void;
74/**
75 * Updates user context information for future events.
76 *
77 * @param user User context object to be set in the current context. Pass `null` to unset the user.
78 */
79export declare function setUser(user: User | null): void;
80/**
81 * Creates a new scope with and executes the given operation within.
82 * The scope is automatically removed once the operation
83 * finishes or throws.
84 *
85 * This is essentially a convenience function for:
86 *
87 * pushScope();
88 * callback();
89 * popScope();
90 *
91 * @param callback that will be enclosed into push/popScope.
92 */
93export declare function withScope(callback: (scope: Scope) => void): void;
94/**
95 * Calls a function on the latest client. Use this with caution, it's meant as
96 * in "internal" helper so we don't need to expose every possible function in
97 * the shim. It is not guaranteed that the client actually implements the
98 * function.
99 *
100 * @param method The method to call on the client/client.
101 * @param args Arguments to pass to the client/fontend.
102 * @hidden
103 */
104export declare function _callOnClient(method: string, ...args: any[]): void;
105/**
106 * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
107 *
108 * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
109 * new child span within the transaction or any span, call the respective `.startChild()` method.
110 *
111 * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
112 *
113 * The transaction must be finished with a call to its `.finish()` method, at which point the transaction with all its
114 * finished child spans will be sent to Sentry.
115 *
116 * @param context Properties of the new `Transaction`.
117 * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
118 * default values). See {@link Options.tracesSampler}.
119 *
120 * @returns The transaction which was just started
121 */
122export declare function startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): Transaction;
123//# sourceMappingURL=index.d.ts.map
\No newline at end of file