Azuremonitor: do not set unit if literal "Unspecified" (#26839)

part of #26828
This commit is contained in:
Kyle Brandt 2020-08-06 16:03:25 -04:00 committed by GitHub
parent 8107e735c1
commit 62b103b843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -293,9 +293,11 @@ func (e *AzureMonitorDatasource) parseResponse(queryRes *tsdb.QueryResult, amr A
dataField := frame.Fields[1]
dataField.Name = amr.Value[0].Name.LocalizedValue
dataField.Labels = labels
dataField.SetConfig(&data.FieldConfig{
Unit: toGrafanaUnit(amr.Value[0].Unit),
})
if amr.Value[0].Unit != "Unspecified" {
dataField.SetConfig(&data.FieldConfig{
Unit: toGrafanaUnit(amr.Value[0].Unit),
})
}
if query.Alias != "" {
dataField.Config.DisplayName = formatAzureMonitorLegendKey(query.Alias, query.UrlComponents["resourceName"],
amr.Value[0].Name.LocalizedValue, "", "", amr.Namespace, amr.Value[0].ID, labels)