mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
AzureMonitor: Fix missing top parameter when dimensions are set (#47010)
This commit is contained in:
parent
7d2476d045
commit
48113beeeb
@ -127,7 +127,9 @@ func (e *AzureMonitorDatasource) buildQueries(queries []backend.DataQuery, dsInf
|
||||
|
||||
if dimSB.String() != "" {
|
||||
params.Add("$filter", dimSB.String())
|
||||
params.Add("top", azJSONModel.Top)
|
||||
if azJSONModel.Top != "" {
|
||||
params.Add("top", azJSONModel.Top)
|
||||
}
|
||||
}
|
||||
|
||||
target = params.Encode()
|
||||
|
@ -116,6 +116,17 @@ func TestAzureMonitorBuildQueries(t *testing.T) {
|
||||
expectedInterval: "PT1M",
|
||||
azureMonitorQueryTarget: "%24filter=blob+eq+%27%2A%27+and+tier+eq+%27%2A%27&aggregation=Average&api-version=2018-01-01&interval=PT1M&metricnames=Percentage+CPU&metricnamespace=Microsoft.Compute-virtualMachines×pan=2018-03-15T13%3A00%3A00Z%2F2018-03-15T13%3A34%3A00Z&top=30",
|
||||
},
|
||||
{
|
||||
name: "has a dimension filter without specifying a top",
|
||||
azureMonitorVariedProperties: map[string]interface{}{
|
||||
"timeGrain": "PT1M",
|
||||
"dimension": "blob",
|
||||
"dimensionFilter": "*",
|
||||
},
|
||||
queryInterval: duration,
|
||||
expectedInterval: "PT1M",
|
||||
azureMonitorQueryTarget: "%24filter=blob+eq+%27%2A%27&aggregation=Average&api-version=2018-01-01&interval=PT1M&metricnames=Percentage+CPU&metricnamespace=Microsoft.Compute-virtualMachines×pan=2018-03-15T13%3A00%3A00Z%2F2018-03-15T13%3A34%3A00Z",
|
||||
},
|
||||
}
|
||||
|
||||
commonAzureModelProps := map[string]interface{}{
|
||||
|
Loading…
Reference in New Issue
Block a user