Skip to content

Commit

Permalink
fix: remove setting http.route in http span attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafain117 committed Sep 23, 2021
1 parent 6a78db1 commit 5e7cd47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -465,4 +465,19 @@ describe('Utility', () => {
verifyValueInAttributes(attributes, undefined, 1200);
});
});

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)
});
})
});

0 comments on commit 5e7cd47

Please sign in to comment.