open-telemetry / open-telemetry/opentelemetry-python-contrib

Server spans should use templated route/url as the span name

Open
#434 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

From Otel spec:

In case of HTTP servers, these endpoints are often mapped by the server frameworks to more concise HTTP routes, e.g. /api/users/{user_id}, which are recommended as the low cardinality span names.

https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#name


All server instrumentations should be updated to confirm with the spec.

  • URL/Route templates should be used as the span name.
  • When it is not possible retrieve the templated URL/route, instrumentations should fall-back on the view/controller/function name. For example, UserHandler.get where UserHandler is a Python class and get is the method that served the HTTP request.
  • Finally if none of the above are possible, instrumentations should fall back on HTTP {method}. For example, HTTP GET for GET requests and so on.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the repository's server instrumentations and the linked OpenTelemetry HTTP semantic conventions. Done means each server instrumentation uses a templated route or URL when available, then a view/controller/function name, and finally an HTTP {method} span name.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.