Skip to content
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

fix: remove setting http.route in http span attributes #2494

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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)
});
})
});