mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 01:23:32 -06:00
AzureMonitor: Update curated dashboards (#51331)
* Ensure resource name is appended to URI * Add storage account check to ensure default subresource is appended * Update storage dashboard * Bump storage version * Remove ADX StreamingIngestRequestRate panel as the metric is unavailable * Refactor condition for storage namespaces * Add more tests for URI builder * Do not migrate resource URI if resource name or metric definition uses template variables * Revert change to metricNamespace
This commit is contained in:
parent
40dff288cd
commit
0a6eeaa636
@ -7,6 +7,20 @@ describe('AzureMonitorUrlBuilder', () => {
|
||||
'/subscriptions/sub/resourceGroups/group/providers/Microsoft.NetApp/netAppAccounts/name'
|
||||
);
|
||||
});
|
||||
|
||||
it('builds a resource uri correctly when a template variable is used as namespace', () => {
|
||||
expect(UrlBuilder.buildResourceUri('sub', 'group', '$ns', 'name')).toEqual(
|
||||
'/subscriptions/sub/resourceGroups/group/providers/$ns/name'
|
||||
);
|
||||
});
|
||||
|
||||
it('builds a resource uri correctly when the namespace includes a storage sub-resource', () => {
|
||||
expect(
|
||||
UrlBuilder.buildResourceUri('sub', 'group', 'Microsoft.Storage/storageAccounts/tableServices', 'name')
|
||||
).toEqual(
|
||||
'/subscriptions/sub/resourceGroups/group/providers/Microsoft.Storage/storageAccounts/name/tableServices/default'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when a resource uri is provided', () => {
|
||||
|
@ -11,9 +11,16 @@ export default class UrlBuilder {
|
||||
const resourceNameArray = resourceName.split('/');
|
||||
const provider = metricDefinitionArray.shift();
|
||||
const urlArray = ['/subscriptions', subscriptionId, 'resourceGroups', resourceGroup, 'providers', provider];
|
||||
for (const i in metricDefinitionArray) {
|
||||
urlArray.push(metricDefinitionArray[i]);
|
||||
urlArray.push(resourceNameArray[i]);
|
||||
if (metricDefinition.startsWith('Microsoft.Storage/storageAccounts/') && resourceNameArray.at(-1) !== 'default') {
|
||||
resourceNameArray.push('default');
|
||||
}
|
||||
if (metricDefinitionArray.length > 0) {
|
||||
for (const i in metricDefinitionArray) {
|
||||
urlArray.push(metricDefinitionArray[i]);
|
||||
urlArray.push(resourceNameArray[i]);
|
||||
}
|
||||
} else {
|
||||
urlArray.push(resourceNameArray[0]);
|
||||
}
|
||||
return urlArray.join('/');
|
||||
}
|
||||
|
@ -3389,172 +3389,6 @@
|
||||
"y": 46
|
||||
},
|
||||
"hiddenSeries": false,
|
||||
"id": 34,
|
||||
"legend": {
|
||||
"avg": true,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": true
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 1,
|
||||
"nullPointMode": "null",
|
||||
"options": {
|
||||
"alertThreshold": true
|
||||
},
|
||||
"percentage": false,
|
||||
"pluginVersion": "7.4.3",
|
||||
"pointradius": 2,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"appInsights": {
|
||||
"dimension": [],
|
||||
"metricName": "select",
|
||||
"timeGrain": "auto"
|
||||
},
|
||||
"azureLogAnalytics": {
|
||||
"query": "//change this example to create your own time series query\n<table name> //the table to query (e.g. Usage, Heartbeat, Perf)\n| where $__timeFilter(TimeGenerated) //this is a macro used to show the full chart’s time range, choose the datetime column here\n| summarize count() by <group by column>, bin(TimeGenerated, $__interval) //change “group by column” to a column in your table, such as “Computer”. The $__interval macro is used to auto-select the time grain. Can also use 1h, 5m etc.\n| order by TimeGenerated asc",
|
||||
"resultFormat": "time_series",
|
||||
"workspace": "657b3e91-7c0b-438b-86a5-f769445e237d"
|
||||
},
|
||||
"azureMonitor": {
|
||||
"aggOptions": ["None", "Average", "Minimum", "Maximum", "Total", "Count"],
|
||||
"aggregation": "None",
|
||||
"allowedTimeGrainsMs": [60000, 300000, 900000, 1800000, 3600000, 21600000, 43200000, 86400000],
|
||||
"dimensionFilter": "*",
|
||||
"dimensionFilters": [],
|
||||
"dimensions": [],
|
||||
"metricDefinition": "$ns",
|
||||
"metricName": "SteamingIngestRequestRate",
|
||||
"metricNamespace": "Microsoft.Kusto/clusters",
|
||||
"resourceGroup": "$rg",
|
||||
"resourceName": "$resource",
|
||||
"timeGrain": "auto",
|
||||
"timeGrains": [
|
||||
{
|
||||
"text": "auto",
|
||||
"value": "auto"
|
||||
},
|
||||
{
|
||||
"text": "1 minute",
|
||||
"value": "PT1M"
|
||||
},
|
||||
{
|
||||
"text": "5 minutes",
|
||||
"value": "PT5M"
|
||||
},
|
||||
{
|
||||
"text": "15 minutes",
|
||||
"value": "PT15M"
|
||||
},
|
||||
{
|
||||
"text": "30 minutes",
|
||||
"value": "PT30M"
|
||||
},
|
||||
{
|
||||
"text": "1 hour",
|
||||
"value": "PT1H"
|
||||
},
|
||||
{
|
||||
"text": "6 hours",
|
||||
"value": "PT6H"
|
||||
},
|
||||
{
|
||||
"text": "12 hours",
|
||||
"value": "PT12H"
|
||||
},
|
||||
{
|
||||
"text": "1 day",
|
||||
"value": "P1D"
|
||||
}
|
||||
],
|
||||
"top": "10"
|
||||
},
|
||||
"insightsAnalytics": {
|
||||
"query": "",
|
||||
"resultFormat": "time_series"
|
||||
},
|
||||
"queryType": "Azure Monitor",
|
||||
"refId": "A",
|
||||
"subscription": "$sub"
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeRegions": [],
|
||||
"timeShift": null,
|
||||
"title": "Streaming Ingest Request Rate",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "ms",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
}
|
||||
],
|
||||
"yaxis": {
|
||||
"align": false,
|
||||
"alignLevel": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": "$ds",
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {},
|
||||
"custom": {},
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": []
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"fill": 1,
|
||||
"fillGradient": 0,
|
||||
"gridPos": {
|
||||
"h": 10,
|
||||
"w": 6,
|
||||
"x": 18,
|
||||
"y": 46
|
||||
},
|
||||
"hiddenSeries": false,
|
||||
"id": 35,
|
||||
"legend": {
|
||||
"avg": true,
|
||||
@ -8484,5 +8318,5 @@
|
||||
"timezone": "",
|
||||
"title": "Azure / Insights / Data Explorer Clusters",
|
||||
"uid": "8UDB1s3Gk",
|
||||
"version": 10
|
||||
"version": 11
|
||||
}
|
||||
|
@ -6426,5 +6426,5 @@
|
||||
"timezone": "",
|
||||
"title": "Azure / Insights / Storage Accounts",
|
||||
"uid": "3n2E8CrGk",
|
||||
"version": 28
|
||||
"version": 29
|
||||
}
|
||||
|
@ -109,6 +109,10 @@ function migrateResourceUri(query: AzureMonitorQuery): AzureMonitorQuery {
|
||||
return query;
|
||||
}
|
||||
|
||||
if (metricDefinition.includes('$') || resourceName.includes('$')) {
|
||||
return query;
|
||||
}
|
||||
|
||||
const resourceUri = UrlBuilder.buildResourceUri(subscription, resourceGroup, metricDefinition, resourceName);
|
||||
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user