AzureMonitor: Add hardcoded namespaces to improve coverage (#72629)

Add hardcoded resources
This commit is contained in:
Andreas Christou 2023-08-02 10:33:50 +01:00 committed by GitHub
parent 30274a4f88
commit 95f8cc09c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 138 additions and 2 deletions

View File

@ -422,3 +422,137 @@ export const multiResourceCompatibleTypes: { [ns: string]: boolean } = {
'microsoft.compute/virtualmachines': true, // 'Virtual machines'
'microsoft.signalrservice/webpubsub': true, // 'Web PubSub Service'
};
export const resourceTypes = [
'microsoft.analysisservices/servers',
'microsoft.apimanagement/service',
'microsoft.network/applicationgateways',
'microsoft.insights/components',
'microsoft.web/hostingenvironments',
'microsoft.web/serverfarms',
'microsoft.web/sites',
'microsoft.automation/automationaccounts',
'microsoft.aad/domainservices',
'microsoft.botservice/botservices',
'microsoft.appplatform/spring',
'microsoft.dataprotection/backupvaults',
'microsoft.network/bastionhosts',
'microsoft.batch/batchaccounts',
'microsoft.batchai/workspaces',
'microsoft.cdn/profiles',
'microsoft.cdn/cdnwebapplicationfirewallpolicies',
'microsoft.classiccompute/domainnames',
'microsoft.classiccompute/virtualmachines',
'microsoft.compute/cloudservices',
'microsoft.vmwarecloudsimple/virtualmachines',
'microsoft.codesigning/codesigningaccounts',
'microsoft.cognitiveservices/accounts',
'microsoft.voiceservices/communicationsgateways',
'microsoft.appconfiguration/configurationstores',
'microsoft.network/connections',
'microsoft.connectedvehicle/platformaccounts',
'microsoft.containerinstance/containergroups',
'microsoft.containerregistry/registries',
'microsoft.containerservice/managedclusters',
'microsoft.documentdb/databaseaccounts',
'microsoft.databoxedge/databoxedgedevices',
'microsoft.datafactory/datafactories',
'microsoft.datafactory/factories',
'microsoft.datalakeanalytics/accounts',
'microsoft.datalakestore/accounts',
'microsoft.datashare/accounts',
'microsoft.dbformysql/servers',
'microsoft.devices/provisioningservices',
'microsoft.compute/disks',
'microsoft.network/dnszones',
'microsoft.network/dnsresolvers',
'microsoft.network/dnsforwardingrulesets',
'microsoft.enterpriseknowledgegraph/services',
'microsoft.eventgrid/domains',
'microsoft.eventgrid/topics',
'microsoft.eventgrid/systemtopics',
'microsoft.eventhub/namespaces',
'microsoft.eventhub/clusters',
'microsoft.network/expressroutecircuits',
'microsoft.network/expressrouteports',
'microsoft.network/azurefirewalls',
'microsoft.network/frontdoors',
'microsoft.hdinsight/clusters',
'microsoft.iotcentral/iotapps',
'microsoft.devices/iothubs',
'microsoft.iotspaces/graph',
'microsoft.keyvault/vaults',
'microsoft.kubernetes/connectedclusters',
'microsoft.kusto/clusters',
'microsoft.network/loadbalancers',
'microsoft.operationalinsights/workspaces',
'microsoft.logic/workflows',
'microsoft.logic/integrationserviceenvironments',
'microsoft.machinelearningservices/workspaces',
'microsoft.managednetworkfabric/networkdevices',
'microsoft.dbformariadb/servers',
'microsoft.media/mediaservices',
'microsoft.monitor/accounts',
'microsoft.dbformysql/flexibleservers',
'microsoft.network/natgateways',
'microsoft.netapp/netappaccounts/capacitypools',
'microsoft.network/networkinterfaces',
'nginx.nginxplus/nginxdeployments',
'microsoft.notificationhubs/namespaces/notificationhubs',
'microsoft.orbital/l2connections',
'microsoft.peering/peeringservices',
'microsoft.playfab/titles',
'microsoft.dbforpostgresql/servers',
'microsoft.dbforpostgresql/serversv2',
'microsoft.powerbidedicated/capacities',
'microsoft.network/privateendpoints',
'microsoft.network/privatelinkservices',
'microsoft.hybridcontainerservice/provisionedclusters',
'microsoft.network/publicipaddresses',
'microsoft.recoveryservices/vaults',
'microsoft.cache/redis',
'microsoft.cache/redisenterprise',
'microsoft.relay/namespaces',
'microsoft.search/searchservices',
'microsoft.dbforpostgresql/servergroupsv2',
'microsoft.servicebus/namespaces',
'microsoft.servicefabricmesh/applications',
'microsoft.signalrservice/signalr',
'microsoft.signalrservice/webpubsub',
'microsoft.operationsmanagement/solutions',
'microsoft.sql/managedinstances',
'microsoft.sql/servers/databases',
'microsoft.sql/servers/elasticpools',
'microsoft.storage/storageaccounts',
'microsoft.storagecache/caches',
'microsoft.classicstorage/storageaccounts',
'microsoft.storagemover/storagemovers',
'microsoft.storagesync/storagesyncservices',
'microsoft.streamanalytics/streamingjobs',
'microsoft.synapse/workspaces',
'microsoft.timeseriesinsights/environments',
'microsoft.network/trafficmanagerprofiles',
'microsoft.compute/virtualmachines',
'microsoft.compute/virtualmachinescalesets',
'microsoft.network/virtualnetworkgateways',
'microsoft.web/sites/slots',
'microsoft.insights/autoscalesettings',
'microsoft.aadiam/azureadmetrics',
'microsoft.azurestackresourcemonitor/storageaccountmonitor',
'microsoft.network/networkwatchers/connectionmonitors',
'microsoft.app/containerapps',
'microsoft.customerinsights/hubs',
'microsoft.network/expressroutegateways',
'microsoft.fabric.admin/fabriclocations',
'microsoft.network/networkvirtualappliances',
'microsoft.network/networkwatchers',
'microsoft.network/p2svpngateways',
'microsoft.dbforpostgresql/flexibleservers',
'microsoft.network/vpngateways',
'microsoft.network/virtualhubs',
'microsoft.web/hostingenvironments/workerpools',
'microsoft.storagecache/amlfilesystems',
'microsoft.dashboard/grafana',
'microsoft.orbital/contactprofiles',
'microsoft.orbital/spacecrafts',
];

View File

@ -3,7 +3,7 @@ import { uniq } from 'lodash';
import { DataSourceInstanceSettings } from '@grafana/data';
import { DataSourceWithBackend, reportInteraction } from '@grafana/runtime';
import { logsResourceTypes, resourceTypeDisplayNames } from '../azureMetadata';
import { logsResourceTypes, resourceTypeDisplayNames, resourceTypes } from '../azureMetadata';
import AzureMonitorDatasource from '../azure_monitor/azure_monitor_datasource';
import { ResourceRow, ResourceRowGroup, ResourceRowType } from '../components/ResourcePicker/types';
import {
@ -378,7 +378,9 @@ export default class ResourcePickerData extends DataSourceWithBackend<AzureMonit
'Unable to resolve a list of valid metric namespaces. Validate the datasource configuration is correct and required permissions have been granted for all subscriptions. Grafana requires at least the Reader role to be assigned.'
);
}
this.supportedMetricNamespaces = uniq(supportedMetricNamespaces).join(',');
this.supportedMetricNamespaces = uniq(
supportedMetricNamespaces.concat(resourceTypes.map((namespace) => `"${namespace}"`))
).join(',');
}
parseRows(resources: Array<string | AzureMonitorResource>): ResourceRow[] {