mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
azuremonitor: don't use make for maps and array
This commit is contained in:
parent
0b74860f55
commit
ac345312a4
@ -41,7 +41,7 @@ var (
|
||||
// 3. parses the responses for each query into the timeseries format
|
||||
func (e *AzureMonitorDatasource) executeTimeSeriesQuery(ctx context.Context, originalQueries []*tsdb.Query, timeRange *tsdb.TimeRange) (*tsdb.Response, error) {
|
||||
result := &tsdb.Response{
|
||||
Results: make(map[string]*tsdb.QueryResult),
|
||||
Results: map[string]*tsdb.QueryResult{},
|
||||
}
|
||||
|
||||
queries, err := e.buildQueries(originalQueries, timeRange)
|
||||
@ -84,7 +84,7 @@ func (e *AzureMonitorDatasource) buildQueries(queries []*tsdb.Query, timeRange *
|
||||
azureMonitorTarget := query.Model.Get("azureMonitor").MustMap()
|
||||
azlog.Debug("AzureMonitor", "target", azureMonitorTarget)
|
||||
|
||||
urlComponents := make(map[string]string)
|
||||
urlComponents := map[string]string{}
|
||||
urlComponents["resourceGroup"] = fmt.Sprintf("%v", azureMonitorTarget["resourceGroup"])
|
||||
urlComponents["metricDefinition"] = fmt.Sprintf("%v", azureMonitorTarget["metricDefinition"])
|
||||
urlComponents["resourceName"] = fmt.Sprintf("%v", azureMonitorTarget["resourceName"])
|
||||
@ -247,7 +247,7 @@ func (e *AzureMonitorDatasource) parseResponse(queryRes *tsdb.QueryResult, data
|
||||
}
|
||||
|
||||
for _, series := range data.Value[0].Timeseries {
|
||||
points := make([]tsdb.TimePoint, 0)
|
||||
points := []tsdb.TimePoint{}
|
||||
|
||||
metadataName := ""
|
||||
metadataValue := ""
|
||||
|
@ -46,7 +46,7 @@ func (e *AzureMonitorExecutor) Query(ctx context.Context, dsInfo *models.DataSou
|
||||
var result *tsdb.Response
|
||||
var err error
|
||||
|
||||
azureMonitorQueries := make([]*tsdb.Query, 0)
|
||||
var azureMonitorQueries []*tsdb.Query
|
||||
|
||||
for _, query := range tsdbQuery.Queries {
|
||||
queryType := query.Model.Get("queryType").MustString("")
|
||||
|
@ -34,7 +34,7 @@ func (tg *TimeGrain) createISO8601DurationFromIntervalMS(interval int64) (string
|
||||
unit := formatted[len(formatted)-1:]
|
||||
|
||||
if unit == "s" && timeValue < 60 {
|
||||
// mimumum interval is 1m for Azure Monitor
|
||||
// minimum interval is 1m for Azure Monitor
|
||||
return "PT1M", nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user