Skip to content

Commit 02ac212

Browse files
authored
fix(tracing): Normalize transaction names for express methods to match those of other SDKs (#2832)
1 parent ef6396a commit 02ac212

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/node/src/handlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function extractTransaction(req: { [key: string]: any }, type: boolean | Transac
113113
case 'methodPath':
114114
default: {
115115
const method = request.method.toUpperCase();
116-
return `${method}|${routePath}`;
116+
return `${method} ${routePath}`;
117117
}
118118
}
119119
} catch (_oO) {

packages/node/test/handlers.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,20 @@ describe('parseRequest', () => {
138138
describe('parseRequest.transaction property', () => {
139139
test('extracts method and full route path by default from `originalUrl`', () => {
140140
const parsedRequest: Event = parseRequest({}, mockReq);
141-
expect(parsedRequest.transaction).toEqual('POST|/some/originalUrl');
141+
expect(parsedRequest.transaction).toEqual('POST /some/originalUrl');
142142
});
143143

144144
test('extracts method and full route path by default from `url` if `originalUrl` is not present', () => {
145145
delete mockReq.originalUrl;
146146
const parsedRequest: Event = parseRequest({}, mockReq);
147-
expect(parsedRequest.transaction).toEqual('POST|/some/url');
147+
expect(parsedRequest.transaction).toEqual('POST /some/url');
148148
});
149149

150150
test('fallback to method and `route.path` if previous attempts failed', () => {
151151
delete mockReq.originalUrl;
152152
delete mockReq.url;
153153
const parsedRequest: Event = parseRequest({}, mockReq);
154-
expect(parsedRequest.transaction).toEqual('POST|/path');
154+
expect(parsedRequest.transaction).toEqual('POST /path');
155155
});
156156

157157
test('can extract path only instead if configured', () => {

0 commit comments

Comments
 (0)