Commit f9f60c91 by Kyle Brandt Committed by GitHub

AzureMonitor: map more units (#26990)

add BitsPerSecond and Seconds
parent c63bbbae
...@@ -390,23 +390,30 @@ func formatAzureMonitorLegendKey(alias string, resourceName string, metricName s ...@@ -390,23 +390,30 @@ func formatAzureMonitorLegendKey(alias string, resourceName string, metricName s
} }
// Map values from: // Map values from:
// https://docs.microsoft.com/en-us/azure/azure-monitor/platform/metrics-supported#microsoftanalysisservicesservers // https://docs.microsoft.com/en-us/rest/api/monitor/metrics/list#unit
// to // to
// https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/valueFormats/categories.ts#L24 // https://github.com/grafana/grafana/blob/master/packages/grafana-data/src/valueFormats/categories.ts#L24
func toGrafanaUnit(unit string) string { func toGrafanaUnit(unit string) string {
switch unit { switch unit {
case "Percent": case "BitsPerSecond":
return "percent" return "bps"
case "Count":
return "short" // this is used for integers
case "Bytes": case "Bytes":
return "decbytes" // or ICE return "decbytes" // or ICE
case "BytesPerSecond": case "BytesPerSecond":
return "Bps" return "Bps"
case "Count":
return "short" // this is used for integers
case "CountPerSecond": case "CountPerSecond":
return "cps" return "cps"
case "Percent":
return "percent"
case "Milliseconds": case "Milliseconds":
return "ms" return "ms"
case "Seconds":
return "s"
} }
return unit // this will become a suffix in the display return unit // this will become a suffix in the display
// "ByteSeconds", "Cores", "MilliCores", and "NanoCores" all both:
// 1. Do not have a corresponding unit in Grafana's current list.
// 2. Do not have the unit listed in any of Azure Monitor's supported metrics anyways.
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment