-
Notifications
You must be signed in to change notification settings - Fork 539
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
chore(graphql): update span name to show the resolver name #1796
chore(graphql): update span name to show the resolver name #1796
Conversation
0f4c241
to
2fe1471
Compare
Not sure who to ping here for visibility, cc @blumamir |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1796 +/- ##
==========================================
- Coverage 91.42% 91.00% -0.43%
==========================================
Files 143 133 -10
Lines 7303 6580 -723
Branches 1461 1311 -150
==========================================
- Hits 6677 5988 -689
+ Misses 626 592 -34
|
2fe1471
to
633f733
Compare
b4b8beb
to
a92bfc4
Compare
Rebased and fixed linter issues |
Looks like there's no code owner for these files. @open-telemetry/javascript-approvers please take a look if you have time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To my understanding this doesn't fit the graphql semantic conventions.
I guess first step here should be a PR on the semantic-conventions repo to get consensus if this is wanted or not.
@Flarna I didn't understand why it doesn't fit, here we are updating the resolver part (inside of a query or mutation). That link refers to |
It looks like there is no resolver in the semconv. It might be worth opening a semconv issue or PR to cover this area to ensure all languages are handling it the same way. Do we know if other languages have instrumentations for graphql and how they're handling this? |
Ah ok sorry. Seems I lack graphql knowledge. But I agree with @dyladan that a spec improvement might make sense if this is something other languages have also to keep consistency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as the names fit to the general span requirements it should be fine I think.
I agree. I'm not a graphql expert but I think this fits the requirement to be limited cardinality and should be fine. In any case it can't be higher cardinality than the attribute which should also be limited.
@jcarres-mdsol I have to disagree. The document you linked lists examples of good and bad values in regards to cardinality. With this PR, the span name is no longer a generic name, increasing cardinality but it doesn’t include any dynamic identifier, such as a user id, which would violate the rules set in the document. I would argue that having Now span names in graphql resolvers are identifiable and we can make aggregations on which ones are slower etc, much like you have different span names for different functions etc. If this raises concerns about performance or other issues, perhaps this could be under an option. |
We have solved this with a regex in the collector. The original operation names are something like x.y.z.a.b , it is true it is not infinite like if they were UUIDs or something but still 10s/100s of 1000s. So we have regex this to x.y this is enough in our case to identify it enough, also the whole path is keep in an attribute anyways. |
BEGIN_COMMIT_OVERRIDE
feat!(graphql): update span name to show the resolver name
END_COMMIT_OVERRIDE
Which problem is this PR solving?
Fixes #1791
Short description of the changes
This PR updates (opentelemetry-instrumentation-graphql) the resolvers' span name.
It will show something like:
graphql-resolve hello
instead ofgraphql-resolve
. This is very useful to easily understand at a top level which field is being resolved.E.g.,