Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use HTTP instead of _OTHER in HTTP span names (if method is unknown) #270

Merged
merged 12 commits into from
Sep 11, 2023
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ release.
([#252](https://github.com/open-telemetry/semantic-conventions/pull/252))
- Simplify HTTP metric briefs.
([#276](https://github.com/open-telemetry/semantic-conventions/pull/276))
- BREAKING: Change HTTP span name when method is unknown (use `HTTP` instead of `_OTHER`)
([#270](https://github.com/open-telemetry/semantic-conventions/pull/270))

## v1.21.0 (2023-07-13)

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
lmolkova marked this conversation as resolved.
Show resolved Hide resolved
(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",
lmolkova marked this conversation as resolved.
Show resolved Hide resolved
"markdown-toc": "^1.2.0",
"markdownlint": "^0.29.0",
"markdownlint-cli": "0.31.0",
Expand Down