From a2aa8a633b30d73d50ed5a97d0337e7292159433 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 1 Sep 2022 14:39:09 -0400 Subject: [PATCH 1/2] ref(angular): Consolidate to use single `setName` call Remove usage `setMetadata` in favour of adding the source to `setName` --- packages/angular/src/tracing.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/angular/src/tracing.ts b/packages/angular/src/tracing.ts index 56dc1cb60525..797aa10b16b7 100644 --- a/packages/angular/src/tracing.ts +++ b/packages/angular/src/tracing.ts @@ -117,8 +117,7 @@ export class TraceService implements OnDestroy { const transaction = getActiveTransaction(); // TODO (v8 / #5416): revisit the source condition. Do we want to make the parameterized route the default? if (transaction && transaction.metadata.source === 'url') { - transaction.setName(route); - transaction.setMetadata({ source: 'route' }); + transaction.setName(route, 'route'); } }), ); From 065f040b43b427843c5f7e618f5bc00917361505 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Thu, 1 Sep 2022 15:30:40 -0400 Subject: [PATCH 2/2] fix tests --- packages/angular/test/tracing.test.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/angular/test/tracing.test.ts b/packages/angular/test/tracing.test.ts index ad4b67f2ecc9..69578f5e450d 100644 --- a/packages/angular/test/tracing.test.ts +++ b/packages/angular/test/tracing.test.ts @@ -84,7 +84,6 @@ describe('Angular Tracing', () => { transaction = { ...ctx, setName: jest.fn(name => (transaction.name = name)), - setMetadata: jest.fn(metadata => (transaction.metadata = metadata)), }; return transaction; }); @@ -154,8 +153,7 @@ describe('Angular Tracing', () => { // this event starts the parameterization routerEvents$.next(new ResolveEnd(1, url, url, routerState as any)); - expect(transaction.setName).toHaveBeenCalledWith(result); - expect(transaction.setMetadata).toHaveBeenCalledWith({ source: 'route' }); + expect(transaction.setName).toHaveBeenCalledWith(result, 'route'); }); it('does not change the transaction name if the source is something other than `url`', () => { @@ -182,7 +180,6 @@ describe('Angular Tracing', () => { ); expect(transaction.setName).toHaveBeenCalledTimes(0); - expect(transaction.setMetadata).toHaveBeenCalledTimes(0); expect(transaction.name).toEqual(url); }); });