UNPKG

3.75 kBTypeScriptView Raw
1import type { Context, DynamicSamplingContext, MeasurementUnit, SpanTimeInput, Transaction as TransactionInterface, TransactionContext, TransactionEvent, TransactionMetadata } from '@sentry/types';
2import type { Hub } from '../hub';
3import { Span as SpanClass } from './span';
4/** JSDoc */
5export declare class Transaction extends SpanClass implements TransactionInterface {
6 /**
7 * The reference to the current hub.
8 */
9 _hub: Hub;
10 protected _name: string;
11 private _contexts;
12 private _trimEnd?;
13 private _frozenDynamicSamplingContext;
14 private _metadata;
15 /**
16 * This constructor should never be called manually. Those instrumenting tracing should use
17 * `Sentry.startTransaction()`, and internal methods should use `hub.startTransaction()`.
18 * @internal
19 * @hideconstructor
20 * @hidden
21 *
22 * @deprecated Transactions will be removed in v8. Use spans instead.
23 */
24 constructor(transactionContext: TransactionContext, hub?: Hub);
25 /**
26 * Getter for `name` property.
27 * @deprecated Use `spanToJSON(span).description` instead.
28 */
29 get name(): string;
30 /**
31 * Setter for `name` property, which also sets `source` as custom.
32 * @deprecated Use `updateName()` and `setMetadata()` instead.
33 */
34 set name(newName: string);
35 /**
36 * Get the metadata for this transaction.
37 * @deprecated Use `spanGetMetadata(transaction)` instead.
38 */
39 get metadata(): TransactionMetadata;
40 /**
41 * Update the metadata for this transaction.
42 * @deprecated Use `spanGetMetadata(transaction)` instead.
43 */
44 set metadata(metadata: TransactionMetadata);
45 /**
46 * Setter for `name` property, which also sets `source` on the metadata.
47 *
48 * @deprecated Use `.updateName()` and `.setAttribute()` instead.
49 */
50 setName(name: string, source?: TransactionMetadata['source']): void;
51 /** @inheritdoc */
52 updateName(name: string): this;
53 /**
54 * Attaches SpanRecorder to the span itself
55 * @param maxlen maximum number of spans that can be recorded
56 */
57 initSpanRecorder(maxlen?: number): void;
58 /**
59 * Set the context of a transaction event.
60 * @deprecated Use either `.setAttribute()`, or set the context on the scope before creating the transaction.
61 */
62 setContext(key: string, context: Context | null): void;
63 /**
64 * @inheritDoc
65 *
66 * @deprecated Use top-level `setMeasurement()` instead.
67 */
68 setMeasurement(name: string, value: number, unit?: MeasurementUnit): void;
69 /**
70 * Store metadata on this transaction.
71 * @deprecated Use attributes or store data on the scope instead.
72 */
73 setMetadata(newMetadata: Partial<TransactionMetadata>): void;
74 /**
75 * @inheritDoc
76 */
77 end(endTimestamp?: SpanTimeInput): string | undefined;
78 /**
79 * @inheritDoc
80 */
81 toContext(): TransactionContext;
82 /**
83 * @inheritDoc
84 */
85 updateWithContext(transactionContext: TransactionContext): this;
86 /**
87 * @inheritdoc
88 *
89 * @experimental
90 *
91 * @deprecated Use top-level `getDynamicSamplingContextFromSpan` instead.
92 */
93 getDynamicSamplingContext(): Readonly<Partial<DynamicSamplingContext>>;
94 /**
95 * Override the current hub with a new one.
96 * Used if you want another hub to finish the transaction.
97 *
98 * @internal
99 */
100 setHub(hub: Hub): void;
101 /**
102 * Get the profile id of the transaction.
103 */
104 getProfileId(): string | undefined;
105 /**
106 * Finish the transaction & prepare the event to send to Sentry.
107 */
108 protected _finishTransaction(endTimestamp?: number): TransactionEvent | undefined;
109}
110//# sourceMappingURL=transaction.d.ts.map
\No newline at end of file