Skip to content

Commit cf311f1

Browse files
committed
add metadata property to Transaction class
1 parent aeed644 commit cf311f1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/tracing/src/transaction.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { Span as SpanClass, SpanRecorder } from './span';
77
/** JSDoc */
88
export class Transaction extends SpanClass implements TransactionInterface {
99
public name: string;
10+
11+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
12+
private _metadata: { [key: string]: any } = {};
13+
1014
private _measurements: Measurements = {};
1115

1216
/**
@@ -64,6 +68,15 @@ export class Transaction extends SpanClass implements TransactionInterface {
6468
this._measurements = { ...measurements };
6569
}
6670

71+
/**
72+
* Set metadata for this transaction.
73+
* @hidden
74+
*/
75+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
76+
public setMetadata(newMetadata: { [key: string]: any }): void {
77+
this._metadata = { ...this._metadata, ...newMetadata };
78+
}
79+
6780
/**
6881
* @inheritDoc
6982
*/
@@ -108,6 +121,7 @@ export class Transaction extends SpanClass implements TransactionInterface {
108121
timestamp: this.endTimestamp,
109122
transaction: this.name,
110123
type: 'transaction',
124+
debug_meta: this._metadata,
111125
};
112126

113127
const hasMeasurements = Object.keys(this._measurements).length > 0;

0 commit comments

Comments
 (0)