Skip to content

Commit 8c00b71

Browse files
committed
record name changes in event processing
1 parent d16a353 commit 8c00b71

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

packages/core/src/baseclient.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
SyncPromise,
3636
truncate,
3737
uuid4,
38+
timestampInSeconds,
3839
} from '@sentry/utils';
3940

4041
import { getEnvelopeEndpointWithUrlEncodedAuth } from './api';
@@ -653,6 +654,29 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
653654
throw new SentryError('`beforeSend` returned `null`, will not send event.', 'log');
654655
}
655656

657+
const transactionInfo = processedEvent.transaction_info;
658+
if (
659+
processedEvent.type === 'transaction' &&
660+
transactionInfo &&
661+
processedEvent.transaction &&
662+
processedEvent.transaction !== event.transaction
663+
) {
664+
const source = 'custom';
665+
event.transaction_info = {
666+
...transactionInfo,
667+
source,
668+
name_changes: [
669+
...transactionInfo.name_changes,
670+
{
671+
name: processedEvent.transaction,
672+
source,
673+
timestamp: timestampInSeconds(),
674+
propagations: transactionInfo.num_propagations,
675+
},
676+
],
677+
};
678+
}
679+
656680
const session = scope && scope.getSession();
657681
if (!isTransaction && session) {
658682
this._updateSessionFromEvent(session, processedEvent);

packages/hub/src/scope.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
isThenable,
3030
logger,
3131
SyncPromise,
32+
timestampWithMs,
3233
} from '@sentry/utils';
3334

3435
import { updateSession } from './session';

0 commit comments

Comments
 (0)