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
6 changes: 6 additions & 0 deletions packages/core/src/tracing/hubextensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ The transaction will not be sampled. Please use the ${configInstrumenter} instru
if (transaction.sampled) {
transaction.initSpanRecorder(options._experiments && (options._experiments.maxSpans as number));
}
if (client && client.emit) {
client.emit('startTransaction', transaction);
}
return transaction;
}

Expand Down Expand Up @@ -213,6 +216,9 @@ export function startIdleTransaction(
if (transaction.sampled) {
transaction.initSpanRecorder(options._experiments && (options._experiments.maxSpans as number));
}
if (client && client.emit) {
client.emit('startTransaction', transaction);
}
return transaction;
}

Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/tracing/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,15 @@ export class Transaction extends SpanClass implements TransactionInterface {
// just sets the end timestamp
super.finish(endTimestamp);

const client = this._hub.getClient();
if (client && client.emit) {
client.emit('finishTransaction', this);
}

if (this.sampled !== true) {
// At this point if `sampled !== true` we want to discard the transaction.
__DEBUG_BUILD__ && logger.log('[Tracing] Discarding transaction because its trace was not chosen to be sampled.');

const client = this._hub.getClient();
if (client) {
client.recordDroppedEvent('sample_rate', 'transaction');
}
Expand Down