Tempo: Support comments in TraceQL (#77646)

This commit is contained in:
Fabrizio
2023-11-07 11:27:03 +01:00
committed by GitHub
parent 39014e73f7
commit f19830b543
4 changed files with 15 additions and 7 deletions

View File

@@ -76,6 +76,10 @@ describe('Check for syntax errors in query', () => {
['{true} << {true}'],
['{true} !>> {true}'],
['{true} !<< {true}'],
[
`{ true } /* && { false } && */ && { true } // && { false }
&& { true }`,
],
])('valid query - %s', (query: string) => {
expect(getErrorNodes(query)).toStrictEqual([]);
});

View File

@@ -63,6 +63,10 @@ export const language: languages.IMonarchLanguage = {
tokenizer: {
root: [
// comments
[/\/\/.*/, 'comment'], // line comment
[/\/\*.*\*\//, 'comment'], // block comment
// durations
[/[0-9]+(.[0-9]+)?(us|µs|ns|ms|s|m|h)/, 'number'],
@@ -138,7 +142,7 @@ export const languageDefinition = {
export const traceqlGrammar: Grammar = {
comment: {
pattern: /#.*/,
pattern: /\/\/.*/,
},
'span-set': {
pattern: /\{[^}]*}/,