def test_add_anomaly_feedback(self):
     anomaly_feedback = AnomalyFeedback(metric_id=self.metric_id,
                                        dimension_key={"category": "Shoes Handbags & Sunglasses"},
                                        start_time=datetime.datetime(2021, 8, 5),
                                        end_time=datetime.datetime(2021, 9, 9),
                                        value="NotAnomaly")
     self.client.add_feedback(anomaly_feedback)
 def test_add_anomaly_feedback(self):
     anomaly_feedback = AnomalyFeedback(metric_id=self.metric_id,
                                        dimension_key={"city": "Los Angeles"},
                                        start_time=datetime.datetime(2020, 8, 5),
                                        end_time=datetime.datetime(2020, 10, 21),
                                        value="NotAnomaly")
     self.client.add_feedback(anomaly_feedback)
 def test_add_anomaly_feedback(self):
     anomaly_feedback = AnomalyFeedback(
         metric_id=self.metric_id,
         dimension_key={"Dim1": "Common Lime"},
         start_time=datetime.datetime(2020, 8, 5),
         end_time=datetime.datetime(2020, 8, 7),
         value="NotAnomaly")
     self.client.add_feedback(anomaly_feedback)
示例#4
0
async def sample_add_feedback_async():
    # [START add_feedback_async]
    from azure.ai.metricsadvisor import MetricsAdvisorKeyCredential
    from azure.ai.metricsadvisor.aio import MetricsAdvisorClient
    from azure.ai.metricsadvisor.models import AnomalyFeedback, ChangePointFeedback, CommentFeedback, PeriodFeedback

    service_endpoint = os.getenv("METRICS_ADVISOR_ENDPOINT")
    subscription_key = os.getenv("METRICS_ADVISOR_SUBSCRIPTION_KEY")
    api_key = os.getenv("METRICS_ADVISOR_API_KEY")
    metric_id = os.getenv("METRICS_ADVISOR_METRIC_ID")

    client = MetricsAdvisorClient(
        service_endpoint, MetricsAdvisorKeyCredential(subscription_key,
                                                      api_key))

    anomaly_feedback = AnomalyFeedback(metric_id=metric_id,
                                       dimension_key={"Dim1": "Common Lime"},
                                       start_time=datetime.datetime(
                                           2020, 8, 5),
                                       end_time=datetime.datetime(2020, 8, 7),
                                       value="NotAnomaly")
    await client.add_feedback(anomaly_feedback)

    change_point_feedback = ChangePointFeedback(
        metric_id=metric_id,
        dimension_key={"Dim1": "Common Lime"},
        start_time=datetime.datetime(2020, 8, 5),
        end_time=datetime.datetime(2020, 8, 7),
        value="NotChangePoint")
    await client.add_feedback(change_point_feedback)

    comment_feedback = CommentFeedback(metric_id=metric_id,
                                       dimension_key={"Dim1": "Common Lime"},
                                       start_time=datetime.datetime(
                                           2020, 8, 5),
                                       end_time=datetime.datetime(2020, 8, 7),
                                       value="comment")
    await client.add_feedback(comment_feedback)

    period_feedback = PeriodFeedback(metric_id=metric_id,
                                     dimension_key={"Dim1": "Common Lime"},
                                     start_time=datetime.datetime(2020, 8, 5),
                                     end_time=datetime.datetime(2020, 8, 7),
                                     period_type="AssignValue",
                                     value=2)
    await client.add_feedback(period_feedback)