Skip to content

Commit

Permalink
trace/http: Add http.{request,response}.size attributes
Browse files Browse the repository at this point in the history
These attributes are the number of bytes in the request or response,
including headers. 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
  • Loading branch information
kamalmarhubi committed Jun 6, 2023
1 parent d6d2952 commit ff7084b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions semantic_conventions/trace/http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ groups:
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.
examples: 3495
- id: request.size
type: int
brief: >
Total size in bytes of the request (body and headers).
examples: 1437
- id: response.size
type: int
brief: >
Total size in bytes of the response (body and headers).
examples: 1437
- ref: http.request.method
sampling_relevant: true
- ref: network.transport
Expand Down
2 changes: 2 additions & 0 deletions specification/trace/semantic_conventions/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ sections below.
| `http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | Conditionally Required: If and only if one was received/sent. |
| `http.request.body.size` | int | 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](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. | `3495` | Recommended |
| `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` | Recommended |
| `http.request.size` | int | Total size in bytes of the request (body and headers). | `1437` | Recommended |
| `http.response.size` | int | Total size in bytes of the response (body and headers). | `1437` | Recommended |
| `http.request.method` | string | HTTP request method. | `GET`; `POST`; `HEAD` | Required |
| [`network.protocol.name`](span-general.md) | string | [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. | `http`; `spdy` | Recommended: if not default (`http`). |
| [`network.protocol.version`](span-general.md) | string | Version of the application layer protocol used. See note below. [1] | `1.0`; `1.1`; `2.0` | Recommended |
Expand Down

0 comments on commit ff7084b

Please sign in to comment.