Skip to content

ref(angular): Consolidate to use single setName call #5682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 1, 2022
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
3 changes: 1 addition & 2 deletions packages/angular/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}),
);
Expand Down
5 changes: 1 addition & 4 deletions packages/angular/test/tracing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down Expand Up @@ -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`', () => {
Expand All @@ -182,7 +180,6 @@ describe('Angular Tracing', () => {
);

expect(transaction.setName).toHaveBeenCalledTimes(0);
expect(transaction.setMetadata).toHaveBeenCalledTimes(0);
expect(transaction.name).toEqual(url);
});
});
Expand Down