Tempo: Upgrade @grafana/lezer-traceql patch version to use trace metrics syntax (#82532)

* Upgrade patch version

* Update autocomplete/highlighting to be more specific

* Update test
This commit is contained in:
Joey 2024-02-16 11:17:41 +00:00 committed by GitHub
parent df8250ff48
commit 1744487487
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 24 additions and 9 deletions

View File

@ -9,7 +9,7 @@
"@grafana/e2e-selectors": "workspace:*",
"@grafana/experimental": "1.7.10",
"@grafana/lezer-logql": "0.2.3",
"@grafana/lezer-traceql": "0.0.14",
"@grafana/lezer-traceql": "0.0.15",
"@grafana/monaco-logql": "^0.0.7",
"@grafana/o11y-ds-frontend": "workspace:*",
"@grafana/runtime": "workspace:*",

View File

@ -126,8 +126,8 @@ describe('Highlighting', () => {
['{.foo=1} | avg(.foo) > ', 'Invalid value after comparison operator.'],
['{.foo=1} | avg() < 1s', 'Invalid expression for aggregator operator.'],
['{.foo=1} | max() = 3', 'Invalid expression for aggregator operator.'],
['{.foo=1} | by()', 'Invalid expression for aggregator operator.'],
['{.foo=1} | select()', 'Invalid expression for aggregator operator.'],
['{.foo=1} | by()', 'Invalid expression for by operator.'],
['{.foo=1} | select()', 'Invalid expression for select operator.'],
['{foo}', 'Invalid expression for spanset.'],
['{.}', 'Invalid expression for spanset.'],
['{ resource. }', 'Invalid expression for spanset.'],

View File

@ -7,6 +7,7 @@ import {
ComparisonOp,
FieldExpression,
FieldOp,
GroupOperation,
Identifier,
IntrinsicField,
Or,
@ -16,6 +17,7 @@ import {
Resource,
ScalarExpression,
ScalarFilter,
SelectOperation,
Span,
SpansetFilter,
SpansetPipelineExpression,
@ -57,6 +59,10 @@ export const computeErrorMessage = (errorNode: SyntaxNode) => {
case IntrinsicField:
case Aggregate:
return 'Invalid expression for aggregator operator.';
case GroupOperation:
return 'Invalid expression for by operator.';
case SelectOperation:
return 'Invalid expression for select operator.';
case AttributeField:
return 'Invalid expression for spanset.';
case ScalarFilter:

View File

@ -14,6 +14,7 @@ import {
Pipe,
ScalarFilter,
SelectArgs,
SelectOperation,
SpansetFilter,
SpansetPipeline,
SpansetPipelineExpression,
@ -213,6 +214,14 @@ const RESOLVERS: Resolver[] = [
path: [ERROR_NODE_ID, IntrinsicField],
fun: resolveAttributeForFunction,
},
{
path: [ERROR_NODE_ID, GroupOperation],
fun: resolveAttributeForFunction,
},
{
path: [ERROR_NODE_ID, SelectOperation],
fun: resolveAttributeForFunction,
},
{
path: [ERROR_NODE_ID, SpansetPipelineExpression],
fun: resolveSpansetPipeline,
@ -422,7 +431,7 @@ function resolveNewSpansetExpression(node: SyntaxNode, text: string, offset: num
function resolveAttributeForFunction(node: SyntaxNode, _0: string, _1: number): SituationType | void {
const parent = node?.parent;
if (!!parent && [IntrinsicField, Aggregate, GroupOperation, SelectArgs].includes(parent.type.id)) {
if (!!parent && [IntrinsicField, Aggregate, GroupOperation, SelectOperation, SelectArgs].includes(parent.type.id)) {
return {
type: 'ATTRIBUTE_FOR_FUNCTION',
};

View File

@ -3433,7 +3433,7 @@ __metadata:
"@grafana/e2e-selectors": "workspace:*"
"@grafana/experimental": "npm:1.7.10"
"@grafana/lezer-logql": "npm:0.2.3"
"@grafana/lezer-traceql": "npm:0.0.14"
"@grafana/lezer-traceql": "npm:0.0.15"
"@grafana/monaco-logql": "npm:^0.0.7"
"@grafana/o11y-ds-frontend": "workspace:*"
"@grafana/plugin-configs": "npm:10.4.0-pre"
@ -3809,12 +3809,12 @@ __metadata:
languageName: node
linkType: hard
"@grafana/lezer-traceql@npm:0.0.14":
version: 0.0.14
resolution: "@grafana/lezer-traceql@npm:0.0.14"
"@grafana/lezer-traceql@npm:0.0.15":
version: 0.0.15
resolution: "@grafana/lezer-traceql@npm:0.0.15"
peerDependencies:
"@lezer/lr": ^1.3.0
checksum: 10/5ff0e2e6fa8d042f377046cc4aab95d46ca61f12da4bf1ba8f75c228c841072838c157233fb3f2a9ddc6be63df6e31ab8116738b2ae6bc69e8e122f3a061de2a
checksum: 10/fddf0958c3e01ef55810916f6d57de5b1b0658573faf15264b862c963b83102cb530991bef16649daa7a51f6e62e45e61dd9be9dd9d00817fd5ea12f50876a8c
languageName: node
linkType: hard