Skip to content

Commit

Permalink
trace/http: Add http.{request,response}.size attributes (#84)
Browse files Browse the repository at this point in the history
Co-authored-by: Liudmila Molkova <[email protected]>
Co-authored-by: Alexandra Konrad <[email protected]>
Co-authored-by: Joao Grassi <[email protected]>
  • Loading branch information
4 people authored Mar 18, 2024
1 parent f9dfdd5 commit 0220d78
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .chloggen/http-request-response-size.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use this changelog template to create an entry for release notes.
#
# If your change doesn't affect end users you should instead start
# your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
component: http

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add `http.request.size` and `http.response.size` attributes for the total number of bytes in http messages

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: [38, 84]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
2 changes: 2 additions & 0 deletions docs/attributes-registry/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
| `http.request.method` | string | ![Stable](https://img.shields.io/badge/-stable-lightgreen)<br>HTTP request method. [2] | `GET`; `POST`; `HEAD` |
| `http.request.method_original` | string | ![Stable](https://img.shields.io/badge/-stable-lightgreen)<br>Original HTTP method sent by the client in the request line. | `GeT`; `ACL`; `foo` |
| `http.request.resend_count` | int | ![Stable](https://img.shields.io/badge/-stable-lightgreen)<br>The ordinal number of request resending attempt (for any reason, including redirects). [3] | `3` |
| `http.request.size` | int | The total size of the request in bytes. This should be the total number of bytes sent over the wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request body if any. | `1437` |
| `http.response.body.size` | int | The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. | `3495` |
| `http.response.header.<key>` | string[] | ![Stable](https://img.shields.io/badge/-stable-lightgreen)<br>HTTP response headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values. [4] | `http.response.header.content-type=["application/json"]`; `http.response.header.my-custom-header=["abc", "def"]` |
| `http.response.size` | int | The total size of the response in bytes. This should be the total number of bytes sent over the wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and response body and trailers if any. | `1437` |
| `http.response.status_code` | int | ![Stable](https://img.shields.io/badge/-stable-lightgreen)<br>[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` |
| `http.route` | string | ![Stable](https://img.shields.io/badge/-stable-lightgreen)<br>The matched route, that is, the path template in the format used by the respective server framework. [5] | `/users/:userID?`; `{controller}/{action}/{id?}` |

Expand Down
14 changes: 14 additions & 0 deletions model/registry/http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ groups:
was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues,
or any other).
examples: 3
- id: request.size
type: int
brief: >
The total size of the request in bytes. This should be the total number of bytes sent over the wire, including the request line (HTTP/1.1),
framing (HTTP/2 and HTTP/3), headers, and request body if any.
examples: 1437
stability: experimental
- id: response.body.size
type: int
brief: >
Expand All @@ -118,6 +125,13 @@ groups:
or a single-item array containing a possibly comma-concatenated string, depending on the way
the HTTP library provides access to headers.
examples: ['http.response.header.content-type=["application/json"]', 'http.response.header.my-custom-header=["abc", "def"]']
- id: response.size
type: int
brief: >
The total size of the response in bytes. This should be the total number of bytes sent over the wire, including the status line (HTTP/1.1),
framing (HTTP/2 and HTTP/3), headers, and response body and trailers if any.
examples: 1437
stability: experimental
- id: response.status_code
stability: stable
type: int
Expand Down

0 comments on commit 0220d78

Please sign in to comment.