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
pull/62114/head
Andre Pereira 2 years ago committed by GitHub
parent ce5e067d28
commit b78af0b0f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      public/app/plugins/datasource/tempo/QueryEditor/TagsField/TagsField.tsx
  2. 5
      public/app/plugins/datasource/tempo/traceql/TraceQLEditor.tsx

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

Loading…
Cancel
Save