Skip to content

Do not recommend URL path as acceptable span name #270

@yurishkuro

Description

@yurishkuro

https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-semantic-conventions.md says

Given an RFC 3986 compliant URI of the form scheme:[//authority]path[?query][#fragment], the span name of the span SHOULD be set to to the URI path value.

I think this is a very bad recommendation. In many REST APIs it is customary to encode entity IDs in the path, such as /api/customer/23476253654/address/237464. Using this as a span name creates very high cardinality set and defeats the purpose of span name identifying the type of operation in a service rather than a specific instance of the operation.

Proposal: change the spec per the following:

For server endpoints the OpenTracing spec recommended using the "route", which could look like /api/customer/{custId}/address/{addrId} (literally). This gives a stable, immutable string identifying the endpoint/operation.

For client spans, it is usually difficult for instrumentation to have access to similarly stable string, because all you often get is a URL. At the same time, the name of the client span is usually far less important, since there's always a corresponding well-defined server-side name. So using HTTP method could be enough as client span name. Some instrumentation libraries allow configuring span name extractor, where business logic can be added to the application to match the URL to a stable string, or perhaps pull some extra data from the request or headers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions