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

Span name should match other implementations #5487

Open
Andersclark opened this issue Feb 19, 2025 · 1 comment
Open

Span name should match other implementations #5487

Andersclark opened this issue Feb 19, 2025 · 1 comment

Comments

@Andersclark
Copy link

Andersclark commented Feb 19, 2025

Problem

In this implementation, a span is given the name of HTTP ${METHOD}, whereas when looking at spans from other sources, such as Dotnet, name has the format of ${METHOD} ${PATH} making it possible to distinguish requests from each other in an overview of traces.

In the image: Yellow traces are sourced from a Dotnet backend. Cyan traces comes from FetchInstrumentation:

Image

Suggested solution

A simple solution with breaking change: Decorate Span name with Request-URL:s path.

A generic solution with no breaking change: Add an optional property to the FetchInstrumentationConfig which is a function working similarly to the applyCustomAttributesOnSpan property, but accepts the name as an argument and returns a new name.

new FetchInstrumentation({
    decorateSpanName: (name: string, req: Request, res: Response) => string,

})
@raphael-theriault-swi
Copy link
Member

You're correct that the span name shouldn't be prefixed with HTTP, but for client spans the behaviour of not including the target is correct, since that could result in a pretty high cardinality of span names. .

https://opentelemetry.io/docs/specs/semconv/http/http-spans/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants