From 21dd60ba604b41a9ed3c8ce78aac6e3c2170c58b Mon Sep 17 00:00:00 2001 From: Hamas Shafiq Date: Fri, 2 Sep 2022 11:55:55 +0100 Subject: [PATCH] Tempo: Map the status tag to status.code for autocomplete (#54593) --- .../plugins/datasource/tempo/traceql/autocomplete.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/tempo/traceql/autocomplete.ts b/public/app/plugins/datasource/tempo/traceql/autocomplete.ts index 9b52a7c4eeb..a409d381884 100644 --- a/public/app/plugins/datasource/tempo/traceql/autocomplete.ts +++ b/public/app/plugins/datasource/tempo/traceql/autocomplete.ts @@ -72,6 +72,15 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP tags.forEach((t) => (this.tags[t] = new Set())); } + private overrideTagName(tagName: string): string { + switch (tagName) { + case 'status': + return 'status.code'; + default: + return tagName; + } + } + /** * Get suggestion based on the situation we are in like whether we should suggest tag names or values. * @param situation @@ -104,7 +113,8 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP type: 'OPERATOR' as CompletionType, })); case 'SPANSET_IN_VALUE': - return await this.languageProvider.getOptions(situation.tagName).then((res) => { + const tagName = this.overrideTagName(situation.tagName); + return await this.languageProvider.getOptions(tagName).then((res) => { const items: Completion[] = []; res.forEach((val) => { if (val?.label) {