diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/index.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/index.ts new file mode 100644 index 00000000000..58c4472bda4 --- /dev/null +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/index.ts @@ -0,0 +1,2 @@ +export * from './locations'; +export * from './resourceTypes'; diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/locations.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/locations.ts new file mode 100644 index 00000000000..5ffcfecb99a --- /dev/null +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/locations.ts @@ -0,0 +1,334 @@ +// Unfortunately this list is manually maintained as there's no (nice) automated way to get +// data from Azure. + +export const locationMetadata = [ + { + location: 'eastus', + displayName: 'East US', + supportsLogs: true, + }, + { + location: 'eastus2', + displayName: 'East US 2', + supportsLogs: true, + }, + { + location: 'southcentralus', + displayName: 'South Central US', + supportsLogs: true, + }, + { + location: 'westus2', + displayName: 'West US 2', + supportsLogs: true, + }, + { + location: 'westus3', + displayName: 'West US 3', + supportsLogs: true, + }, + { + location: 'australiaeast', + displayName: 'Australia East', + supportsLogs: true, + }, + { + location: 'southeastasia', + displayName: 'Southeast Asia', + supportsLogs: true, + }, + { + location: 'northeurope', + displayName: 'North Europe', + supportsLogs: true, + }, + { + location: 'uksouth', + displayName: 'UK South', + supportsLogs: true, + }, + { + location: 'westeurope', + displayName: 'West Europe', + supportsLogs: true, + }, + { + location: 'centralus', + displayName: 'Central US', + supportsLogs: true, + }, + { + location: 'northcentralus', + displayName: 'North Central US', + supportsLogs: true, + }, + { + location: 'westus', + displayName: 'West US', + supportsLogs: true, + }, + { + location: 'southafricanorth', + displayName: 'South Africa North', + supportsLogs: true, + }, + { + location: 'centralindia', + displayName: 'Central India', + supportsLogs: true, + }, + { + location: 'eastasia', + displayName: 'East Asia', + supportsLogs: true, + }, + { + location: 'japaneast', + displayName: 'Japan East', + supportsLogs: true, + }, + { + location: 'jioindiawest', + displayName: 'Jio India West', + supportsLogs: true, + }, + { + location: 'koreacentral', + displayName: 'Korea Central', + supportsLogs: true, + }, + { + location: 'canadacentral', + displayName: 'Canada Central', + supportsLogs: true, + }, + { + location: 'francecentral', + displayName: 'France Central', + supportsLogs: true, + }, + { + location: 'germanywestcentral', + displayName: 'Germany West Central', + supportsLogs: true, + }, + { + location: 'norwayeast', + displayName: 'Norway East', + supportsLogs: true, + }, + { + location: 'switzerlandnorth', + displayName: 'Switzerland North', + supportsLogs: true, + }, + { + location: 'uaenorth', + displayName: 'UAE North', + supportsLogs: true, + }, + { + location: 'brazilsouth', + displayName: 'Brazil South', + supportsLogs: true, + }, + { + location: 'centralusstage', + displayName: 'Central US (Stage)', + supportsLogs: true, + }, + { + location: 'eastusstage', + displayName: 'East US (Stage)', + supportsLogs: true, + }, + { + location: 'eastus2stage', + displayName: 'East US 2 (Stage)', + supportsLogs: true, + }, + { + location: 'northcentralusstage', + displayName: 'North Central US (Stage)', + supportsLogs: true, + }, + { + location: 'southcentralusstage', + displayName: 'South Central US (Stage)', + supportsLogs: true, + }, + { + location: 'westusstage', + displayName: 'West US (Stage)', + supportsLogs: true, + }, + { + location: 'westus2stage', + displayName: 'West US 2 (Stage)', + supportsLogs: true, + }, + { + location: 'asia', + displayName: 'Asia', + supportsLogs: true, + }, + { + location: 'asiapacific', + displayName: 'Asia Pacific', + supportsLogs: true, + }, + { + location: 'australia', + displayName: 'Australia', + supportsLogs: true, + }, + { + location: 'brazil', + displayName: 'Brazil', + supportsLogs: true, + }, + { + location: 'canada', + displayName: 'Canada', + supportsLogs: true, + }, + { + location: 'europe', + displayName: 'Europe', + supportsLogs: true, + }, + { + location: 'global', + displayName: 'Global', + supportsLogs: true, + }, + { + location: 'india', + displayName: 'India', + supportsLogs: true, + }, + { + location: 'japan', + displayName: 'Japan', + supportsLogs: true, + }, + { + location: 'uk', + displayName: 'United Kingdom', + supportsLogs: true, + }, + { + location: 'unitedstates', + displayName: 'United States', + supportsLogs: true, + }, + { + location: 'eastasiastage', + displayName: 'East Asia (Stage)', + supportsLogs: true, + }, + { + location: 'southeastasiastage', + displayName: 'Southeast Asia (Stage)', + supportsLogs: true, + }, + { + location: 'westcentralus', + displayName: 'West Central US', + supportsLogs: true, + }, + { + location: 'southafricawest', + displayName: 'South Africa West', + supportsLogs: true, + }, + { + location: 'australiacentral', + displayName: 'Australia Central', + supportsLogs: true, + }, + { + location: 'australiacentral2', + displayName: 'Australia Central 2', + supportsLogs: true, + }, + { + location: 'australiasoutheast', + displayName: 'Australia Southeast', + supportsLogs: true, + }, + { + location: 'japanwest', + displayName: 'Japan West', + supportsLogs: true, + }, + { + location: 'koreasouth', + displayName: 'Korea South', + supportsLogs: true, + }, + { + location: 'southindia', + displayName: 'South India', + supportsLogs: true, + }, + { + location: 'westindia', + displayName: 'West India', + supportsLogs: true, + }, + { + location: 'canadaeast', + displayName: 'Canada East', + supportsLogs: true, + }, + { + location: 'francesouth', + displayName: 'France South', + supportsLogs: true, + }, + { + location: 'germanynorth', + displayName: 'Germany North', + supportsLogs: true, + }, + { + location: 'norwaywest', + displayName: 'Norway West', + supportsLogs: true, + }, + { + location: 'switzerlandwest', + displayName: 'Switzerland West', + supportsLogs: true, + }, + { + location: 'ukwest', + displayName: 'UK West', + supportsLogs: true, + }, + { + location: 'uaecentral', + displayName: 'UAE Central', + supportsLogs: true, + }, + { + location: 'brazilsoutheast', + displayName: 'Brazil Southeast', + supportsLogs: true, + }, +]; + +export const logsSupportedLocationsKusto = locationMetadata + .filter((v) => v.supportsLogs) + .map((v) => `"${v.location}"`) + .join(','); + +// Object, keyed by location ID +export const locationDisplayNames: Record = locationMetadata.reduce( + (acc, location) => ({ + ...acc, + [location.location]: location.displayName, + }), + {} +); diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/resourceTypes.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/resourceTypes.ts new file mode 100644 index 00000000000..583631a4a03 --- /dev/null +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azureMetadata/resourceTypes.ts @@ -0,0 +1,569 @@ +// Unfortunately this list is manually maintained as there's no (nice) automated way to get +// data from Azure. + +export const resourceTypeMetadata = [ + { + resourceType: 'microsoft.analysisservices/servers', + displayName: 'Analysis Services', + supportsLogs: true, + }, + { + resourceType: 'microsoft.synapse/workspaces/bigdatapools', + displayName: 'Apache Spark pool', + supportsLogs: true, + }, + { + resourceType: 'microsoft.apimanagement/service', + displayName: 'API Management service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.appconfiguration/configurationstores', + displayName: 'App Configuration', + supportsLogs: true, + }, + { + resourceType: 'microsoft.web/sites/slots', + displayName: 'App Service (Slot)', + supportsLogs: true, + }, + { + resourceType: 'microsoft.web/hostingenvironments', + displayName: 'App Service Environment', + supportsLogs: true, + }, + { + resourceType: 'microsoft.web/serverfarms', + displayName: 'App Service plan', + supportsLogs: true, + }, + { + resourceType: 'microsoft.web/sites', + displayName: 'App Service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/applicationgateways', + displayName: 'Application gateway', + supportsLogs: true, + }, + { + resourceType: 'microsoft.insights/components', + displayName: 'Application Insights', + supportsLogs: true, + }, + { + resourceType: 'microsoft.automation/automationaccounts', + displayName: 'Automation Account', + supportsLogs: true, + }, + { + resourceType: 'microsoft.insights/autoscalesettings', + displayName: 'Autoscale Settings', + supportsLogs: true, + }, + { + resourceType: 'microsoft.aadiam/azureadmetrics', + displayName: 'Azure AD Metrics', + supportsLogs: true, + }, + { + resourceType: 'microsoft.cache/redis', + displayName: 'Azure Cache for Redis', + supportsLogs: true, + }, + { + resourceType: 'microsoft.documentdb/databaseaccounts', + displayName: 'Azure Cosmos DB account', + supportsLogs: true, + }, + { + resourceType: 'microsoft.kusto/clusters', + displayName: 'Azure Data Explorer Cluster', + supportsLogs: true, + }, + { + resourceType: 'microsoft.dbformariadb/servers', + displayName: 'Azure Database for MariaDB server', + supportsLogs: true, + }, + { + resourceType: 'microsoft.dbformysql/servers', + displayName: 'Azure Database for MySQL server', + supportsLogs: true, + }, + { + resourceType: 'microsoft.dbforpostgresql/flexibleservers', + displayName: 'Azure Database for PostgreSQL flexible server', + supportsLogs: true, + }, + { + resourceType: 'microsoft.dbforpostgresql/servergroupsv2', + displayName: 'Azure Database for PostgreSQL server group', + supportsLogs: true, + }, + { + resourceType: 'microsoft.dbforpostgresql/servers', + displayName: 'Azure Database for PostgreSQL server', + supportsLogs: true, + }, + { + resourceType: 'microsoft.dbforpostgresql/serversv2', + displayName: 'Azure Database for PostgreSQL server v2', + supportsLogs: true, + }, + { + resourceType: 'microsoft.resources/subscriptions', + displayName: 'Subscription', + supportsLogs: true, + }, + { + resourceType: 'microsoft.appplatform/spring', + displayName: 'Azure Spring Cloud', + supportsLogs: true, + }, + { + resourceType: 'microsoft.databoxedge/databoxedgedevices', + displayName: 'Azure Stack Edge / Data Box Gateway', + supportsLogs: true, + }, + { + resourceType: 'microsoft.azurestackresourcemonitor/storageaccountmonitor', + displayName: 'Azure Stack Resource Monitor', + supportsLogs: true, + }, + { + resourceType: 'microsoft.synapse/workspaces', + displayName: 'Synapse workspace', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/bastionhosts', + displayName: 'Bastion', + supportsLogs: true, + }, + { + resourceType: 'microsoft.batch/batchaccounts', + displayName: 'Batch account', + supportsLogs: true, + }, + { + resourceType: 'microsoft.botservice/botservices', + displayName: 'Bot Service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.netapp/netappaccounts/capacitypools', + displayName: 'Capacity pool', + supportsLogs: true, + }, + { + resourceType: 'microsoft.classiccompute/domainnames', + displayName: 'Cloud service (classic)', + supportsLogs: true, + }, + { + resourceType: 'microsoft.vmwarecloudsimple/virtualmachines', + displayName: 'CloudSimple Virtual Machine', + supportsLogs: true, + }, + { + resourceType: 'microsoft.cognitiveservices/accounts', + displayName: 'Cognitive Services', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/networkwatchers/connectionmonitors', + displayName: 'Connection Monitors', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/connections', + displayName: 'Connection', + supportsLogs: true, + }, + { + resourceType: 'microsoft.containerinstance/containergroups', + displayName: 'Container instances', + supportsLogs: true, + }, + { + resourceType: 'microsoft.containerregistry/registries', + displayName: 'Container registry', + supportsLogs: true, + }, + { + resourceType: 'microsoft.insights/qos', + displayName: 'Custom Metric Usage', + supportsLogs: true, + }, + { + resourceType: 'microsoft.customerinsights/hubs', + displayName: 'CustomerInsights', + supportsLogs: true, + }, + { + resourceType: 'microsoft.datafactory/datafactories', + displayName: 'Data factory', + supportsLogs: true, + }, + { + resourceType: 'microsoft.datafactory/factories', + displayName: 'Data factory (V2)', + supportsLogs: true, + }, + { + resourceType: 'microsoft.datalakeanalytics/accounts', + displayName: 'Data Lake Analytics', + supportsLogs: true, + }, + { + resourceType: 'microsoft.datalakestore/accounts', + displayName: 'Data Lake Storage Gen1', + supportsLogs: true, + }, + { + resourceType: 'microsoft.datashare/accounts', + displayName: 'Data Share', + supportsLogs: true, + }, + { + resourceType: 'microsoft.synapse/workspaces/sqlpools', + displayName: 'Dedicated SQL pool', + supportsLogs: true, + }, + { + resourceType: 'microsoft.devices/provisioningservices', + displayName: 'Device Provisioning Service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.compute/disks', + displayName: 'Disk', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/dnszones', + displayName: 'DNS zone', + supportsLogs: true, + }, + { + resourceType: 'microsoft.eventgrid/domains', + displayName: 'Event Grid Domain', + supportsLogs: true, + }, + { + resourceType: 'microsoft.eventgrid/systemtopics', + displayName: 'Event Grid System Topic', + supportsLogs: true, + }, + { + resourceType: 'microsoft.eventgrid/topics', + displayName: 'Event Grid Topic', + supportsLogs: true, + }, + { + resourceType: 'microsoft.eventhub/clusters', + displayName: 'Event Hubs Cluster', + supportsLogs: true, + }, + { + resourceType: 'microsoft.eventhub/namespaces', + displayName: 'Event Hubs Namespace', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/expressroutecircuits', + displayName: 'ExpressRoute circuit', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/expressrouteports', + displayName: 'ExpressRoute Direct', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/expressroutegateways', + displayName: 'ExpressRoute Gateways', + supportsLogs: true, + }, + { + resourceType: 'microsoft.fabric.admin/fabriclocations', + displayName: 'Fabric Locations', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/azurefirewalls', + displayName: 'Firewall', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/frontdoors', + displayName: 'Front Door', + supportsLogs: true, + }, + { + resourceType: 'microsoft.hdinsight/clusters', + displayName: 'HDInsight cluster', + supportsLogs: true, + }, + { + resourceType: 'microsoft.storagecache/caches', + displayName: 'HPC cache', + supportsLogs: true, + }, + { + resourceType: 'microsoft.logic/integrationserviceenvironments', + displayName: 'Integration Service Environment', + supportsLogs: true, + }, + { + resourceType: 'microsoft.iotcentral/iotapps', + displayName: 'IoT Central Application', + supportsLogs: true, + }, + { + resourceType: 'microsoft.devices/iothubs', + displayName: 'IoT Hub', + supportsLogs: true, + }, + { + resourceType: 'microsoft.keyvault/vaults', + displayName: 'Key vault', + supportsLogs: true, + }, + { + resourceType: 'microsoft.kubernetes/connectedclusters', + displayName: 'Kubernetes - Azure Arc', + supportsLogs: true, + }, + { + resourceType: 'microsoft.containerservice/managedclusters', + displayName: 'Kubernetes service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.media/mediaservices/liveevents', + displayName: 'Live event', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/loadbalancers', + displayName: 'Load balancer', + supportsLogs: true, + }, + { + resourceType: 'microsoft.operationalinsights/workspaces', + displayName: 'Log Analytics workspace', + supportsLogs: true, + }, + { + resourceType: 'microsoft.logic/workflows', + displayName: 'Logic app', + supportsLogs: true, + }, + { + resourceType: 'microsoft.machinelearningservices/workspaces', + displayName: 'Machine learning', + supportsLogs: true, + }, + { + resourceType: 'microsoft.media/mediaservices', + displayName: 'Media service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/natgateways', + displayName: 'NAT gateway', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/networkinterfaces', + displayName: 'Network interface', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/networkvirtualappliances', + displayName: 'Network Virtual Appliances', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/networkwatchers', + displayName: 'Network Watcher', + supportsLogs: true, + }, + { + resourceType: 'microsoft.notificationhubs/namespaces/notificationhubs', + displayName: 'Notification Hub', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/p2svpngateways', + displayName: 'P2S VPN Gateways', + supportsLogs: true, + }, + { + resourceType: 'microsoft.peering/peeringservices', + displayName: 'Peering Service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.powerbidedicated/capacities', + displayName: 'Power BI Embedded', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/privateendpoints', + displayName: 'Private endpoint', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/privatelinkservices', + displayName: 'Private link service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/publicipaddresses', + displayName: 'Public IP address', + supportsLogs: true, + }, + { + resourceType: 'microsoft.cache/redisenterprise', + displayName: 'Redis Enterprise', + supportsLogs: true, + }, + { + resourceType: 'microsoft.relay/namespaces', + displayName: 'Relay', + supportsLogs: true, + }, + { + resourceType: 'microsoft.synapse/workspaces/scopepools', + displayName: 'Scope pool', + supportsLogs: true, + }, + { + resourceType: 'microsoft.search/searchservices', + displayName: 'Search service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.servicebus/namespaces', + displayName: 'Service Bus Namespace', + supportsLogs: true, + }, + { + resourceType: 'microsoft.signalrservice/signalr', + displayName: 'SignalR', + supportsLogs: true, + }, + { + resourceType: 'microsoft.operationsmanagement/solutions', + displayName: 'Solution', + supportsLogs: true, + }, + { + resourceType: 'microsoft.sql/servers/databases', + displayName: 'SQL database', + supportsLogs: true, + }, + { + resourceType: 'microsoft.sql/servers/elasticpools', + displayName: 'SQL elastic pool', + supportsLogs: true, + }, + { + resourceType: 'microsoft.sql/managedinstances', + displayName: 'SQL managed instance', + supportsLogs: true, + }, + { + resourceType: 'microsoft.storage/storageaccounts', + displayName: 'Storage account', + supportsLogs: true, + }, + { + resourceType: 'microsoft.classicstorage/storageaccounts', + displayName: 'Storage account (classic)', + supportsLogs: true, + }, + { + resourceType: 'microsoft.storagesync/storagesyncservices', + displayName: 'Storage Sync Service', + supportsLogs: true, + }, + { + resourceType: 'microsoft.streamanalytics/streamingjobs', + displayName: 'Stream Analytics job', + supportsLogs: true, + }, + { + resourceType: 'microsoft.media/mediaservices/streamingendpoints', + displayName: 'Streaming Endpoint', + supportsLogs: true, + }, + { + resourceType: 'microsoft.timeseriesinsights/environments', + displayName: 'Time Series Insights environment', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/trafficmanagerprofiles', + displayName: 'Traffic Manager profile', + supportsLogs: true, + }, + { + resourceType: 'microsoft.compute/virtualmachinescalesets', + displayName: 'Virtual machine scale set', + supportsLogs: true, + }, + { + resourceType: 'microsoft.compute/virtualmachines', + displayName: 'Virtual machine', + supportsLogs: true, + }, + { + resourceType: 'microsoft.classiccompute/virtualmachines', + displayName: 'Virtual machine (classic)', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/virtualnetworkgateways', + displayName: 'Virtual network gateway', + supportsLogs: true, + }, + { + resourceType: 'microsoft.netapp/netappaccounts/capacitypools/volumes', + displayName: 'Volume', + supportsLogs: true, + }, + { + resourceType: 'microsoft.network/vpngateways', + displayName: 'VPN Gateways', + supportsLogs: true, + }, + { + resourceType: 'microsoft.cdn/cdnwebapplicationfirewallpolicies', + displayName: 'Content Delivery Network WAF policy', + supportsLogs: true, + }, + { + resourceType: 'microsoft.web/hostingenvironments/workerpools', + displayName: 'WorkerPools', + supportsLogs: true, + }, +]; + +export const logsSupportedResourceTypesKusto = resourceTypeMetadata + .filter((v) => v.supportsLogs) + .map((v) => `"${v.resourceType}"`) + .join(','); + +// Object, keyed by resourceType ID +export const resourceTypeDisplayNames: Record = resourceTypeMetadata.reduce( + (acc, resourceType) => ({ + ...acc, + [resourceType.resourceType]: resourceType.displayName, + }), + {} +); diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.test.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.test.ts index 372f94bb8a9..44159defc5f 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.test.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.test.ts @@ -185,7 +185,7 @@ describe('AzureMonitorDatasource', () => { it('should return a list of namespaces', async () => { const results = await ctx.ds.metricFindQuery('Namespaces(nodesapp)'); expect(results.length).toEqual(1); - expect(results[0].text).toEqual('Microsoft.Network/networkInterfaces'); + expect(results[0].text).toEqual('Network interface'); expect(results[0].value).toEqual('Microsoft.Network/networkInterfaces'); }); }); @@ -216,7 +216,7 @@ describe('AzureMonitorDatasource', () => { it('should return a list of namespaces', async () => { const results = await ctx.ds.metricFindQuery('namespaces(11112222-eeee-4949-9b2d-9106972f9123, nodesapp)'); expect(results.length).toEqual(1); - expect(results[0].text).toEqual('Microsoft.Network/networkInterfaces'); + expect(results[0].text).toEqual('Network interface'); expect(results[0].value).toEqual('Microsoft.Network/networkInterfaces'); }); }); @@ -596,11 +596,11 @@ describe('AzureMonitorDatasource', () => { .getMetricDefinitions('9935389e-9122-4ef9-95f9-1513dd24753f', 'nodesapp') .then((results: Array<{ text: string; value: string }>) => { expect(results.length).toEqual(7); - expect(results[0].text).toEqual('Microsoft.Network/networkInterfaces'); + expect(results[0].text).toEqual('Network interface'); expect(results[0].value).toEqual('Microsoft.Network/networkInterfaces'); - expect(results[1].text).toEqual('Microsoft.Compute/virtualMachines'); + expect(results[1].text).toEqual('Virtual machine'); expect(results[1].value).toEqual('Microsoft.Compute/virtualMachines'); - expect(results[2].text).toEqual('Microsoft.Storage/storageAccounts'); + expect(results[2].text).toEqual('Storage account'); expect(results[2].value).toEqual('Microsoft.Storage/storageAccounts'); expect(results[3].text).toEqual('Microsoft.Storage/storageAccounts/blobServices'); expect(results[3].value).toEqual('Microsoft.Storage/storageAccounts/blobServices'); diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts index 5f105aa4fc0..82d3285a968 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/azure_monitor/azure_monitor_datasource.ts @@ -28,6 +28,7 @@ import { mergeMap } from 'rxjs/operators'; import { getTimeSrv, TimeSrv } from 'app/features/dashboard/services/TimeSrv'; import { getAuthType, getAzureCloud } from '../credentials'; import { getManagementApiRoute } from '../api/routes'; +import { resourceTypeDisplayNames } from '../azureMetadata'; const defaultDropdownValue = 'select'; @@ -392,7 +393,10 @@ export default class AzureMonitorDatasource extends DataSourceWithBackend ({ + value: v.value, + text: resourceTypeDisplayNames[v.value.toLowerCase()] || v.value, + })); }); } diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricsQueryEditor.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricsQueryEditor.tsx index 842a358ba93..423bd12e17d 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricsQueryEditor.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricsQueryEditor.tsx @@ -5,7 +5,7 @@ import { AzureMonitorQuery, AzureMonitorOption, AzureMonitorErrorish } from '../ import { useMetricsMetadata } from '../metrics'; import SubscriptionField from '../SubscriptionField'; import MetricNamespaceField from './MetricNamespaceField'; -import NamespaceField from './NamespaceField'; +import ResourceTypeField from './ResourceTypeField'; import ResourceGroupsField from './ResourceGroupsField'; import ResourceNameField from './ResourceNameField'; import MetricNameField from './MetricNameField'; @@ -58,7 +58,7 @@ const MetricsQueryEditor: React.FC = ({ - = ({ query, datasource, @@ -57,10 +57,10 @@ const NamespaceField: React.FC = ({ const options = useMemo(() => [...namespaces, variableOptionGroup], [namespaces, variableOptionGroup]); return ( - - {/* It's expected that the label reads Namespace but the property is metricDefinition */} + + {/* It's expected that the label reads Resource type but the property is metricDefinition */}