Example #1
0
        public MetricsDeclarationBuilder WithApiManagementMetric(string metricName                 = "promitor-api-management",
                                                                 string metricDescription          = "Description for a metric",
                                                                 string instanceName               = "promitor-app-plan",
                                                                 string locationName               = "West Europe",
                                                                 string azureMetricName            = "TotalRequests",
                                                                 string resourceDiscoveryGroupName = "",
                                                                 bool omitResource                 = false)
        {
            var resource = new ApiManagementResourceV1
            {
                InstanceName = instanceName,
                LocationName = locationName
            };

            CreateAndAddMetricDefinition(ResourceType.ApiManagement, metricName, metricDescription, resourceDiscoveryGroupName, omitResource, azureMetricName, resource);

            return(this);
        }
        public MetricsDeclarationBuilder WithApiManagementMetric(string metricName = "promitor-api-management", string metricDescription = "Description for a metric", string instanceName = "promitor-app-plan", string locationName = "West Europe", string azureMetricName = "TotalRequests")
        {
            var azureMetricConfiguration = CreateAzureMetricConfiguration(azureMetricName);
            var resource = new ApiManagementResourceV1
            {
                InstanceName = instanceName,
                LocationName = locationName
            };

            var metric = new MetricDefinitionV1
            {
                Name        = metricName,
                Description = metricDescription,
                AzureMetricConfiguration = azureMetricConfiguration,
                Resources = new List <AzureResourceDefinitionV1> {
                    resource
                },
                ResourceType = ResourceType.ApiManagement
            };

            _metrics.Add(metric);

            return(this);
        }