-
Notifications
You must be signed in to change notification settings - Fork 692
[TraceQL] Add support for querying by instrumentation scope #3967
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
633deeb
lexer
ie-pham 634b60f
blocktraceql
ie-pham 581fed2
autocomplete
ie-pham 77d5445
changelog
ie-pham 23a9ecb
lint
ie-pham ca661f9
fix test
ie-pham 28160ba
scope => instrumentation
ie-pham 992ed0f
lint
ie-pham 01da898
scopescope byebye
ie-pham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -94,6 +94,8 @@ The following table shows the current available scoped intrinsic fields: | |||||
| | `event:timeSinceStart` | duration | time of event in relation to the span start time | `{ event:timeSinceStart > 2ms}` | | ||||||
| | `link:spanID` | string | link span id using hex string | `{ link:spanID = "0000000000000001" }` | | ||||||
| | `link:traceID` | string | link trace id using hex string | `{ link:traceID = "1234567890abcde" }` | | ||||||
| | `scope:name` | string | instrumentation scope name | `{ scope:name = "grpc" }` | | ||||||
| | `scope:version` | string | instrumentation scope version | `{ scope:version = "1.0.0.0" }` | | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was one
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch! |
||||||
|
|
||||||
| `trace:duration`, `trace:rootName`, and `trace:rootService` are trace-level intrinsics and are the same for all spans in the same trace. | ||||||
| Additionally, these intrinsics are significantly more performant because they have to inspect much less data then a span-level intrinsic. | ||||||
|
|
@@ -111,7 +113,7 @@ This example searches all Kubernetes clusters called `service-name` that have a | |||||
|
|
||||||
| ### Attribute fields | ||||||
|
|
||||||
| TraceQL has four different attribute scopes: span attributes, resource attributes, event attributes, and link attributes. By expanding a span in the Grafana UI, you can see both its span attributes (1 in the screenshot) and resource attributes (2 in the screenshot). | ||||||
| TraceQL has five different attribute scopes: span attributes, resource attributes, event attributes, link attributes, instrumentation scope attributes. By expanding a span in the Grafana UI, you can see both its span attributes (1 in the screenshot) and resource attributes (2 in the screenshot). | ||||||
|
ie-pham marked this conversation as resolved.
|
||||||
|
|
||||||
| <p align="center"><img src="assets/span-resource-attributes.png" alt="Example of span and resource attributes." /></p> | ||||||
|
|
||||||
|
|
@@ -148,6 +150,11 @@ You can search for an attribute in your link: | |||||
| { link.opentracing.ref_type = "child_of" } | ||||||
| ``` | ||||||
|
|
||||||
| Find instrumentation scope programming language: | ||||||
| ``` | ||||||
| { scope.language = "java" } | ||||||
| ``` | ||||||
|
|
||||||
| ### Unscoped attribute fields | ||||||
|
|
||||||
| Attributes can be unscoped if you are unsure if the requested attribute exists on the span or resource. | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I thought the thing at the left of
:was a scope , i.e.linkis a possible value for scope.So is very confusing for me that this is called
scope, shouldn't it be calledinstrumentation?instrumentation:nameinstrumentation:versionmore clearly define what this points at IMHOUh oh!
There was an error while loading. Please reload this page.
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.
this is a good call out. we have discussed this with our internal team and they believe that otel does not see this as an instrumentation only field. it just happens to be used that way and they intend for it to be used as a more generic "scope" long term.
agree that scope scope is strange. let me summon @jpkrohling. he may have more insight.
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.
Are end-users exposed to "scope scope"? As an OTel user, I immediately thought of InstrumentationScope when I saw "scope:name" here. Unless there's an explicit source of confusion, I'd keep "scope:name".
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.
Not directly although there may be some awkward wording in the docs.
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.
Personally
scope:nameis a generic term that says nothing to me.I can imagine for people better versed in opentelemetry parlance it is very obvious.
I am very sure that around here I will need to tell people that "scope:name means the name of the instrumentation/area that created the span". or such explanation as I do not think it is clear to more casual users of observability tools.
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.
Would it help to have these differences called out in the doc to avoid confusion? Or would that just create more confusion?
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.
Docs will definitely need to be there.
When someone reads a query or an autocomplete with
span:duration, that person needs to know almost nothing about tracing to understand what that would mean, without resorting to reading documentation.I think when someone reads
scope:namethat person will definitely need to go to documentation to know what would that mean.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.
Other than the number of keyboard touches, I have no strong preferences for
scopevs.instrumentation. They are both technically correct. Ifinstrumentationis more intuitive to the audience, that certainly wins overscope.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.
@jcarres-mdsol thank you for pointing this out. I've changed the syntax to
instrumentation:nameandinstrumentation:version🚀