Beispiel #1
0
        public async Task CreateMetricFeedbackAsync()
        {
            string endpoint        = MetricsAdvisorUri;
            string subscriptionKey = MetricsAdvisorSubscriptionKey;
            string apiKey          = MetricsAdvisorApiKey;
            var    credential      = new MetricsAdvisorKeyCredential(subscriptionKey, apiKey);

            var client = new MetricsAdvisorClient(new Uri(endpoint), credential);

            string metricId = MetricId;

            DimensionKey groupKey = new DimensionKey();

            groupKey.AddDimensionColumn("city", "Belo Horizonte");

            FeedbackDimensionFilter filter = new FeedbackDimensionFilter(groupKey);
            var startTime = DateTimeOffset.Parse("2020-02-01T00:00:00Z");
            var endTime   = DateTimeOffset.Parse("2020-02-03T00:00:00Z");

            // Other types of feedback, such as MetricCommentFeedback, MetricChangePointFeedback,
            // and MetricPeriodFeedback are supported as well.

            var anomalyFeedback = new MetricAnomalyFeedback(metricId, filter, startTime, endTime, AnomalyValue.NotAnomaly);

            Response <MetricFeedback> response = await client.CreateMetricFeedbackAsync(anomalyFeedback);

            MetricFeedback feedback = response.Value;

            Console.WriteLine($"Feedback ID: {feedback.Id}");
        }