Skip to content

Commit

Permalink
Use HTTP instead of _OTHER in HTTP span names (if method is unkno…
Browse files Browse the repository at this point in the history
…wn) (#270)

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
Co-authored-by: Joao Grassi <joao@joaograssi.com>
Co-authored-by: Christian Neumüller <christian+github@neumueller.me>
Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
  • Loading branch information
5 people committed Sep 11, 2023
1 parent 3e16365 commit 5f6558d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ release.
([#276](https://github.com/open-telemetry/semantic-conventions/pull/276))
- Add host cpu resource attributes.
([#209](https://github.com/open-telemetry/semantic-conventions/pull/209))
- BREAKING: Change HTTP span name when method is unknown (use `HTTP` instead of `_OTHER`)
([#270](https://github.com/open-telemetry/semantic-conventions/pull/270))
- Moved RPC streaming notes from metric brief section to notes section.
([#275](https://github.com/open-telemetry/semantic-conventions/pull/275))

Expand Down
22 changes: 16 additions & 6 deletions docs/http/http-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,23 @@ and various HTTP versions like 1.1, 2 and SPDY.
## Name

HTTP spans MUST follow the overall [guidelines for span names](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.22.0/specification/trace/api.md#span).
HTTP server span names SHOULD be `{http.request.method} {http.route}` if there is a
(low-cardinality) `http.route` available.
HTTP server span names SHOULD be `{http.request.method}` if there is no (low-cardinality)
`http.route` available.

<!-- markdown-link-check-disable -->
<!-- HTML anchors are not supported https://github.com/tcort/markdown-link-check/issues/225-->
HTTP server span names SHOULD be `{method} {http.route}` if there is a
(low-cardinality) `http.route` available (see below for the exact definition of the [`{method}`](#method-placeholder) placeholder).

If there is no (low-cardinality) `http.route` available, HTTP server span names
SHOULD be [`{method}`](#method-placeholder).

HTTP client spans have no `http.route` attribute since client-side instrumentation
is not generally aware of the "route", and therefore HTTP client spans SHOULD use
`{http.request.method}`.
is not generally aware of the "route", and therefore HTTP client spans SHOULD be
[`{method}`](#method-placeholder).
<!-- markdown-link-check-enable -->

The <span id="method-placeholder">`{method}`</span> MUST be `{http.request.method}` if the method represents the original method known to the instrumentation.
In other cases (when `{http.request.method}` is set to `_OTHER`), `{method}` MUST be `HTTP`.

Instrumentation MUST NOT default to using URI
path as span name, but MAY provide hooks to allow custom logic to override the
default span name.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"devDependencies": {
"gulp": "^4.0.2",
"js-yaml": "^4.1.0",
"markdown-link-check": "3.10.3",
"markdown-link-check": "^3.11.2",
"markdown-toc": "^1.2.0",
"markdownlint": "^0.29.0",
"markdownlint-cli": "0.31.0",
Expand Down

0 comments on commit 5f6558d

Please sign in to comment.