-
Notifications
You must be signed in to change notification settings - Fork 125
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
Update span names for OpentelemetryPhoenix #433
base: main
Are you sure you want to change the base?
Conversation
I think this is a breaking change, right? To do that we need really good reason, like there being an Otel spec or semantic convention saying this is how to name them. Do you know of other implementations in other languages and what they use for such span names? Maybe based on that I could poke around about a semconv proposal to standardize this. |
Right, this is a breaking change, I've updated the issue to mention this thanks! This is LiveView specific though so there is no direct spec we can use for this, but this does conform to the general tendency in SemConv using the https://github.com/open-telemetry/semantic-conventions/blob/v1.27.0/docs/messaging/messaging-spans.md#span-name There are alternatives though like: https://github.com/open-telemetry/semantic-conventions/blob/v1.27.0/docs/rpc/rpc-spans.md#span-name Considering that LiveView is built on top of the |
And to expand on why adding the route to the span name; I'm adding the route template to the span name as it works better than just the live module. The live route is part of the Phoenix router, and you could use the same live module for multiple routes same way you can use the same controller for multiple routes. The entry point is actually the route rather than the live module (kinda, the devil is in the details). |
This is not a review but a general comment on this and a couple of the other PRs that are introducing dependencies on Phoenix, LiveView, etc. Our instrumentation libraries cannot include dependencies on the library being instrumented. There are a few reasons for this but as you come up with ideas or proposals just know that is a hard constraint. |
I assume you are talking about #439 that introduces it as a dep for the lib as this one only requires it for dev/test? (from #431 this is just stacked on top of that) As for #439 I would like to understand the reasons, is there some issue/doc to refer to? There are some of the existing instrumentation libraries that have direct dependencies currently: https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_oban/mix.exs#L47 And some libraries have other dependencies that are more loosely related: https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_cowboy/rebar.config#L3 For #439 I can maybe find a workaround, though I don't know if the compiler resolution is going to make it difficult, and it'll also loose the compiler checks that can report issues early on. But it could maybe be a utility library instead, or maybe more appropriate a propagator library e.g. |
Stacked on #431 which needs to get in first. Check the latest commit for the changes here.
I don't see any convention for how span names should be handled for websocket events other than maybe using the messaging namespace, but I think we want the structure to be more in line with how span names usually look:
{operation} {resource}
So instead of
MyAppWeb.ResourceLive.Show.mount
it becomeslive_view.mount /resources/:resource_id
(for events it'll belive_view.handle_event /resources/:resource_id hello
.This is a breaking change.
Changes
{live_view_module}.{handler_function}
tolive_view.#{handler_function} {route}
{live_view_module}.handle_event {event}
tolive_view.handle_event {route} {event}