Skip to content

Improve guidelines to HTTP span name generation #2616

@RassK

Description

@RassK

What are you trying to achieve?

Some instrumentation libraries confuse how to generate correct http server span name for template based routing. Add more examples and fix opentelemetry.io interpretation.

Additional context.

Contradictions in opentelemetry.io may suggest that http span name can be named as (some examples) and cause very low cardinality:

GET {controller=Home}/{action=Index}/{id?} (actual req path: url.path /Home/About)
GET [controller}/{action}/{id} (actual req path: url.path /Home/About)

Latest spec
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/trace/api.md#span

opentelemetry.io
https://opentelemetry.io/docs/specs/semconv/http/http-spans/#name
https://opentelemetry.io/docs/specs/semconv/registry/attributes/http/#http-route

Guidelines to improve suggestions.

Template based routing:

  • Leave static route tokens the same
  • Replace framework variables in route template with actual values and leave variable name
  • Leave dynamic variables as template style tokens

Request: (HTTP 200) http://example.org/weather/today/london
GET api/{controller=Weather}/{action=Today}/{location-id}

edit: or go with POST my-controller/update/{id?} and add http.route_template attribute. So span name is simple and clean. I think this seems better.

static assests:

  • Leave static asset path since they are mostly static
  • If template based routing is used, follow template based routing guidelines

Request: (HTTP 200) http://example.org/js/framework.js?v=abcde
GET /js/framework.js

invalid requests (HTTP 400-500):

  • different back-end providers may want to have different logic
  • different clients may want to have different logic (bots may cause high cardinality attacks)
  • use configuration to switch between verbose and basic name.

Request: HTTP 404 http://example.org/invalid-path
GET vs GET /invalid-path

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Need triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions