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

TraceQL - Add support for scoped intrinsics using : #3629

Merged
merged 6 commits into from May 3, 2024

Conversation

ie-pham
Copy link
Collaborator

@ie-pham ie-pham commented Apr 30, 2024

What this PR does: Add support for scoped intrinsics using :. Users can now make queries like so: {span:duration > 100ms}. Which is different from {span.duration > 100ms} as the : signifies that we are looking at the duration of the span where as the . will signify that it is an attribute name duration of a span.

This is the change will allow us to additionally features to Traceql like trace:id and link:spanId in the future.

Screenshot 2024-04-30 at 7 20 51 PM
Screenshot 2024-04-30 at 7 19 33 PM

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@ie-pham ie-pham changed the title [WIP] Colon TraceQL - Add support for scoped intrinsics using : May 1, 2024
@@ -95,6 +95,22 @@ these intrinsics are significantly more performant because they have to inspect
possible to span-level intrinsics.
{{% /admonition %}}

### Scoped Intrinsic Fields
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this to sentence case to match our style

Suggested change
### Scoped Intrinsic Fields
### Scoped intrinsic fields

Copy link
Member

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good! a few comments but this is close to mergeable.

after this is merged please also file an issue in github.com/grafana/grafana requesting support for the new intrinsics. let me know and i will help you tag it correctly.

docs/sources/tempo/traceql/_index.md Show resolved Hide resolved
// trace:
TRACE_COLON IDURATION { $$ = NewIntrinsic(IntrinsicTraceDuration) }
| TRACE_COLON ROOTNAME { $$ = NewIntrinsic(IntrinsicTraceRootSpan) }
| TRACE_COLON ROOTSERVICENAME { $$ = NewIntrinsic(IntrinsicTraceRootService) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg/traceql/ast.go Show resolved Hide resolved
pkg/traceql/parse_test.go Show resolved Hide resolved
pkg/traceql/test_examples.yaml Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
@ie-pham ie-pham requested a review from joe-elliott May 2, 2024 14:59
Copy link
Member

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asking for one small comment added, but otherwise lgtm.

great work!

@@ -167,8 +170,9 @@ selectOperation:
;

attribute:
intrinsicField { $$ = $1 }
| attributeField { $$ = $1 }
intrinsicField { $$ = $1 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a comment above the intrinsicField definition that we are no longer adding these?

@ie-pham ie-pham merged commit 854caca into grafana:main May 3, 2024
15 checks passed
joe-elliott pushed a commit to joe-elliott/tempo that referenced this pull request May 7, 2024
* add scoped intrinsics support :

* lint

* test & changelog

* more test & changelog & doc

* rename

* add comment
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

Successfully merging this pull request may close these issues.

None yet

3 participants