Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/tracing/src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ export class Transaction extends SpanClass implements TransactionInterface {

this._name = transactionContext.name || '';

this.metadata = transactionContext.metadata || {};
this.metadata = {
...transactionContext.metadata,
spanMetadata: {},
};

this._trimEnd = transactionContext.trimEnd;

// this is because transactions are also spans, and spans have a transaction pointer
Expand Down Expand Up @@ -89,7 +93,7 @@ export class Transaction extends SpanClass implements TransactionInterface {
/**
* @inheritDoc
*/
public setMetadata(newMetadata: TransactionMetadata): void {
public setMetadata(newMetadata: Partial<TransactionMetadata>): void {
this.metadata = { ...this.metadata, ...newMetadata };
}

Expand Down
7 changes: 5 additions & 2 deletions packages/types/src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface TransactionContext extends SpanContext {
/**
* Metadata associated with the transaction, for internal SDK use.
*/
metadata?: TransactionMetadata;
metadata?: Partial<TransactionMetadata>;
}

/**
Expand Down Expand Up @@ -93,7 +93,7 @@ export interface Transaction extends TransactionContext, Span {
* Set metadata for this transaction.
* @hidden
*/
setMetadata(newMetadata: TransactionMetadata): void;
setMetadata(newMetadata: Partial<TransactionMetadata>): void;

/** return the baggage for dynamic sampling and trace propagation */
getBaggage(): Baggage;
Expand Down Expand Up @@ -147,6 +147,9 @@ export interface TransactionMetadata {

/** Information on how a transaction name was generated. */
source?: TransactionSource;

/** Metadata for the transaction's spans, keyed by spanId */
spanMetadata: { [spanId: string]: { [key: string]: unknown } };
}

/**
Expand Down