Skip to content

Commit

Permalink
Limit HTTP request method cardinality: original_method (option A) (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova authored Jun 20, 2023
1 parent 98db625 commit be0fab1
Show file tree
Hide file tree
Showing 5 changed files with 366 additions and 58 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ release.
([#109](https://github.com/open-telemetry/semantic-conventions/pull/109))
- Updated AWS Java Lambda guidance - using system properties.
([#27](https://github.com/open-telemetry/semantic-conventions/pull/27))
- Limit `http.request.method` values to a closed set of known values,
introduce `http.request.method_original` for the original value.
([#17](https://github.com/open-telemetry/opentelemetry-specification/pull/17))
54 changes: 51 additions & 3 deletions semantic_conventions/http-common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,58 @@ groups:
prefix: http
attributes:
- id: request.method
type: string
type:
allow_custom_values: true
members:
- id: connect
value: "CONNECT"
brief: 'CONNECT method.'
- id: delete
value: "DELETE"
brief: 'DELETE method.'
- id: get
value: "GET"
brief: 'GET method.'
- id: head
value: "HEAD"
brief: 'HEAD method.'
- id: options
value: "OPTIONS"
brief: 'OPTIONS method.'
- id: patch
value: "PATCH"
brief: 'PATCH method.'
- id: post
value: "POST"
brief: 'POST method.'
- id: put
value: "PUT"
brief: 'PUT method.'
- id: trace
value: "TRACE"
brief: 'TRACE method.'
- id: other
value: "_OTHER"
brief: 'Any HTTP method that the instrumentation has no prior knowledge of.'
requirement_level: required
brief: 'HTTP request method.'
examples: ["GET", "POST", "HEAD"]
note: |
HTTP request method value SHOULD be "known" to the instrumentation.
By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
If the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER` and, except if reporting a metric, MUST
set the exact method received in the request line as value of the `http.request.method_original` attribute.
If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override
the list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named
OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods
(this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults).
HTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly.
Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent.
Tracing instrumentations that do so, MUST also set `http.request.method_original` to the original value.
- id: response.status_code
type: int
requirement_level:
Expand All @@ -25,7 +73,7 @@ groups:
- id: attributes.http.client
prefix: http
type: attribute_group
brief: 'HTTP client attributes'
brief: 'HTTP Client attributes'
attributes:
- ref: server.address
requirement_level: required
Expand All @@ -51,7 +99,7 @@ groups:
- id: attributes.http.server
prefix: http
type: attribute_group
brief: 'HTTP server attributes'
brief: 'HTTP Server attributes'
attributes:
- id: route
type: string
Expand Down
6 changes: 6 additions & 0 deletions semantic_conventions/trace/http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ groups:
These conventions can be used for http and https schemes
and various HTTP versions like 1.1, 2 and SPDY.
attributes:
- id: request.method_original
type: string
requirement_level:
conditionally_required: If and only if it's different than `http.request.method`.
brief: Original HTTP method sent by the client in the request line.
examples: ["GeT", "ACL", "foo"]
- id: request.body.size
type: int
brief: >
Expand Down
Loading

0 comments on commit be0fab1

Please sign in to comment.