Skip to content

Commit

Permalink
fix: remove setting http.route in http span attributes (#2494)
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafain117 committed Sep 28, 2021
1 parent f0dc893 commit be52259
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Expand Up @@ -453,7 +453,6 @@ export const getIncomingRequestAttributes = (
}

if (requestUrl) {
attributes[SemanticAttributes.HTTP_ROUTE] = requestUrl.pathname || '/';
attributes[SemanticAttributes.HTTP_TARGET] = requestUrl.pathname || '/';
}

Expand Down
Expand Up @@ -466,6 +466,21 @@ describe('Utility', () => {
});
});

describe('getIncomingRequestAttributes()', () => {
it('should not set http.route in http span attributes', () => {
const request = {
url: 'http://hostname/user/:id',
method: 'GET'
} as IncomingMessage;
request.headers = {
'user-agent': 'chrome',
'x-forwarded-for': '<client>, <proxy1>, <proxy2>'
}
const attributes = utils.getIncomingRequestAttributes(request, { component: 'http'})
assert.strictEqual(attributes[SemanticAttributes.HTTP_ROUTE], undefined)
});
});

describe('headers to span attributes capture', () => {
let span: Span;

Expand Down

0 comments on commit be52259

Please sign in to comment.