[v9.4.x] Tempo: Inject status and status.code for tags autocomplete (#62800)

Tempo: Inject status and status.code for tags autocomplete (#62794)

* Tempo: Inject status for v2 and status.code for v1 in the tags list for autocomplete

* Small comment fix

(cherry picked from commit b78af0b0f0)

Co-authored-by: Andre Pereira <adrapereira@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2023-02-02 15:53:17 +00:00
committed by GitHub
co-authored by Andre Pereira
parent bfe6b520d7
commit d8f757cb8c
2 changed files with 10 additions and 0 deletions
@@ -121,6 +121,11 @@ function useAutocomplete(datasource: TempoDatasource) {
const tags = datasource.languageProvider.getTags();
if (tags) {
// This is needed because the /api/search/tag/${tag}/values API expects "status.code" and the v2 API expects "status"
// so Tempo doesn't send anything and we inject it here for the autocomplete
if (!tags.find((t) => t === 'status.code')) {
tags.push('status.code');
}
providerRef.current.setTags(tags);
}
} catch (error) {
@@ -148,6 +148,11 @@ function useAutocomplete(datasource: TempoDatasource) {
const tags = datasource.languageProvider.getTags();
if (tags) {
// This is needed because the /api/v2/search/tag/${tag}/values API expects "status" and the v1 API expects "status.code"
// so Tempo doesn't send anything and we inject it here for the autocomplete
if (!tags.find((t) => t === 'status')) {
tags.push('status');
}
providerRef.current.setTags(tags);
}
} catch (error) {