mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 01:23:32 -06:00
azuremonitor: small refactoring
This commit is contained in:
parent
60327953a2
commit
d6904ba9b4
@ -285,6 +285,9 @@ func (e *AzureMonitorDatasource) parseResponse(queryRes *tsdb.QueryResult, data
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// findClosestAllowedIntervalMs is used for the auto time grain setting.
|
||||||
|
// It finds the closest time grain from the list of allowed time grains for Azure Monitor
|
||||||
|
// using the Grafana interval in milliseconds
|
||||||
func (e *AzureMonitorDatasource) findClosestAllowedIntervalMs(intervalMs int64) int64 {
|
func (e *AzureMonitorDatasource) findClosestAllowedIntervalMs(intervalMs int64) int64 {
|
||||||
closest := allowedIntervalsMS[0]
|
closest := allowedIntervalsMS[0]
|
||||||
|
|
||||||
@ -299,3 +302,11 @@ func (e *AzureMonitorDatasource) findClosestAllowedIntervalMs(intervalMs int64)
|
|||||||
}
|
}
|
||||||
return closest
|
return closest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// formatLegendKey builds the legend key or timeseries name
|
||||||
|
func formatLegendKey(resourceName string, metricName string, metadataName string, metadataValue string) string {
|
||||||
|
if len(metadataName) > 0 {
|
||||||
|
return fmt.Sprintf("%s{%s=%s}.%s", resourceName, metadataName, metadataValue, metricName)
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s.%s", resourceName, metricName)
|
||||||
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
package azuremonitor
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
// formatLegendKey builds the legend key or timeseries name
|
|
||||||
func formatLegendKey(resourceName string, metricName string, metadataName string, metadataValue string) string {
|
|
||||||
if len(metadataName) > 0 {
|
|
||||||
return fmt.Sprintf("%s{%s=%s}.%s", resourceName, metadataName, metadataValue, metricName)
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%s.%s", resourceName, metricName)
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user