public MetricsDeclarationBuilder WithSqlDatabaseMetric(
            string metricName        = "promitor-sql-db",
            string azureMetricName   = "cpu_percent",
            string serverName        = "promitor-sql-server",
            string databaseName      = "promitor-db",
            string metricDescription = "Metric description")
        {
            var azureMetricConfiguration = CreateAzureMetricConfiguration(azureMetricName);
            var resource = new SqlDatabaseResourceV1
            {
                ServerName   = serverName,
                DatabaseName = databaseName
            };

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

            _metrics.Add(metric);

            return(this);
        }
Esempio n. 2
0
        public MetricsDeclarationBuilder WithSqlDatabaseMetric(
            string metricName                 = "promitor-sql-db",
            string azureMetricName            = "cpu_percent",
            string serverName                 = "promitor-sql-server",
            string databaseName               = "promitor-db",
            string metricDescription          = "Metric description",
            string resourceDiscoveryGroupName = "",
            bool omitResource                 = false)
        {
            var resource = new SqlDatabaseResourceV1
            {
                ServerName   = serverName,
                DatabaseName = databaseName
            };

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

            return(this);
        }