Skip to content

Commit 35f559c

Browse files
authored
ref(angular): Consolidate to use single setName call (#5682)
1 parent 64122e8 commit 35f559c

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

packages/angular/src/tracing.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ export class TraceService implements OnDestroy {
117117
const transaction = getActiveTransaction();
118118
// TODO (v8 / #5416): revisit the source condition. Do we want to make the parameterized route the default?
119119
if (transaction && transaction.metadata.source === 'url') {
120-
transaction.setName(route);
121-
transaction.setMetadata({ source: 'route' });
120+
transaction.setName(route, 'route');
122121
}
123122
}),
124123
);

packages/angular/test/tracing.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ describe('Angular Tracing', () => {
8484
transaction = {
8585
...ctx,
8686
setName: jest.fn(name => (transaction.name = name)),
87-
setMetadata: jest.fn(metadata => (transaction.metadata = metadata)),
8887
};
8988
return transaction;
9089
});
@@ -154,8 +153,7 @@ describe('Angular Tracing', () => {
154153
// this event starts the parameterization
155154
routerEvents$.next(new ResolveEnd(1, url, url, routerState as any));
156155

157-
expect(transaction.setName).toHaveBeenCalledWith(result);
158-
expect(transaction.setMetadata).toHaveBeenCalledWith({ source: 'route' });
156+
expect(transaction.setName).toHaveBeenCalledWith(result, 'route');
159157
});
160158

161159
it('does not change the transaction name if the source is something other than `url`', () => {
@@ -182,7 +180,6 @@ describe('Angular Tracing', () => {
182180
);
183181

184182
expect(transaction.setName).toHaveBeenCalledTimes(0);
185-
expect(transaction.setMetadata).toHaveBeenCalledTimes(0);
186183
expect(transaction.name).toEqual(url);
187184
});
188185
});

0 commit comments

Comments
 (0)