Skip to content

TraceQL - Add support for scoped intrinsics using : - #3629

Merged
ie-pham merged 6 commits into
grafana:mainfrom
ie-pham:colon
May 3, 2024
Merged

TraceQL - Add support for scoped intrinsics using :#3629
ie-pham merged 6 commits into
grafana:mainfrom
ie-pham:colon

Conversation

@ie-pham

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

Copy link
Copy Markdown
Contributor

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 May 1, 2024
@ie-pham
ie-pham marked this pull request as ready for review May 1, 2024 01:36
Comment thread docs/sources/tempo/traceql/_index.md Outdated
possible to span-level intrinsics.
{{% /admonition %}}

### Scoped Intrinsic Fields

Copy link
Copy Markdown
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

@joe-elliott joe-elliott left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread docs/sources/tempo/traceql/_index.md
Comment thread pkg/traceql/expr.y Outdated
// trace:
TRACE_COLON IDURATION { $$ = NewIntrinsic(IntrinsicTraceDuration) }
| TRACE_COLON ROOTNAME { $$ = NewIntrinsic(IntrinsicTraceRootSpan) }
| TRACE_COLON ROOTSERVICENAME { $$ = NewIntrinsic(IntrinsicTraceRootService) }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comment thread pkg/traceql/ast.go
Comment thread pkg/traceql/parse_test.go
Comment thread pkg/traceql/test_examples.yaml
Comment thread CHANGELOG.md
@ie-pham
ie-pham requested a review from joe-elliott May 2, 2024 14:59

@joe-elliott joe-elliott left a comment

Copy link
Copy Markdown
Collaborator

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!

Comment thread pkg/traceql/expr.y
attribute:
intrinsicField { $$ = $1 }
| attributeField { $$ = $1 }
intrinsicField { $$ = $1 }

Copy link
Copy Markdown
Collaborator

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
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
mattdurham pushed a commit to mattdurham/tempo that referenced this pull request Jun 18, 2026
* 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

3 participants