GithubHelp home page GithubHelp logo

OTel: add method to span name about contrib HOT 10 CLOSED

gofiber avatar gofiber commented on August 11, 2024
OTel: add method to span name

from contrib.

Comments (10)

WLun001 avatar WLun001 commented on August 11, 2024

@morigs I think do not need to set method name to span name, as the attributes already set. It works fine with Tracing service
image

from contrib.

morigs avatar morigs commented on August 11, 2024

@WLun001 on your screenshot, there is method name in span name. Is it from the instrumentation from this repo? Because I cannot find where it adds method to span name

from contrib.

WLun001 avatar WLun001 commented on August 11, 2024

the method name adds from here, not from span name

semconv.HTTPMethodKey.String(c.Method()),

from contrib.

morigs avatar morigs commented on August 11, 2024

What tracing tool do you use? For example, Jaeger groups all spans in "operations" by span names. This means that all spans with name "/users/id" will be in one operation, even if they have different attributes. This is confusing and complicates search

from contrib.

WLun001 avatar WLun001 commented on August 11, 2024

I am testing with https://uptrace.dev/, could you share your screenshot with Jaeger? I never use it before

from contrib.

morigs avatar morigs commented on August 11, 2024

@WLun001 In Jaeger it looks like this. As you can see, there is no method in operation name. So all paths with different methods are grouped together

image

from contrib.

WLun001 avatar WLun001 commented on August 11, 2024

@morigs I think we can do something like this to allow custom format. What do you think?

https://github.com/open-telemetry/opentelemetry-go-contrib/blob/7e31ebe040306aee2c826972269f938f9f0e7c34/instrumentation/net/http/otelhttp/config.go#L175

from contrib.

morigs avatar morigs commented on August 11, 2024

@WLun001 sounds good. However, I think that span name should include method name by default, because Jaeger is very popular and other tracing systems works similarly.
Span name should specific enough to identify specific operation. OpenTelemetry semantic conventions mention this as a best practice.

from contrib.

WLun001 avatar WLun001 commented on August 11, 2024

@morigs not sure if we should do that. If you look at current implementation, they did not include method name
https://github.com/open-telemetry/opentelemetry-go-contrib/tree/7e31ebe040306aee2c826972269f938f9f0e7c34/instrumentation

from contrib.

morigs avatar morigs commented on August 11, 2024

@WLun001
Not really. otelhttp.NewHandler accepts user-specified name of the span through operation parameter. So it's up to the user to specify a name that specific enough to identify the handler.
For example, I can use it this way: otelhttp.NewHandler(postHandler, "create-enitity") and otelhttp.NewHandler(deleteHandler, "delete-enitity").
However, gofiber instrumentation doesn't require operation name, it sets the name to the route path by default, what causes problems.
Spec describes recommended span names. Example from spec: get_account, not just account.
I understand your point, just making my point clear. If you think that custom formatter will be enough, well, OK. That solves the problem, that's what matters.

from contrib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.