From 93d3a60a463818c846fa6444893734d089eb248e Mon Sep 17 00:00:00 2001 From: Kamal Al Marhubi Date: Mon, 5 Jun 2023 20:14:06 -0400 Subject: [PATCH] trace/http: Add http.{request,response}.size attributes These attributes are the number of bytes in the request or response, including control data, headers, body, and trailers. The names were chosen by taking the [ECS HTTP fields] and replacing `bytes` with `size`, as for `http.request.content.size`. closes #38 [ECS HTTP fields]: https://www.elastic.co/guide/en/ecs/current/ecs-http.html --- .chloggen/http-request-response-size.yaml | 22 ++++++++++++++++++++++ docs/attributes-registry/http.md | 2 ++ model/registry/http.yaml | 13 +++++++++++++ 3 files changed, 37 insertions(+) create mode 100755 .chloggen/http-request-response-size.yaml diff --git a/.chloggen/http-request-response-size.yaml b/.chloggen/http-request-response-size.yaml new file mode 100755 index 0000000000..c823b94a91 --- /dev/null +++ b/.chloggen/http-request-response-size.yaml @@ -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: diff --git a/docs/attributes-registry/http.md b/docs/attributes-registry/http.md index 8b7665bb9c..2f01d056f5 100644 --- a/docs/attributes-registry/http.md +++ b/docs/attributes-registry/http.md @@ -13,8 +13,10 @@ | `http.request.method` | string | ![Stable](https://img.shields.io/badge/-stable-lightgreen)
HTTP request method. [2] | `GET`; `POST`; `HEAD` | | `http.request.method_original` | string | ![Stable](https://img.shields.io/badge/-stable-lightgreen)
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)
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, and includes all framing and control data, 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.` | string[] | ![Stable](https://img.shields.io/badge/-stable-lightgreen)
HTTP response headers, `` 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, and includes all framing and control data, headers, and response body and trailers if any. as sent over the wire. | `1437` | | `http.response.status_code` | int | ![Stable](https://img.shields.io/badge/-stable-lightgreen)
[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | | `http.route` | string | ![Stable](https://img.shields.io/badge/-stable-lightgreen)
The matched route, that is, the path template in the format used by the respective server framework. [5] | `/users/:userID?`; `{controller}/{action}/{id?}` | diff --git a/model/registry/http.yaml b/model/registry/http.yaml index 2cb8e8b894..398b6b1b52 100644 --- a/model/registry/http.yaml +++ b/model/registry/http.yaml @@ -95,6 +95,12 @@ 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, and includes all framing and control + data, headers, and request body if any. + examples: 1437 - id: response.body.size type: int brief: > @@ -118,6 +124,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, and includes all framing and control + data, headers, and response body and trailers if any. + as sent over the wire. + examples: 1437 - id: response.status_code stability: stable type: int