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
This commit is contained in:
Andre Pereira 2023-02-02 15:43:28 +00:00 committed by GitHub
parent ce5e067d28
commit b78af0b0f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -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) {

View File

@ -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) {