public async Task CreateAndDeleteDetectionConfigurationAsync()
        {
            string endpoint        = MetricsAdvisorUri;
            string subscriptionKey = MetricsAdvisorSubscriptionKey;
            string apiKey          = MetricsAdvisorApiKey;
            var    credential      = new MetricsAdvisorKeyCredential(subscriptionKey, apiKey);

            var adminClient = new MetricsAdvisorAdministrationClient(new Uri(endpoint), credential);

            #region Snippet:CreateDetectionConfigurationAsync
#if SNIPPET
            string metricId          = "<metricId>";
            string configurationName = "<configurationName>";
#else
            string metricId          = MetricId;
            string configurationName = GetUniqueName();
#endif

            var detectionConfiguration = new AnomalyDetectionConfiguration()
            {
                MetricId = metricId,
                Name     = configurationName,
                WholeSeriesDetectionConditions = new MetricWholeSeriesDetectionCondition()
            };

            var detectCondition = detectionConfiguration.WholeSeriesDetectionConditions;

            var hardSuppress = new SuppressCondition(1, 100);
            detectCondition.HardThresholdCondition = new HardThresholdCondition(AnomalyDetectorDirection.Down, hardSuppress)
            {
                LowerBound = 5.0
            };

            var smartSuppress = new SuppressCondition(4, 50);
            detectCondition.SmartDetectionCondition = new SmartDetectionCondition(10.0, AnomalyDetectorDirection.Up, smartSuppress);

            detectCondition.CrossConditionsOperator = DetectionConditionsOperator.Or;

            Response <AnomalyDetectionConfiguration> response = await adminClient.CreateDetectionConfigurationAsync(detectionConfiguration);

            AnomalyDetectionConfiguration createdDetectionConfiguration = response.Value;

            Console.WriteLine($"Anomaly detection configuration ID: {createdDetectionConfiguration.Id}");
            #endregion

            // Delete the created anomaly detection configuration to clean up the Metrics Advisor resource.
            // Do not perform this step if you intend to keep using the configuration.

            await adminClient.DeleteDetectionConfigurationAsync(createdDetectionConfiguration.Id);
        }
        public async Task CreateAndDeleteAnomalyDetectionConfigurationAsync()
        {
            string endpoint        = MetricsAdvisorUri;
            string subscriptionKey = MetricsAdvisorSubscriptionKey;
            string apiKey          = MetricsAdvisorApiKey;
            var    credential      = new MetricsAdvisorKeyCredential(subscriptionKey, apiKey);

            var adminClient = new MetricsAdvisorAdministrationClient(new Uri(endpoint), credential);

            string metricId = MetricId;

            #region Snippet:CreateAnomalyDetectionConfigurationAsync
            //@@ string metricId = "<metricId>";
            string configurationName = "Sample anomaly detection configuration";

            var hardThresholdSuppressCondition = new SuppressCondition(1, 100);
            var hardThresholdCondition         = new HardThresholdCondition(AnomalyDetectorDirection.Down, hardThresholdSuppressCondition)
            {
                LowerBound = 5.0
            };

            var smartDetectionSuppressCondition = new SuppressCondition(4, 50);
            var smartDetectionCondition         = new SmartDetectionCondition(10.0, AnomalyDetectorDirection.Up, smartDetectionSuppressCondition);

            var detectionCondition = new MetricWholeSeriesDetectionCondition()
            {
                HardThresholdCondition  = hardThresholdCondition,
                SmartDetectionCondition = smartDetectionCondition,
                CrossConditionsOperator = DetectionConditionsOperator.Or
            };

            var detectionConfiguration = new AnomalyDetectionConfiguration(metricId, configurationName, detectionCondition);

            Response <AnomalyDetectionConfiguration> response = await adminClient.CreateMetricAnomalyDetectionConfigurationAsync(detectionConfiguration);

            detectionConfiguration = response.Value;

            Console.WriteLine($"Anomaly detection configuration ID: {detectionConfiguration.Id}");
            #endregion

            // Delete the created anomaly detection configuration to clean up the Metrics Advisor resource.
            // Do not perform this step if you intend to keep using the configuration.

            await adminClient.DeleteMetricAnomalyDetectionConfigurationAsync(detectionConfiguration.Id);
        }
 /// <summary>
 /// Suppresses validation warnings for <paramref name="dbPlatform"/> and the data type <paramref name="type"/> under the <paramref name="condition"/>.
 /// </summary>
 public void SuppressWarning(DbPlatform dbPlatform, DbType type, SuppressCondition condition)
 {
     _warningSuppressions.Add(new Suppression(dbPlatform, type, condition));
 }
 public Suppression(DbPlatform dbPlatform, DbType type, SuppressCondition condition)
 {
     _dbPlatform = dbPlatform;
     _type = type;
     _condition = condition;
 }
 public Suppression(string providerName, DbType type, SuppressCondition condition)
 {
     _providerName = providerName;
     _type = type;
     _condition = condition;
 }
 /// <summary>
 /// Suppresses validation warnings for the provider called <paramref name="providerName"/> and the data type <paramref name="type"/> under the <paramref name="condition"/>.
 /// </summary>
 public void SuppressWarning(string providerName, DbType type, SuppressCondition condition)
 {
     _warningSuppressions.Add(new Suppression(providerName, type, condition));
 }
Exemple #7
0
 /// <summary>
 /// Suppresses validation warnings for the provider called <paramref name="providerName"/> and the data type <paramref name="type"/> under the <paramref name="condition"/>.
 /// </summary>
 public void SuppressWarning(string providerName, DbType type, SuppressCondition condition)
 {
     _warningSuppressions.Add(new Suppression(providerName, type, condition));
 }
Exemple #8
0
 public Suppression(string providerName, DbType type, SuppressCondition condition)
 {
     _providerName = providerName;
     _type         = type;
     _condition    = condition;
 }
 /// <summary>
 /// Suppresses validation warnings for <paramref name="dbPlatform"/> and the data type <paramref name="type"/> under the <paramref name="condition"/>.
 /// </summary>
 public void SuppressWarning(DbPlatform dbPlatform, DbType type, SuppressCondition condition)
 {
     _warningSuppressions.Add(new Suppression(dbPlatform, type, condition));
 }
 public Suppression(DbPlatform dbPlatform, DbType type, SuppressCondition condition)
 {
     _dbPlatform = dbPlatform;
     _type       = type;
     _condition  = condition;
 }