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

Http attributes: only set content_length when it's >0 #8114

Conversation

mateuszrzeszutek
Copy link
Member

Fixes an issue encountered in #8111

@mateuszrzeszutek mateuszrzeszutek requested a review from a team March 23, 2023 10:37
internalSet(
attributes, SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH, requestContentLength(request));
Long requestLength = requestContentLength(request);
if (requestLength != null && requestLength > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't requestLength 0 valid (and different from not being captured)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, true. I've a problem with Reactor Netty instrumentation, which reports content-lenght=0 even for GET & HEAD requests. WDYT about skipping 0 if method is GET/HEAD?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we apply that change just to the reactor netty HttpAttributesGetter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can (well, not in a "nice" way) - since the getter simply returns the headers, which then get parsed in the extractor.
On a second thought, maybe we can live with this: the content-length=0 header is actually set on the outgoing HTTP request, so it's not like the instrumentation is lying. It's just a bit strange to see that in a GET request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants