Tempo: Add support for structural operators (#104400)

Add support for structural operators
pull/104819/head
Joey 3 weeks ago committed by GitHub
parent ba6d0f59ff
commit 3773429d10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      public/app/plugins/datasource/tempo/package.json
  2. 73
      public/app/plugins/datasource/tempo/traceql/autocomplete.ts
  3. 10
      yarn.lock

@ -7,7 +7,7 @@
"@emotion/css": "11.13.5",
"@grafana/data": "workspace:*",
"@grafana/e2e-selectors": "workspace:*",
"@grafana/lezer-traceql": "0.0.21",
"@grafana/lezer-traceql": "0.0.22",
"@grafana/monaco-logql": "^0.0.8",
"@grafana/o11y-ds-frontend": "workspace:*",
"@grafana/plugin-ui": "0.10.5",

@ -128,6 +128,7 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP
detail: 'Negated regular expression',
},
];
// https://grafana.com/docs/tempo/latest/traceql/#structural
static readonly structuralOps: MinimalCompletionItem[] = [
{
label: '>>',
@ -164,6 +165,78 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP
documentation:
'Sibling operator. Checks that spans matching {condA} and {condB} are siblings of the same parent span.',
},
// Union structural operators
{
label: '&>>',
insertText: '&>>',
detail: 'Union Descendant',
documentation:
'The descendant operator (>>) looks for spans matching {condB} that are descendants of a span matching {condA}',
},
{
label: '&>',
insertText: '&>',
detail: 'Union Child',
documentation:
'The child operator (>) looks for spans matching {condB} that are direct child spans of a parent matching {condA}',
},
{
label: '&<<',
insertText: '&<<',
detail: 'Union Ancestor',
documentation:
'The ancestor operator (<<) looks for spans matching {condB} that are ancestor of a span matching {condA}',
},
{
label: '&<',
insertText: '&<',
detail: 'Union Parent',
documentation:
'The parent operator (<) looks for spans matching {condB} that are direct parent spans of a child matching {condA}',
},
{
label: '&~',
insertText: '&~',
detail: 'Union Sibling',
documentation:
'The sibling operator (~) looks at spans matching {condB} that have at least one sibling matching {condA}',
},
// Negated structural operators
{
label: '!>>',
insertText: '!>>',
detail: 'Not Descendant',
documentation:
'The not-descendant operator (!>>) looks for spans matching {condB} that are not descendant spans of a parent matching {condA}',
},
{
label: '!>',
insertText: '!>',
detail: 'Not Child',
documentation:
'The not-child operator (!>) looks for spans matching {condB} that are not direct child spans of a parent matching {condA}',
},
{
label: '!<<',
insertText: '!<<',
detail: 'Not Ancestor',
documentation:
'The not-ancestor operator (!<<) looks for spans matching {condB} that are not ancestor spans of a child matching {condA}',
},
{
label: '!<',
insertText: '!<',
detail: 'Not Parent',
documentation:
'The not-parent operator (!<) looks for spans matching {condB} that are not direct parent spans of a child matching {condA}',
},
{
label: '!~',
insertText: '!~',
detail: 'Not Sibling',
documentation:
'The not-sibling operator (!~) looks for spans matching {condB} that do not have at least one sibling matching {condA}',
},
];
static readonly spansetOps: MinimalCompletionItem[] = [

@ -2823,7 +2823,7 @@ __metadata:
"@emotion/css": "npm:11.13.5"
"@grafana/data": "workspace:*"
"@grafana/e2e-selectors": "workspace:*"
"@grafana/lezer-traceql": "npm:0.0.21"
"@grafana/lezer-traceql": "npm:0.0.22"
"@grafana/monaco-logql": "npm:^0.0.8"
"@grafana/o11y-ds-frontend": "workspace:*"
"@grafana/plugin-configs": "npm:12.1.0-pre"
@ -3178,12 +3178,12 @@ __metadata:
languageName: node
linkType: hard
"@grafana/lezer-traceql@npm:0.0.21":
version: 0.0.21
resolution: "@grafana/lezer-traceql@npm:0.0.21"
"@grafana/lezer-traceql@npm:0.0.22":
version: 0.0.22
resolution: "@grafana/lezer-traceql@npm:0.0.22"
peerDependencies:
"@lezer/lr": ^1.4.2
checksum: 10/de27346b3f7e45cc10fae18e7172c7686a10d6979b057a33e72f3d4aeca498b7c5ba80202f1e59207f417b69c3f1703bef313dbde155b7a6ee211726d665f085
checksum: 10/e7f640e902d0738c72950a7584b5ceed68114582eb9c33546bf3fbc938baf7a460b93cd9b90e65a0d8f16a3870ecc282c6ecc12a6c321232247abc05111662df
languageName: node
linkType: hard

Loading…
Cancel
Save