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

Add semantic conventions for http content size #641

Merged
merged 2 commits into from
Jun 25, 2020

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Jun 9, 2020

This adds attributes for the payload size of HTTP requests / responses. I looked at messaging too for inspiration but have ended up being inconsistent to better match HTTP conventions Whereas messaging has payload and compressed_payload, here I use content_length and raw_content_length. This is because the concept of content length for HTTP is defined by spec so matching it (i.e., using compressed size as content length for compressed payloads) seems to be clearer for users. But I'm happy to tweak as needed.

Fixes #640

@@ -79,6 +79,11 @@ Note that the items marked with [1] are different from the mapping defined in th
| `http.status_text` | [HTTP reason phrase][]. E.g. `"OK"` | No |
| `http.flavor` | Kind of HTTP protocol used: `"1.0"`, `"1.1"`, `"2"`, `"SPDY"` or `"QUIC"`. | No |
| `http.user_agent` | Value of the HTTP [User-Agent][] header sent by the client. | No |
| `http.request_content_length` | The size of the request body in bytes. For requests using transport encoding, this should be the compressed size. | No |
Copy link
Member

@Oberon00 Oberon00 Jun 9, 2020

Choose a reason for hiding this comment

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

I think using the word "content" here is misleading. The HTTP header "Content-Length" only has the length of the request/response body but you seem to want the size of the whole request including the headers and request/response line? If not, please clarify.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah nope meant to add content, it's similar to the metrics I've seen in other libraries. Tried clarifying it in the text let me know if it's still ambiguous.

Copy link
Member

Choose a reason for hiding this comment

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

I actually found "size of the request/response body" clearer than using just "content" (f44b68f), which is more ambiguous IMHO unless it refers particularly to the Content-Length header. RFC 7230 calls it "payload body", that would probably the most precise wording to go with.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for finding this RFC! Yup aligned the terms with it

@arminru
Copy link
Member

arminru commented Jun 9, 2020

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

lgtm, but any reason why this should not be in the general RPC conventions rather than HTTP-only?

@anuraaga
Copy link
Contributor Author

@yurishkuro Many RPC are built on top of HTTP but not all. For the ones that are though they will often have a message size that is different from the HTTP payload size, after deframing for example. How size should be filled for streaming RPC is also an open question (per message, total stream etc). So it seems to make sense to decouple RPC from HTTP for size because the two will treat them somewhat different (sometimes they're the same though).

CHANGELOG.md Outdated
@@ -18,6 +18,7 @@ the release.
- Update api-metrics-user.md and api-metrics-meter.md with the latest metrics API.
- Normalize Instrumentation term for instrumentations.
- Change w3c correlation context to custom header.
- Add semantic conventions for HTTP content length
Copy link
Member

Choose a reason for hiding this comment

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

Ah this is not really obvious, sorry. v0.5.0 had been released already. Your change, which is not included in a release yet, should go into the "Unreleased" section above. @carlosalberto will then insert a new v0.6.0 header above it once he's releasing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops - taking a second look it seems obvious yet somehow treated this as the Unreleased section. Updated

@carlosalberto carlosalberto added the area:semantic-conventions Related to semantic conventions label Jun 12, 2020
Comment on lines 82 to 83
| `http.request_content_length` | The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length][] header. For requests using transport encoding, this should be the compressed size. | No |
| `http.request_raw_content_length` | The size of the raw request payload body after transport decoding. Not set if transport encoding not used. | No |
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you mean uncompressed - sure, I was thinking about that and thought the field gets too long. But I guess we do have some long fields and it's not such a big deal.

Copy link
Member

Choose a reason for hiding this comment

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

If size of the key is a concern we can use request_size or request_body_size as shorter names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it a concern? :) I've seen in some other PRs too that it's not really clear right now, so might need to add conventions for the conventions.

Personally I'm good with the current names, especially lean towards using the word content length at least since it's so well understood in the HTTP world.

Copy link
Contributor

Choose a reason for hiding this comment

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

My advise is: go with what you feel the best (request_size, request_body_size, or the original, plus compressed), and let's fill an issue so we can discuss what's the maximum recommended key length for an attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tips - so it sounds like people are ok with the current names so I'm not planning on changing them. Let me know if anyone still has any concerns though!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have a couple of approvals and some non-blocking suggestions. Is it ok to merge this?

Copy link
Member

Choose a reason for hiding this comment

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

As mentioned above I'm fine with either the terminology we have for message sizes or the well-established terms already used in standard HTTP headers as you currently have it. 👍

Copy link
Member

Choose a reason for hiding this comment

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

Nit: I'd put uncompressed to the end so both options would come up as suggestions while one is typing in their IDE once we have typed spans but that's probably more a matter of taste.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that seems like a nice idea, moved to using a suffix

@carlosalberto carlosalberto added the spec:trace Related to the specification/trace directory label Jun 19, 2020
@anuraaga
Copy link
Contributor Author

Think I hit most comments and have a couple of approvals. Can we merge it in? :) /cc @carlosalberto @bogdandrutu @yurishkuro let me know if you still have any concerns though

@yurishkuro yurishkuro merged commit 9e8c5f1 into open-telemetry:master Jun 25, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:semantic-conventions Related to semantic conventions spec:trace Related to the specification/trace directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Semantic conventions for request / response size
6 participants