From 51cc8f6c3fe373e5de4c15d26eac96f57d36da78 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 18:18:25 +0200 Subject: [PATCH] [v10.2.x] Tempo: Fix cache in TraceQL editor (#79471) Tempo: Fix cache in TraceQL editor (#79468) Fix 77380 (cherry picked from commit 70b980e47f8c2b846d60015d60ad1b7126808a67) Co-authored-by: Andre Pereira (cherry picked from commit cd3dbc81f71e386773ad9289c9311e96b59a6c88) --- .../app/plugins/datasource/tempo/traceql/autocomplete.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/tempo/traceql/autocomplete.ts b/public/app/plugins/datasource/tempo/traceql/autocomplete.ts index 9d98bab5037..b843bb385c2 100644 --- a/public/app/plugins/datasource/tempo/traceql/autocomplete.ts +++ b/public/app/plugins/datasource/tempo/traceql/autocomplete.ts @@ -282,12 +282,13 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP private async getTagValues(tagName: string, query: string): Promise>> { let tagValues: Array>; + const cacheKey = `${tagName}:${query}`; - if (this.cachedValues.hasOwnProperty(tagName)) { - tagValues = this.cachedValues[tagName]; + if (this.cachedValues.hasOwnProperty(cacheKey)) { + tagValues = this.cachedValues[cacheKey]; } else { tagValues = await this.languageProvider.getOptionsV2(tagName, query); - this.cachedValues[tagName] = tagValues; + this.cachedValues[cacheKey] = tagValues; } return tagValues; }