From b2227276245b24b706b23a397d01d521c8120b3f Mon Sep 17 00:00:00 2001 From: Caio Saldanha Date: Wed, 16 Dec 2020 11:35:18 -0800 Subject: [PATCH 1/7] Added non-live tests for alert configs --- .../AnomalyAlertConfigurationTests.cs | 179 ++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationTests.cs diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationTests.cs b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationTests.cs new file mode 100644 index 0000000000000..f6438337b4ebe --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationTests.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Threading; +using Azure.AI.MetricsAdvisor.Administration; +using Azure.AI.MetricsAdvisor.Models; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.MetricsAdvisor.Tests +{ + public class AnomalyAlertConfigurationTests : ClientTestBase + { + public AnomalyAlertConfigurationTests(bool isAsync) : base(isAsync) + { + } + + private string FakeGuid => "00000000-0000-0000-0000-000000000000"; + + [Test] + public void CreateAlertConfigurationValidatesArguments() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + Assert.That(() => adminClient.CreateAlertConfigurationAsync(null), Throws.InstanceOf()); + + Assert.That(() => adminClient.CreateAlertConfiguration(null), Throws.InstanceOf()); + } + + [Test] + public void CreateAlertConfigurationRespectsTheCancellationToken() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + var metricConfigs = new List() + { + new MetricAnomalyAlertConfiguration(FakeGuid, MetricAnomalyAlertScope.GetScopeForWholeSeries()) + }; + var config = new AnomalyAlertConfiguration("configName", new List(), metricConfigs); + + using var cancellationSource = new CancellationTokenSource(); + cancellationSource.Cancel(); + + Assert.That(() => adminClient.CreateAlertConfigurationAsync(config, cancellationSource.Token), Throws.InstanceOf()); + Assert.That(() => adminClient.CreateAlertConfiguration(config, cancellationSource.Token), Throws.InstanceOf()); + } + + [Test] + public void UpdateAlertConfigurationValidatesArguments() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + var metricConfigs = new List() + { + new MetricAnomalyAlertConfiguration(FakeGuid, MetricAnomalyAlertScope.GetScopeForWholeSeries()) + }; + var config = new AnomalyAlertConfiguration("configName", new List(), metricConfigs); + + Assert.That(() => adminClient.UpdateAlertConfigurationAsync(null, config), Throws.InstanceOf()); + Assert.That(() => adminClient.UpdateAlertConfigurationAsync("", config), Throws.InstanceOf()); + Assert.That(() => adminClient.UpdateAlertConfigurationAsync("configId", config), Throws.InstanceOf().With.InnerException.TypeOf(typeof(FormatException))); + Assert.That(() => adminClient.UpdateAlertConfigurationAsync(FakeGuid, null), Throws.InstanceOf()); + + Assert.That(() => adminClient.UpdateAlertConfiguration(null, config), Throws.InstanceOf()); + Assert.That(() => adminClient.UpdateAlertConfiguration("", config), Throws.InstanceOf()); + Assert.That(() => adminClient.UpdateAlertConfiguration("configId", config), Throws.InstanceOf().With.InnerException.TypeOf(typeof(FormatException))); + Assert.That(() => adminClient.UpdateAlertConfiguration(FakeGuid, null), Throws.InstanceOf()); + } + + [Test] + public void UpdateAlertConfigurationRespectsTheCancellationToken() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + var metricConfigs = new List() + { + new MetricAnomalyAlertConfiguration(FakeGuid, MetricAnomalyAlertScope.GetScopeForWholeSeries()) + }; + var config = new AnomalyAlertConfiguration("configName", new List(), metricConfigs); + + using var cancellationSource = new CancellationTokenSource(); + cancellationSource.Cancel(); + + Assert.That(() => adminClient.UpdateAlertConfigurationAsync(FakeGuid, config, cancellationSource.Token), Throws.InstanceOf()); + Assert.That(() => adminClient.UpdateAlertConfiguration(FakeGuid, config, cancellationSource.Token), Throws.InstanceOf()); + } + + [Test] + public void GetAlertConfigurationValidatesArguments() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + Assert.That(() => adminClient.GetAlertConfigurationAsync(null), Throws.InstanceOf()); + Assert.That(() => adminClient.GetAlertConfigurationAsync(""), Throws.InstanceOf()); + Assert.That(() => adminClient.GetAlertConfigurationAsync("configId"), Throws.InstanceOf().With.InnerException.TypeOf(typeof(FormatException))); + + Assert.That(() => adminClient.GetAlertConfiguration(null), Throws.InstanceOf()); + Assert.That(() => adminClient.GetAlertConfiguration(""), Throws.InstanceOf()); + Assert.That(() => adminClient.GetAlertConfiguration("configId"), Throws.InstanceOf().With.InnerException.TypeOf(typeof(FormatException))); + } + + [Test] + public void GetAlertConfigurationRespectsTheCancellationToken() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + using var cancellationSource = new CancellationTokenSource(); + cancellationSource.Cancel(); + + Assert.That(() => adminClient.GetAlertConfigurationAsync(FakeGuid, cancellationSource.Token), Throws.InstanceOf()); + Assert.That(() => adminClient.GetAlertConfiguration(FakeGuid, cancellationSource.Token), Throws.InstanceOf()); + } + + [Test] + public void GetAlertConfigurationsValidatesArguments() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + Assert.That(() => adminClient.GetAlertConfigurationsAsync(null), Throws.InstanceOf()); + Assert.That(() => adminClient.GetAlertConfigurationsAsync(""), Throws.InstanceOf()); + Assert.That(() => adminClient.GetAlertConfigurationsAsync("metricId"), Throws.InstanceOf().With.InnerException.TypeOf(typeof(FormatException))); + + Assert.That(() => adminClient.GetAlertConfigurations(null), Throws.InstanceOf()); + Assert.That(() => adminClient.GetAlertConfigurations(""), Throws.InstanceOf()); + Assert.That(() => adminClient.GetAlertConfigurations("metricId"), Throws.InstanceOf().With.InnerException.TypeOf(typeof(FormatException))); + } + + [Test] + public void GetAlertConfigurationsRespectsTheCancellationToken() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + using var cancellationSource = new CancellationTokenSource(); + cancellationSource.Cancel(); + + IAsyncEnumerator asyncEnumerator = adminClient.GetAlertConfigurationsAsync(FakeGuid, cancellationSource.Token).GetAsyncEnumerator(); + Assert.That(async () => await asyncEnumerator.MoveNextAsync(), Throws.InstanceOf()); + + IEnumerator enumerator = adminClient.GetAlertConfigurations(FakeGuid, cancellationSource.Token).GetEnumerator(); + Assert.That(() => enumerator.MoveNext(), Throws.InstanceOf()); + } + + [Test] + public void DeleteAlertConfigurationValidatesArguments() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + Assert.That(() => adminClient.DeleteAlertConfigurationAsync(null), Throws.InstanceOf()); + Assert.That(() => adminClient.DeleteAlertConfigurationAsync(""), Throws.InstanceOf()); + Assert.That(() => adminClient.DeleteAlertConfigurationAsync("configId"), Throws.InstanceOf().With.InnerException.TypeOf(typeof(FormatException))); + + Assert.That(() => adminClient.DeleteAlertConfiguration(null), Throws.InstanceOf()); + Assert.That(() => adminClient.DeleteAlertConfiguration(""), Throws.InstanceOf()); + Assert.That(() => adminClient.DeleteAlertConfiguration("configId"), Throws.InstanceOf().With.InnerException.TypeOf(typeof(FormatException))); + } + + [Test] + public void DeleteAlertConfigurationRespectsTheCancellationToken() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + using var cancellationSource = new CancellationTokenSource(); + cancellationSource.Cancel(); + + Assert.That(() => adminClient.DeleteAlertConfigurationAsync(FakeGuid, cancellationSource.Token), Throws.InstanceOf()); + Assert.That(() => adminClient.DeleteAlertConfiguration(FakeGuid, cancellationSource.Token), Throws.InstanceOf()); + } + + private MetricsAdvisorAdministrationClient GetMetricsAdvisorAdministrationClient() + { + var fakeEndpoint = new Uri("http://notreal.azure.com"); + var fakeCredential = new MetricsAdvisorKeyCredential("fakeSubscriptionKey", "fakeApiKey"); + + return new MetricsAdvisorAdministrationClient(fakeEndpoint, fakeCredential); + } + } +} From 32c6b937594ca30eefe36f5f862dcf81f9291212 Mon Sep 17 00:00:00 2001 From: Caio Saldanha Date: Wed, 16 Dec 2020 11:46:58 -0800 Subject: [PATCH 2/7] Added a disposable alert config class --- .../tests/DisposableAlertConfiguration.cs | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/DisposableAlertConfiguration.cs diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/DisposableAlertConfiguration.cs b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/DisposableAlertConfiguration.cs new file mode 100644 index 0000000000000..b5c7ae9ff878e --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/DisposableAlertConfiguration.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.AI.MetricsAdvisor.Administration; +using Azure.AI.MetricsAdvisor.Models; +using NUnit.Framework; + +namespace Azure.AI.MetricsAdvisor.Tests +{ + /// + /// Represents an that has been created for testing purposes. + /// In order to create a new instance of this class, the + /// static method must be invoked. The created configuration will be deleted upon disposal. + /// + public class DisposableAlertConfiguration : IAsyncDisposable + { + /// + /// The client to use for deleting the configuration upon disposal. + /// + private readonly MetricsAdvisorAdministrationClient _adminClient; + + /// + /// Initializes a new instance of the class. + /// + /// The client to use for deleting the configuration upon disposal. + /// The identifier of the alert configuration this instance is associated with. + private DisposableAlertConfiguration(MetricsAdvisorAdministrationClient adminClient, string id) + { + _adminClient = adminClient; + Id = id; + } + + /// + /// The identifier of the alert configuration this instance is associated with. + /// + public string Id { get; } + + /// + /// Creates an alert configuration using the specified . + /// A instance is returned, from which the ID of the created + /// configuration can be obtained. Upon disposal, the associated configuration will be deleted. + /// + /// The client to use for creating and for deleting the configuration. + /// Specifies how the created should be configured. + /// A instance from which the ID of the created configuration can be obtained. + public static async Task CreateAlertConfigurationAsync(MetricsAdvisorAdministrationClient adminClient, AnomalyAlertConfiguration alertConfiguration) + { + string configId = await adminClient.CreateAlertConfigurationAsync(alertConfiguration); + + Assert.That(configId, Is.Not.Null.And.Not.Empty); + + return new DisposableAlertConfiguration(adminClient, configId); + } + + /// + /// Deletes the configuration this instance is associated with. + /// + public async ValueTask DisposeAsync() => await _adminClient.DeleteAlertConfigurationAsync(Id); + } +} From e15661c48cb801dd0ec3efa685bd942b29eed80e Mon Sep 17 00:00:00 2001 From: Caio Saldanha Date: Mon, 21 Dec 2020 12:29:02 -0800 Subject: [PATCH 3/7] Ongoing live tests --- .../AnomalyAlertConfigurationLiveTests.cs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs new file mode 100644 index 0000000000000..69d59808044ef --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Azure.AI.MetricsAdvisor.Administration; +using Azure.AI.MetricsAdvisor.Models; +using Azure.Core.TestFramework; +using NUnit.Framework; + +namespace Azure.AI.MetricsAdvisor.Tests +{ + public class AnomalyAlertConfigurationLiveTests : MetricsAdvisorLiveTestBase + { + public AnomalyAlertConfigurationLiveTests(bool isAsync) : base(isAsync) + { + } + + [RecordedTest] + public async Task CreateAndGetAlertConfiguration() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + string configName = Recording.GenerateAlphaNumericId("config"); + + var configToCreate = new AnomalyAlertConfiguration(configName, new List(), new List()); + + await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); + + AnomalyAlertConfiguration createdConfig = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + Assert.That(createdConfig.Id, Is.EqualTo(disposableConfig.Id)); + Assert.That(createdConfig.Name, Is.EqualTo(configName)); + Assert.That(createdConfig.Description, Is.Empty); + Assert.That(createdConfig.CrossMetricsOperator, Is.Null); + Assert.That(createdConfig.IdsOfHooksToAlert, Is.Not.Null.And.Empty); + Assert.That(createdConfig.MetricAlertConfigurations, Is.Not.Null); + + var metricAlertConfig = createdConfig.MetricAlertConfigurations.Single(); + } + } +} From 997e78c0b7b41cb7a8e293ff576df59fb48d886d Mon Sep 17 00:00:00 2001 From: Caio Saldanha Date: Mon, 21 Dec 2020 16:40:01 -0800 Subject: [PATCH 4/7] Added Create/Get Alert Config tests --- .../AnomalyAlertConfigurationLiveTests.cs | 295 +++++++++++++++++- 1 file changed, 292 insertions(+), 3 deletions(-) diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs index 69d59808044ef..4b585e7849034 100644 --- a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs @@ -18,13 +18,17 @@ public AnomalyAlertConfigurationLiveTests(bool isAsync) : base(isAsync) } [RecordedTest] - public async Task CreateAndGetAlertConfiguration() + public async Task CreateAndGetAlertConfigurationWithWholeSeriesScope() { MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + var scope = MetricAnomalyAlertScope.GetScopeForWholeSeries(); + var metricAlertConfig = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope); + string configName = Recording.GenerateAlphaNumericId("config"); + var metricAlertConfigs = new List() { metricAlertConfig }; - var configToCreate = new AnomalyAlertConfiguration(configName, new List(), new List()); + var configToCreate = new AnomalyAlertConfiguration(configName, new List(), metricAlertConfigs); await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); @@ -37,7 +41,292 @@ public async Task CreateAndGetAlertConfiguration() Assert.That(createdConfig.IdsOfHooksToAlert, Is.Not.Null.And.Empty); Assert.That(createdConfig.MetricAlertConfigurations, Is.Not.Null); - var metricAlertConfig = createdConfig.MetricAlertConfigurations.Single(); + MetricAnomalyAlertConfiguration createdMetricAlertConfig = createdConfig.MetricAlertConfigurations.Single(); + + Assert.That(createdMetricAlertConfig.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(createdMetricAlertConfig.AlertScope, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(createdMetricAlertConfig.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(createdMetricAlertConfig.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(createdMetricAlertConfig.AlertConditions, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertConditions.MetricBoundaryCondition, Is.Null); + Assert.That(createdMetricAlertConfig.AlertConditions.SeverityCondition, Is.Null); + + Assert.That(createdMetricAlertConfig.AlertSnoozeCondition, Is.Null); + Assert.That(createdMetricAlertConfig.UseDetectionResultToFilterAnomalies, Is.False); + } + + [RecordedTest] + public async Task CreateAndGetAlertConfigurationWithSeriesGroupScope() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + DimensionKey groupKey = new DimensionKey(); + groupKey.AddDimensionColumn("city", "Delhi"); + + var scope = MetricAnomalyAlertScope.GetScopeForSeriesGroup(groupKey); + var metricAlertConfig = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope); + + string configName = Recording.GenerateAlphaNumericId("config"); + var metricAlertConfigs = new List() { metricAlertConfig }; + + var configToCreate = new AnomalyAlertConfiguration(configName, new List(), metricAlertConfigs); + + await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); + + AnomalyAlertConfiguration createdConfig = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + Assert.That(createdConfig.Id, Is.EqualTo(disposableConfig.Id)); + Assert.That(createdConfig.Name, Is.EqualTo(configName)); + Assert.That(createdConfig.Description, Is.Empty); + Assert.That(createdConfig.CrossMetricsOperator, Is.Null); + Assert.That(createdConfig.IdsOfHooksToAlert, Is.Not.Null.And.Empty); + Assert.That(createdConfig.MetricAlertConfigurations, Is.Not.Null); + + MetricAnomalyAlertConfiguration createdMetricAlertConfig = createdConfig.MetricAlertConfigurations.Single(); + + Assert.That(createdMetricAlertConfig.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(createdMetricAlertConfig.AlertScope, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.SeriesGroup)); + Assert.That(createdMetricAlertConfig.AlertScope.TopNGroupInScope, Is.Null); + + ValidateGroupKey(createdMetricAlertConfig.AlertScope.SeriesGroupInScope); + + Dictionary dimensionColumns = createdMetricAlertConfig.AlertScope.SeriesGroupInScope.AsDictionary(); + + Assert.That(dimensionColumns.Count, Is.EqualTo(1)); + Assert.That(dimensionColumns["city"], Is.EqualTo("Delhi")); + + Assert.That(createdMetricAlertConfig.AlertConditions, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertConditions.MetricBoundaryCondition, Is.Null); + Assert.That(createdMetricAlertConfig.AlertConditions.SeverityCondition, Is.Null); + + Assert.That(createdMetricAlertConfig.AlertSnoozeCondition, Is.Null); + Assert.That(createdMetricAlertConfig.UseDetectionResultToFilterAnomalies, Is.False); + } + + [RecordedTest] + public async Task CreateAndGetAlertConfigurationWithTopNScope() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + var topNGroup = new TopNGroupScope(30, 20, 10); + var scope = MetricAnomalyAlertScope.GetScopeForTopNGroup(topNGroup); + var metricAlertConfig = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope); + + string configName = Recording.GenerateAlphaNumericId("config"); + var metricAlertConfigs = new List() { metricAlertConfig }; + + var configToCreate = new AnomalyAlertConfiguration(configName, new List(), metricAlertConfigs); + + await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); + + AnomalyAlertConfiguration createdConfig = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + Assert.That(createdConfig.Id, Is.EqualTo(disposableConfig.Id)); + Assert.That(createdConfig.Name, Is.EqualTo(configName)); + Assert.That(createdConfig.Description, Is.Empty); + Assert.That(createdConfig.CrossMetricsOperator, Is.Null); + Assert.That(createdConfig.IdsOfHooksToAlert, Is.Not.Null.And.Empty); + Assert.That(createdConfig.MetricAlertConfigurations, Is.Not.Null); + + MetricAnomalyAlertConfiguration createdMetricAlertConfig = createdConfig.MetricAlertConfigurations.Single(); + + Assert.That(createdMetricAlertConfig.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(createdMetricAlertConfig.AlertScope, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.TopN)); + Assert.That(createdMetricAlertConfig.AlertScope.SeriesGroupInScope, Is.Null); + + Assert.That(createdMetricAlertConfig.AlertScope.TopNGroupInScope, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertScope.TopNGroupInScope.Top, Is.EqualTo(30)); + Assert.That(createdMetricAlertConfig.AlertScope.TopNGroupInScope.Period, Is.EqualTo(20)); + Assert.That(createdMetricAlertConfig.AlertScope.TopNGroupInScope.MinimumTopCount, Is.EqualTo(10)); + + Assert.That(createdMetricAlertConfig.AlertConditions, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertConditions.MetricBoundaryCondition, Is.Null); + Assert.That(createdMetricAlertConfig.AlertConditions.SeverityCondition, Is.Null); + + Assert.That(createdMetricAlertConfig.AlertSnoozeCondition, Is.Null); + Assert.That(createdMetricAlertConfig.UseDetectionResultToFilterAnomalies, Is.False); + } + + [RecordedTest] + public async Task CreateAndGetAlertConfigurationWithOptionalSingleMetricConfigurationMembers() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + string hookName0 = Recording.GenerateAlphaNumericId("hook"); + string hookName1 = Recording.GenerateAlphaNumericId("hook"); + + var hookToCreate0 = new WebNotificationHook(hookName0, "http://contoso.com"); + var hookToCreate1 = new WebNotificationHook(hookName1, "http://contoso.com"); + + await using var disposableHook0 = await DisposableNotificationHook.CreateHookAsync(adminClient, hookToCreate0); + await using var disposableHook1 = await DisposableNotificationHook.CreateHookAsync(adminClient, hookToCreate1); + + var scope = MetricAnomalyAlertScope.GetScopeForWholeSeries(); + var metricAlertConfig = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + AlertSnoozeCondition = new MetricAnomalyAlertSnoozeCondition(12, SnoozeScope.Series, true), + AlertConditions = new MetricAnomalyAlertConditions() + { + MetricBoundaryCondition = new MetricBoundaryCondition(BoundaryDirection.Both) + { + UpperBound = 20.0, + LowerBound = 10.0, + CompanionMetricId = MetricId, + TriggerForMissing = true + }, + SeverityCondition = new SeverityCondition(AnomalySeverity.Low, AnomalySeverity.Medium) + } + }; + + string configName = Recording.GenerateAlphaNumericId("config"); + var description = "This hook was created to test the .NET client."; + var hookIds = new List(){ disposableHook0.Id, disposableHook1.Id }; + var metricAlertConfigs = new List() { metricAlertConfig }; + + var configToCreate = new AnomalyAlertConfiguration(configName, hookIds, metricAlertConfigs) + { + Description = description + }; + + await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); + + AnomalyAlertConfiguration createdConfig = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + Assert.That(createdConfig.Id, Is.EqualTo(disposableConfig.Id)); + Assert.That(createdConfig.Name, Is.EqualTo(configName)); + Assert.That(createdConfig.Description, Is.EqualTo(description)); + Assert.That(createdConfig.CrossMetricsOperator, Is.Null); + Assert.That(createdConfig.IdsOfHooksToAlert, Is.EqualTo(hookIds)); + Assert.That(createdConfig.MetricAlertConfigurations, Is.Not.Null); + + MetricAnomalyAlertConfiguration createdMetricAlertConfig = createdConfig.MetricAlertConfigurations.Single(); + + Assert.That(createdMetricAlertConfig.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(createdMetricAlertConfig.AlertScope, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(createdMetricAlertConfig.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(createdMetricAlertConfig.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(createdMetricAlertConfig.AlertConditions, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertConditions.MetricBoundaryCondition, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertConditions.MetricBoundaryCondition.Direction, Is.EqualTo(BoundaryDirection.Both)); + Assert.That(createdMetricAlertConfig.AlertConditions.MetricBoundaryCondition.UpperBound, Is.EqualTo(20.0)); + Assert.That(createdMetricAlertConfig.AlertConditions.MetricBoundaryCondition.LowerBound, Is.EqualTo(10.0)); + Assert.That(createdMetricAlertConfig.AlertConditions.MetricBoundaryCondition.CompanionMetricId, Is.EqualTo(MetricId)); + Assert.That(createdMetricAlertConfig.AlertConditions.MetricBoundaryCondition.TriggerForMissing, Is.True); + Assert.That(createdMetricAlertConfig.AlertConditions.SeverityCondition, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertConditions.SeverityCondition.MinimumAlertSeverity, Is.EqualTo(AnomalySeverity.Low)); + Assert.That(createdMetricAlertConfig.AlertConditions.SeverityCondition.MaximumAlertSeverity, Is.EqualTo(AnomalySeverity.Medium)); + + Assert.That(createdMetricAlertConfig.AlertSnoozeCondition, Is.Not.Null); + Assert.That(createdMetricAlertConfig.AlertSnoozeCondition.AutoSnooze, Is.EqualTo(12)); + Assert.That(createdMetricAlertConfig.AlertSnoozeCondition.SnoozeScope, Is.EqualTo(SnoozeScope.Series)); + Assert.That(createdMetricAlertConfig.AlertSnoozeCondition.IsOnlyForSuccessive, Is.True); + + Assert.That(createdMetricAlertConfig.UseDetectionResultToFilterAnomalies, Is.False); + } + + [RecordedTest] + public async Task CreateAndGetAlertConfigurationWithMultipleMetricConfigurations() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + // Configure the Metric Anomaly Alert Configurations to be used. + + var scope = MetricAnomalyAlertScope.GetScopeForWholeSeries(); + var metricAlertConfig0 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + AlertConditions = new MetricAnomalyAlertConditions() + { + MetricBoundaryCondition = new MetricBoundaryCondition(BoundaryDirection.Up) { UpperBound = 20.0 } + }, + UseDetectionResultToFilterAnomalies = true + }; + var metricAlertConfig1 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + AlertConditions = new MetricAnomalyAlertConditions() + { + MetricBoundaryCondition = new MetricBoundaryCondition(BoundaryDirection.Down) { LowerBound = 10.0 } + } + }; + + // Create the Anomaly Alert Configuration. + + string configName = Recording.GenerateAlphaNumericId("config"); + var metricAlertConfigs = new List() { metricAlertConfig0, metricAlertConfig1 }; + + var configToCreate = new AnomalyAlertConfiguration(configName, new List(), metricAlertConfigs) + { + CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.Xor + }; + + await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); + + // Get the created configuration and validate top-level members. + + AnomalyAlertConfiguration createdConfig = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + Assert.That(createdConfig.Id, Is.EqualTo(disposableConfig.Id)); + Assert.That(createdConfig.Name, Is.EqualTo(configName)); + Assert.That(createdConfig.Description, Is.Empty); + Assert.That(createdConfig.CrossMetricsOperator, Is.EqualTo(MetricAnomalyAlertConfigurationsOperator.Xor)); + Assert.That(createdConfig.IdsOfHooksToAlert, Is.Not.Null.And.Empty); + Assert.That(createdConfig.MetricAlertConfigurations, Is.Not.Null); + Assert.That(createdConfig.MetricAlertConfigurations.Count, Is.EqualTo(2)); + + // Validate the first Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration createdMetricAlertConfig0 = createdConfig.MetricAlertConfigurations[0]; + + Assert.That(createdMetricAlertConfig0.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(createdMetricAlertConfig0.AlertScope, Is.Not.Null); + Assert.That(createdMetricAlertConfig0.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(createdMetricAlertConfig0.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(createdMetricAlertConfig0.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(createdMetricAlertConfig0.AlertConditions, Is.Not.Null); + Assert.That(createdMetricAlertConfig0.AlertConditions.MetricBoundaryCondition, Is.Not.Null); + Assert.That(createdMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.Direction, Is.EqualTo(BoundaryDirection.Up)); + Assert.That(createdMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.UpperBound, Is.EqualTo(20.0)); + Assert.That(createdMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.LowerBound, Is.Null); + Assert.That(createdMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.CompanionMetricId, Is.Null); + Assert.That(createdMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.TriggerForMissing, Is.False); + Assert.That(createdMetricAlertConfig0.AlertConditions.SeverityCondition, Is.Null); + + Assert.That(createdMetricAlertConfig0.AlertSnoozeCondition, Is.Null); + Assert.That(createdMetricAlertConfig0.UseDetectionResultToFilterAnomalies, Is.True); + + // Validate the second Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration createdMetricAlertConfig1 = createdConfig.MetricAlertConfigurations[1]; + + Assert.That(createdMetricAlertConfig1.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(createdMetricAlertConfig1.AlertScope, Is.Not.Null); + Assert.That(createdMetricAlertConfig1.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(createdMetricAlertConfig1.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(createdMetricAlertConfig1.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(createdMetricAlertConfig1.AlertConditions, Is.Not.Null); + Assert.That(createdMetricAlertConfig1.AlertConditions.MetricBoundaryCondition, Is.Not.Null); + Assert.That(createdMetricAlertConfig1.AlertConditions.MetricBoundaryCondition.Direction, Is.EqualTo(BoundaryDirection.Down)); + Assert.That(createdMetricAlertConfig1.AlertConditions.MetricBoundaryCondition.UpperBound, Is.Null); + Assert.That(createdMetricAlertConfig1.AlertConditions.MetricBoundaryCondition.LowerBound, Is.EqualTo(10.0)); + Assert.That(createdMetricAlertConfig1.AlertConditions.MetricBoundaryCondition.CompanionMetricId, Is.Null); + Assert.That(createdMetricAlertConfig1.AlertConditions.MetricBoundaryCondition.TriggerForMissing, Is.False); + Assert.That(createdMetricAlertConfig1.AlertConditions.SeverityCondition, Is.Null); + + Assert.That(createdMetricAlertConfig1.AlertSnoozeCondition, Is.Null); + Assert.That(createdMetricAlertConfig1.UseDetectionResultToFilterAnomalies, Is.False); } } } From f93867a0896730185247fe6bb1c85dc836a4db7a Mon Sep 17 00:00:00 2001 From: Caio Saldanha Date: Mon, 21 Dec 2020 18:25:30 -0800 Subject: [PATCH 5/7] Added final tests --- .../AnomalyAlertConfigurationLiveTests.cs | 655 ++++++++++++++++++ 1 file changed, 655 insertions(+) diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs index 4b585e7849034..c9667ef932ce7 100644 --- a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClient/AnomalyAlertConfigurationLiveTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -328,5 +329,659 @@ public async Task CreateAndGetAlertConfigurationWithMultipleMetricConfigurations Assert.That(createdMetricAlertConfig1.AlertSnoozeCondition, Is.Null); Assert.That(createdMetricAlertConfig1.UseDetectionResultToFilterAnomalies, Is.False); } + + [RecordedTest] + public async Task UpdateAlertConfigurationWithMinimumSetupAndGetInstance() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + // Configure the Metric Anomaly Alert Configurations to be used. + + string hookName = Recording.GenerateAlphaNumericId("hook"); + var hookToCreate = new WebNotificationHook(hookName, "http://contoso.com"); + await using var disposableHook = await DisposableNotificationHook.CreateHookAsync(adminClient, hookToCreate); + + var scope = MetricAnomalyAlertScope.GetScopeForWholeSeries(); + var metricAlertConfig0 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + AlertSnoozeCondition = new MetricAnomalyAlertSnoozeCondition(12, SnoozeScope.Series, true), + AlertConditions = new MetricAnomalyAlertConditions() + { + MetricBoundaryCondition = new MetricBoundaryCondition(BoundaryDirection.Both) + { + UpperBound = 20.0, + LowerBound = 10.0, + CompanionMetricId = MetricId, + TriggerForMissing = true + }, + SeverityCondition = new SeverityCondition(AnomalySeverity.Low, AnomalySeverity.Medium) + } + }; + var metricAlertConfig1 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + UseDetectionResultToFilterAnomalies = true + }; + + // Create the Anomaly Alert Configuration. + + string configName = Recording.GenerateAlphaNumericId("config"); + var hookIds = new List() { disposableHook.Id }; + var metricAlertConfigs = new List() { metricAlertConfig0, metricAlertConfig1 }; + + var configToCreate = new AnomalyAlertConfiguration(configName, hookIds, metricAlertConfigs) + { + CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.Xor + }; + + await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); + + // Update the created configuration. + + AnomalyAlertConfiguration configToUpdate = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + configToUpdate.CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.Or; + + await adminClient.UpdateAlertConfigurationAsync(disposableConfig.Id, configToUpdate); + + // Get the updated configuration and validate top-level members. + + AnomalyAlertConfiguration updatedConfig = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + Assert.That(updatedConfig.Id, Is.EqualTo(disposableConfig.Id)); + Assert.That(updatedConfig.Name, Is.EqualTo(configName)); + Assert.That(updatedConfig.Description, Is.Empty); + Assert.That(updatedConfig.CrossMetricsOperator, Is.EqualTo(MetricAnomalyAlertConfigurationsOperator.Or)); + Assert.That(updatedConfig.IdsOfHooksToAlert, Is.EqualTo(hookIds)); + Assert.That(updatedConfig.MetricAlertConfigurations, Is.Not.Null); + Assert.That(updatedConfig.MetricAlertConfigurations.Count, Is.EqualTo(2)); + + // Validate the first Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration updatedMetricAlertConfig0 = updatedConfig.MetricAlertConfigurations[0]; + + Assert.That(updatedMetricAlertConfig0.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(updatedMetricAlertConfig0.AlertScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(updatedMetricAlertConfig0.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(updatedMetricAlertConfig0.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(updatedMetricAlertConfig0.AlertConditions, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.Direction, Is.EqualTo(BoundaryDirection.Both)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.UpperBound, Is.EqualTo(20.0)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.LowerBound, Is.EqualTo(10.0)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.CompanionMetricId, Is.EqualTo(MetricId)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.TriggerForMissing, Is.True); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition.MinimumAlertSeverity, Is.EqualTo(AnomalySeverity.Low)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition.MaximumAlertSeverity, Is.EqualTo(AnomalySeverity.Medium)); + + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition.AutoSnooze, Is.EqualTo(12)); + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition.SnoozeScope, Is.EqualTo(SnoozeScope.Series)); + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition.IsOnlyForSuccessive, Is.True); + + Assert.That(updatedMetricAlertConfig0.UseDetectionResultToFilterAnomalies, Is.False); + + // Validate the second Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration updatedMetricAlertConfig1 = updatedConfig.MetricAlertConfigurations[1]; + + Assert.That(updatedMetricAlertConfig1.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(updatedMetricAlertConfig1.AlertScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(updatedMetricAlertConfig1.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(updatedMetricAlertConfig1.AlertConditions, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertConditions.MetricBoundaryCondition, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertConditions.SeverityCondition, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition, Is.Null); + Assert.That(updatedMetricAlertConfig1.UseDetectionResultToFilterAnomalies, Is.True); + } + + [RecordedTest] + public async Task UpdateAlertConfigurationWithMinimumSetupAndNewInstance() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + // Configure the Metric Anomaly Alert Configurations to be used. + + string hookName = Recording.GenerateAlphaNumericId("hook"); + var hookToCreate = new WebNotificationHook(hookName, "http://contoso.com"); + await using var disposableHook = await DisposableNotificationHook.CreateHookAsync(adminClient, hookToCreate); + + var scope = MetricAnomalyAlertScope.GetScopeForWholeSeries(); + var metricAlertConfig0 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + AlertSnoozeCondition = new MetricAnomalyAlertSnoozeCondition(12, SnoozeScope.Series, true), + AlertConditions = new MetricAnomalyAlertConditions() + { + MetricBoundaryCondition = new MetricBoundaryCondition(BoundaryDirection.Both) + { + UpperBound = 20.0, + LowerBound = 10.0, + CompanionMetricId = MetricId, + TriggerForMissing = true + }, + SeverityCondition = new SeverityCondition(AnomalySeverity.Low, AnomalySeverity.Medium) + } + }; + var metricAlertConfig1 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + UseDetectionResultToFilterAnomalies = true + }; + + // Create the Anomaly Alert Configuration. + + string configName = Recording.GenerateAlphaNumericId("config"); + var hookIds = new List() { disposableHook.Id }; + var metricAlertConfigs = new List() { metricAlertConfig0, metricAlertConfig1 }; + + var configToCreate = new AnomalyAlertConfiguration(configName, hookIds, metricAlertConfigs) + { + CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.Xor + }; + + await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); + + // Update the created configuration. + + var configToUpdate = new AnomalyAlertConfiguration(configName, hookIds, metricAlertConfigs); + + configToUpdate.CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.Or; + + await adminClient.UpdateAlertConfigurationAsync(disposableConfig.Id, configToUpdate); + + // Get the updated configuration and validate top-level members. + + AnomalyAlertConfiguration updatedConfig = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + Assert.That(updatedConfig.Id, Is.EqualTo(disposableConfig.Id)); + Assert.That(updatedConfig.Name, Is.EqualTo(configName)); + Assert.That(updatedConfig.Description, Is.Empty); + Assert.That(updatedConfig.CrossMetricsOperator, Is.EqualTo(MetricAnomalyAlertConfigurationsOperator.Or)); + Assert.That(updatedConfig.IdsOfHooksToAlert, Is.EqualTo(hookIds)); + Assert.That(updatedConfig.MetricAlertConfigurations, Is.Not.Null); + Assert.That(updatedConfig.MetricAlertConfigurations.Count, Is.EqualTo(2)); + + // Validate the first Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration updatedMetricAlertConfig0 = updatedConfig.MetricAlertConfigurations[0]; + + Assert.That(updatedMetricAlertConfig0.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(updatedMetricAlertConfig0.AlertScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(updatedMetricAlertConfig0.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(updatedMetricAlertConfig0.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(updatedMetricAlertConfig0.AlertConditions, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.Direction, Is.EqualTo(BoundaryDirection.Both)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.UpperBound, Is.EqualTo(20.0)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.LowerBound, Is.EqualTo(10.0)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.CompanionMetricId, Is.EqualTo(MetricId)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.TriggerForMissing, Is.True); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition.MinimumAlertSeverity, Is.EqualTo(AnomalySeverity.Low)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition.MaximumAlertSeverity, Is.EqualTo(AnomalySeverity.Medium)); + + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition.AutoSnooze, Is.EqualTo(12)); + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition.SnoozeScope, Is.EqualTo(SnoozeScope.Series)); + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition.IsOnlyForSuccessive, Is.True); + + Assert.That(updatedMetricAlertConfig0.UseDetectionResultToFilterAnomalies, Is.False); + + // Validate the second Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration updatedMetricAlertConfig1 = updatedConfig.MetricAlertConfigurations[1]; + + Assert.That(updatedMetricAlertConfig1.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(updatedMetricAlertConfig1.AlertScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(updatedMetricAlertConfig1.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(updatedMetricAlertConfig1.AlertConditions, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertConditions.MetricBoundaryCondition, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertConditions.SeverityCondition, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition, Is.Null); + Assert.That(updatedMetricAlertConfig1.UseDetectionResultToFilterAnomalies, Is.True); + } + + [RecordedTest] + public async Task UpdateAlertConfigurationWithEveryMemberAndGetInstance() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + // Configure the Metric Anomaly Alert Configurations to be used. + + string hookName = Recording.GenerateAlphaNumericId("hook"); + var hookToCreate = new WebNotificationHook(hookName, "http://contoso.com"); + await using var disposableHook = await DisposableNotificationHook.CreateHookAsync(adminClient, hookToCreate); + + var scope = MetricAnomalyAlertScope.GetScopeForWholeSeries(); + var metricAlertConfig0 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + AlertSnoozeCondition = new MetricAnomalyAlertSnoozeCondition(12, SnoozeScope.Series, true), + AlertConditions = new MetricAnomalyAlertConditions() + { + MetricBoundaryCondition = new MetricBoundaryCondition(BoundaryDirection.Both) + { + UpperBound = 20.0, + LowerBound = 10.0, + CompanionMetricId = MetricId, + TriggerForMissing = true + }, + SeverityCondition = new SeverityCondition(AnomalySeverity.Low, AnomalySeverity.Medium) + } + }; + var metricAlertConfig1 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + UseDetectionResultToFilterAnomalies = true + }; + + // Create the Anomaly Alert Configuration. + + string configName = Recording.GenerateAlphaNumericId("config"); + var description = "This hook was created to test the .NET client."; + var hookIds = new List() { disposableHook.Id }; + var metricAlertConfigs = new List() { metricAlertConfig0, metricAlertConfig1 }; + + var configToCreate = new AnomalyAlertConfiguration(configName, hookIds, metricAlertConfigs) + { + CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.Xor + }; + + await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); + + // Update the created configuration. + + AnomalyAlertConfiguration configToUpdate = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + configToUpdate.Description = description; + configToUpdate.IdsOfHooksToAlert.Clear(); + configToUpdate.CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.And; + configToUpdate.MetricAlertConfigurations.RemoveAt(1); + + var newScope = MetricAnomalyAlertScope.GetScopeForTopNGroup(new TopNGroupScope(50, 40, 30)); + var newMetricAlertConfig = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, newScope) + { + AlertSnoozeCondition = new MetricAnomalyAlertSnoozeCondition(4, SnoozeScope.Metric, true), + UseDetectionResultToFilterAnomalies = true + }; + configToUpdate.MetricAlertConfigurations.Add(newMetricAlertConfig); + + MetricAnomalyAlertConfiguration metricAlertConfigToUpdate = configToUpdate.MetricAlertConfigurations[0]; + + metricAlertConfigToUpdate.AlertConditions.MetricBoundaryCondition.UpperBound = 15.0; + metricAlertConfigToUpdate.AlertConditions.MetricBoundaryCondition.LowerBound = 5.0; + metricAlertConfigToUpdate.AlertConditions.MetricBoundaryCondition.CompanionMetricId = null; + metricAlertConfigToUpdate.AlertConditions.MetricBoundaryCondition.TriggerForMissing = false; + + metricAlertConfigToUpdate.AlertConditions.SeverityCondition = new SeverityCondition(AnomalySeverity.Medium, AnomalySeverity.High); + + metricAlertConfigToUpdate.AlertSnoozeCondition = null; + + await adminClient.UpdateAlertConfigurationAsync(disposableConfig.Id, configToUpdate); + + // Get the updated configuration and validate top-level members. + + AnomalyAlertConfiguration updatedConfig = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + Assert.That(updatedConfig.Id, Is.EqualTo(disposableConfig.Id)); + Assert.That(updatedConfig.Name, Is.EqualTo(configName)); + Assert.That(updatedConfig.Description, Is.EqualTo(description)); + Assert.That(updatedConfig.CrossMetricsOperator, Is.EqualTo(MetricAnomalyAlertConfigurationsOperator.And)); + Assert.That(updatedConfig.IdsOfHooksToAlert, Is.Not.Null.And.Empty); + Assert.That(updatedConfig.MetricAlertConfigurations, Is.Not.Null); + + // Validate the first Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration updatedMetricAlertConfig0 = updatedConfig.MetricAlertConfigurations[0]; + + Assert.That(updatedMetricAlertConfig0.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(updatedMetricAlertConfig0.AlertScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(updatedMetricAlertConfig0.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(updatedMetricAlertConfig0.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(updatedMetricAlertConfig0.AlertConditions, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.Direction, Is.EqualTo(BoundaryDirection.Both)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.UpperBound, Is.EqualTo(15.0)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.LowerBound, Is.EqualTo(5.0)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.CompanionMetricId, Is.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.TriggerForMissing, Is.False); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition.MinimumAlertSeverity, Is.EqualTo(AnomalySeverity.Medium)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition.MaximumAlertSeverity, Is.EqualTo(AnomalySeverity.High)); + + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition, Is.Null); + Assert.That(updatedMetricAlertConfig0.UseDetectionResultToFilterAnomalies, Is.False); + + // Validate the second Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration updatedMetricAlertConfig1 = updatedConfig.MetricAlertConfigurations[1]; + + Assert.That(updatedMetricAlertConfig1.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(updatedMetricAlertConfig1.AlertScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.TopN)); + Assert.That(updatedMetricAlertConfig1.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope.Top, Is.EqualTo(50)); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope.Period, Is.EqualTo(40)); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope.MinimumTopCount, Is.EqualTo(30)); + + Assert.That(updatedMetricAlertConfig1.AlertConditions, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertConditions.MetricBoundaryCondition, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertConditions.SeverityCondition, Is.Null); + + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition.AutoSnooze, Is.EqualTo(4)); + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition.SnoozeScope, Is.EqualTo(SnoozeScope.Metric)); + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition.IsOnlyForSuccessive, Is.True); + + Assert.That(updatedMetricAlertConfig1.UseDetectionResultToFilterAnomalies, Is.True); + } + + [RecordedTest] + public async Task UpdateAlertConfigurationWithEveryMemberAndNewInstance() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + // Configure the Metric Anomaly Alert Configurations to be used. + + string hookName = Recording.GenerateAlphaNumericId("hook"); + var hookToCreate = new WebNotificationHook(hookName, "http://contoso.com"); + await using var disposableHook = await DisposableNotificationHook.CreateHookAsync(adminClient, hookToCreate); + + var scope = MetricAnomalyAlertScope.GetScopeForWholeSeries(); + var metricAlertConfig0 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + AlertSnoozeCondition = new MetricAnomalyAlertSnoozeCondition(12, SnoozeScope.Series, true), + AlertConditions = new MetricAnomalyAlertConditions() + { + MetricBoundaryCondition = new MetricBoundaryCondition(BoundaryDirection.Both) + { + UpperBound = 20.0, + LowerBound = 10.0, + CompanionMetricId = MetricId, + TriggerForMissing = true + }, + SeverityCondition = new SeverityCondition(AnomalySeverity.Low, AnomalySeverity.Medium) + } + }; + var metricAlertConfig1 = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, scope) + { + UseDetectionResultToFilterAnomalies = true + }; + + // Create the Anomaly Alert Configuration. + + string configName = Recording.GenerateAlphaNumericId("config"); + var description = "This hook was created to test the .NET client."; + var hookIds = new List() { disposableHook.Id }; + var metricAlertConfigs = new List() { metricAlertConfig0, metricAlertConfig1 }; + + var configToCreate = new AnomalyAlertConfiguration(configName, hookIds, metricAlertConfigs) + { + CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.Xor + }; + + await using var disposableConfig = await DisposableAlertConfiguration.CreateAlertConfigurationAsync(adminClient, configToCreate); + + // Update the created configuration. + + AnomalyAlertConfiguration configToUpdate = new AnomalyAlertConfiguration(configName, hookIds, metricAlertConfigs); + + configToUpdate.Description = description; + configToUpdate.IdsOfHooksToAlert.Clear(); + configToUpdate.CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.And; + configToUpdate.MetricAlertConfigurations.RemoveAt(1); + + var newScope = MetricAnomalyAlertScope.GetScopeForTopNGroup(new TopNGroupScope(50, 40, 30)); + var newMetricAlertConfig = new MetricAnomalyAlertConfiguration(DetectionConfigurationId, newScope) + { + AlertSnoozeCondition = new MetricAnomalyAlertSnoozeCondition(4, SnoozeScope.Metric, true), + UseDetectionResultToFilterAnomalies = true + }; + configToUpdate.MetricAlertConfigurations.Add(newMetricAlertConfig); + + MetricAnomalyAlertConfiguration metricAlertConfigToUpdate = configToUpdate.MetricAlertConfigurations[0]; + + metricAlertConfigToUpdate.AlertConditions.MetricBoundaryCondition.UpperBound = 15.0; + metricAlertConfigToUpdate.AlertConditions.MetricBoundaryCondition.LowerBound = 5.0; + metricAlertConfigToUpdate.AlertConditions.MetricBoundaryCondition.CompanionMetricId = null; + metricAlertConfigToUpdate.AlertConditions.MetricBoundaryCondition.TriggerForMissing = false; + + metricAlertConfigToUpdate.AlertConditions.SeverityCondition = new SeverityCondition(AnomalySeverity.Medium, AnomalySeverity.High); + + metricAlertConfigToUpdate.AlertSnoozeCondition = null; + + await adminClient.UpdateAlertConfigurationAsync(disposableConfig.Id, configToUpdate); + + // Get the updated configuration and validate top-level members. + + AnomalyAlertConfiguration updatedConfig = await adminClient.GetAlertConfigurationAsync(disposableConfig.Id); + + Assert.That(updatedConfig.Id, Is.EqualTo(disposableConfig.Id)); + Assert.That(updatedConfig.Name, Is.EqualTo(configName)); + Assert.That(updatedConfig.Description, Is.EqualTo(description)); + Assert.That(updatedConfig.CrossMetricsOperator, Is.EqualTo(MetricAnomalyAlertConfigurationsOperator.And)); + Assert.That(updatedConfig.IdsOfHooksToAlert, Is.Not.Null.And.Empty); + Assert.That(updatedConfig.MetricAlertConfigurations, Is.Not.Null); + + // Validate the first Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration updatedMetricAlertConfig0 = updatedConfig.MetricAlertConfigurations[0]; + + Assert.That(updatedMetricAlertConfig0.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(updatedMetricAlertConfig0.AlertScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.WholeSeries)); + Assert.That(updatedMetricAlertConfig0.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(updatedMetricAlertConfig0.AlertScope.TopNGroupInScope, Is.Null); + + Assert.That(updatedMetricAlertConfig0.AlertConditions, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.Direction, Is.EqualTo(BoundaryDirection.Both)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.UpperBound, Is.EqualTo(15.0)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.LowerBound, Is.EqualTo(5.0)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.CompanionMetricId, Is.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.MetricBoundaryCondition.TriggerForMissing, Is.False); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition.MinimumAlertSeverity, Is.EqualTo(AnomalySeverity.Medium)); + Assert.That(updatedMetricAlertConfig0.AlertConditions.SeverityCondition.MaximumAlertSeverity, Is.EqualTo(AnomalySeverity.High)); + + Assert.That(updatedMetricAlertConfig0.AlertSnoozeCondition, Is.Null); + Assert.That(updatedMetricAlertConfig0.UseDetectionResultToFilterAnomalies, Is.False); + + // Validate the second Metric Anomaly Alert Configuration. + + MetricAnomalyAlertConfiguration updatedMetricAlertConfig1 = updatedConfig.MetricAlertConfigurations[1]; + + Assert.That(updatedMetricAlertConfig1.DetectionConfigurationId, Is.EqualTo(DetectionConfigurationId)); + + Assert.That(updatedMetricAlertConfig1.AlertScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.ScopeType, Is.EqualTo(MetricAnomalyAlertScopeType.TopN)); + Assert.That(updatedMetricAlertConfig1.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope.Top, Is.EqualTo(50)); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope.Period, Is.EqualTo(40)); + Assert.That(updatedMetricAlertConfig1.AlertScope.TopNGroupInScope.MinimumTopCount, Is.EqualTo(30)); + + Assert.That(updatedMetricAlertConfig1.AlertConditions, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertConditions.MetricBoundaryCondition, Is.Null); + Assert.That(updatedMetricAlertConfig1.AlertConditions.SeverityCondition, Is.Null); + + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition, Is.Not.Null); + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition.AutoSnooze, Is.EqualTo(4)); + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition.SnoozeScope, Is.EqualTo(SnoozeScope.Metric)); + Assert.That(updatedMetricAlertConfig1.AlertSnoozeCondition.IsOnlyForSuccessive, Is.True); + + Assert.That(updatedMetricAlertConfig1.UseDetectionResultToFilterAnomalies, Is.True); + } + + [RecordedTest] + public async Task GetAlertConfigurations() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + var configCount = 0; + + await foreach (AnomalyAlertConfiguration config in adminClient.GetAlertConfigurationsAsync(DetectionConfigurationId)) + { + Assert.That(config.Id, Is.Not.Null.And.Not.Empty); + Assert.That(config.Name, Is.Not.Null.And.Not.Empty); + Assert.That(config.Description, Is.Not.Null); + Assert.That(config.IdsOfHooksToAlert, Is.Not.Null); + Assert.That(config.MetricAlertConfigurations, Is.Not.Null.And.Not.Empty); + + if (config.MetricAlertConfigurations.Count == 1) + { + Assert.That(config.CrossMetricsOperator, Is.Null); + } + else if (config.MetricAlertConfigurations.Count == 2) + { + Assert.That(config.CrossMetricsOperator, Is.Not.Null); + Assert.That(config.CrossMetricsOperator, Is.Not.EqualTo(default(MetricAnomalyAlertConfigurationsOperator))); + } + else + { + Assert.That(config.CrossMetricsOperator, Is.Not.Null); + Assert.That(config.CrossMetricsOperator, Is.Not.EqualTo(default(MetricAnomalyAlertConfigurationsOperator))); + Assert.That(config.CrossMetricsOperator, Is.Not.EqualTo(MetricAnomalyAlertConfigurationsOperator.Xor)); + } + + foreach (string hookId in config.IdsOfHooksToAlert) + { + Assert.That(hookId, Is.Not.Null.And.Not.Empty); + } + + foreach (MetricAnomalyAlertConfiguration metricConfig in config.MetricAlertConfigurations) + { + ValidateMetricAnomalyAlertConfiguration(metricConfig); + } + + if (++configCount >= MaximumSamplesCount) + { + break; + } + } + + Assert.That(configCount, Is.GreaterThan(0)); + } + + [RecordedTest] + public async Task DeleteAlertConfiguration() + { + MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); + + string configName = Recording.GenerateAlphaNumericId("config"); + var scope = MetricAnomalyAlertScope.GetScopeForWholeSeries(); + var metricAlertConfigs = new List() { new (DetectionConfigurationId, scope) }; + var configToCreate = new AnomalyAlertConfiguration(DetectionConfigurationId, new List(), metricAlertConfigs); + + string configId = null; + + try + { + configId = await adminClient.CreateAlertConfigurationAsync(configToCreate); + + Assert.That(configId, Is.Not.Null.And.Not.Empty); + } + finally + { + if (configId != null) + { + await adminClient.DeleteAlertConfigurationAsync(configId); + + var errorCause = "Not Found"; + Assert.That(async () => await adminClient.GetAlertConfigurationAsync(configId), Throws.InstanceOf().With.Message.Contains(errorCause)); + } + } + } + + private void ValidateMetricAnomalyAlertConfiguration(MetricAnomalyAlertConfiguration configuration) + { + Assert.That(configuration.DetectionConfigurationId, Is.Not.Null.And.Not.Empty); + Assert.That(configuration.AlertScope, Is.Not.Null); + + if (configuration.AlertScope.ScopeType == MetricAnomalyAlertScopeType.WholeSeries) + { + Assert.That(configuration.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(configuration.AlertScope.TopNGroupInScope, Is.Null); + } + else if (configuration.AlertScope.ScopeType == MetricAnomalyAlertScopeType.SeriesGroup) + { + Assert.That(configuration.AlertScope.TopNGroupInScope, Is.Null); + ValidateGroupKey(configuration.AlertScope.SeriesGroupInScope); + } + else if (configuration.AlertScope.ScopeType == MetricAnomalyAlertScopeType.TopN) + { + Assert.That(configuration.AlertScope.SeriesGroupInScope, Is.Null); + Assert.That(configuration.AlertScope.TopNGroupInScope, Is.Not.Null); + } + else + { + throw new ArgumentOutOfRangeException("Invalid ScopeType value!"); + } + + Assert.That(configuration.AlertConditions, Is.Not.Null); + + MetricBoundaryCondition boundaryCondition = configuration.AlertConditions.MetricBoundaryCondition; + SeverityCondition severityCondition = configuration.AlertConditions.SeverityCondition; + + if (boundaryCondition != null) + { + if (boundaryCondition.Direction == BoundaryDirection.Up) + { + Assert.That(boundaryCondition.UpperBound, Is.Not.Null); + Assert.That(boundaryCondition.LowerBound, Is.Null); + } + else if (boundaryCondition.Direction == BoundaryDirection.Down) + { + Assert.That(boundaryCondition.UpperBound, Is.Null); + Assert.That(boundaryCondition.LowerBound, Is.Not.Null); + } + else if (boundaryCondition.Direction == BoundaryDirection.Both) + { + Assert.That(boundaryCondition.UpperBound, Is.Not.Null); + Assert.That(boundaryCondition.LowerBound, Is.Not.Null); + } + else + { + throw new ArgumentOutOfRangeException("Invalid BoundaryDirection value!"); + } + + if (boundaryCondition.CompanionMetricId != null) + { + Assert.That(boundaryCondition.CompanionMetricId, Is.Not.Empty); + } + + Assert.That(boundaryCondition.TriggerForMissing, Is.Not.Null); + } + + if (severityCondition != null) + { + Assert.That(severityCondition.MinimumAlertSeverity, Is.Not.EqualTo(default(AnomalySeverity))); + Assert.That(severityCondition.MaximumAlertSeverity, Is.Not.EqualTo(default(AnomalySeverity))); + } + + if (configuration.AlertSnoozeCondition != null) + { + Assert.That(configuration.AlertSnoozeCondition.SnoozeScope, Is.Not.EqualTo(default(SnoozeScope))); + } + + Assert.That(configuration.UseDetectionResultToFilterAnomalies, Is.Not.Null); + } } } From f9db5fff5d3c84f37aaf0f5b64a38af4a3433449 Mon Sep 17 00:00:00 2001 From: Caio Saldanha Date: Mon, 21 Dec 2020 18:27:10 -0800 Subject: [PATCH 6/7] Removed old tests --- ...icsAdvisorAdministrationClientLiveTests.cs | 67 -- .../AnomalyAlertConfigurationOperations.json | 642 ------------------ ...malyAlertConfigurationOperationsAsync.json | 642 ------------------ 3 files changed, 1351 deletions(-) delete mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/MetricsAdvisorAdministrationClientLiveTests/AnomalyAlertConfigurationOperations.json delete mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/MetricsAdvisorAdministrationClientLiveTests/AnomalyAlertConfigurationOperationsAsync.json diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClientLiveTests.cs b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClientLiveTests.cs index 574dc46902f8b..356d84ba8bda0 100644 --- a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClientLiveTests.cs +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/MetricsAdvisorAdministrationClientLiveTests.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Azure.AI.MetricsAdvisor.Models; using Azure.Core.TestFramework; @@ -153,72 +152,6 @@ public async Task GetDataFeedIngestionProgress() Assert.That(progress, Is.Not.Null); } - [RecordedTest] - public async Task AnomalyAlertConfigurationOperations() - { - var adminClient = GetMetricsAdvisorAdministrationClient(); - - // Create a Detection Configuration - DataFeed feed = await GetFirstDataFeed(adminClient); - string createdAnomalyDetectionConfigurationId = await CreateDetectionConfiguration(adminClient).ConfigureAwait(false); - - var alertConfigToCreate = new AnomalyAlertConfiguration( - Recording.GenerateAlphaNumericId("test"), - new List(), - new List - { - new MetricAnomalyAlertConfiguration( - createdAnomalyDetectionConfigurationId, - new MetricAnomalyAlertScope( - MetricAnomalyAlertScopeType.TopN, - new DimensionKey(new List> - { - new KeyValuePair("test", "test2") - }), - new TopNGroupScope(8, 4, 2))) - }); - - string createdAlertConfigId = await adminClient.CreateAlertConfigurationAsync(alertConfigToCreate).ConfigureAwait(false); - - Assert.That(createdAlertConfigId, Is.Not.Null); - - // Validate that we can Get the newly created config - AnomalyAlertConfiguration getAlertConfig = await adminClient.GetAlertConfigurationAsync(createdAlertConfigId).ConfigureAwait(false); - - List getAlertConfigs = new List(); - - await foreach (var config in adminClient.GetAlertConfigurationsAsync(createdAnomalyDetectionConfigurationId)) - { - getAlertConfigs.Add(config); - } - - Assert.That(getAlertConfig.Id, Is.EqualTo(createdAlertConfigId)); - Assert.That(getAlertConfigs.Any(c => c.Id == createdAlertConfigId)); - - getAlertConfig.Description = "Updated"; - getAlertConfig.CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.And; - - await adminClient.UpdateAlertConfigurationAsync(getAlertConfig.Id, getAlertConfig).ConfigureAwait(false); - - // Validate that the update succeeded. - getAlertConfig = await adminClient.GetAlertConfigurationAsync(createdAlertConfigId).ConfigureAwait(false); - - Assert.That(getAlertConfig.Description, Is.EqualTo(getAlertConfig.Description)); - - // Update again starting with our locally created model. - alertConfigToCreate.Description = "updated again!"; - alertConfigToCreate.CrossMetricsOperator = MetricAnomalyAlertConfigurationsOperator.And; - await adminClient.UpdateAlertConfigurationAsync(getAlertConfig.Id, alertConfigToCreate).ConfigureAwait(false); - - // Validate that the update succeeded. - getAlertConfig = await adminClient.GetAlertConfigurationAsync(createdAlertConfigId).ConfigureAwait(false); - - Assert.That(getAlertConfig.Description, Is.EqualTo(alertConfigToCreate.Description)); - - // Cleanup - await adminClient.DeleteAlertConfigurationAsync(createdAlertConfigId).ConfigureAwait(false); - } - [RecordedTest] public async Task ResetDataFeedIngestionStatus() { diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/MetricsAdvisorAdministrationClientLiveTests/AnomalyAlertConfigurationOperations.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/MetricsAdvisorAdministrationClientLiveTests/AnomalyAlertConfigurationOperations.json deleted file mode 100644 index d89596ed9ae22..0000000000000 --- a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/MetricsAdvisorAdministrationClientLiveTests/AnomalyAlertConfigurationOperations.json +++ /dev/null @@ -1,642 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds?$top=1", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "e91d3424ba26b1e58dc06e5ded846a78", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "5dc20a0f-5e81-4b27-9cd3-21c62b5f43db", - "Content-Length": "1581", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:18 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "5322", - "X-Request-ID": "5dc20a0f-5e81-4b27-9cd3-21c62b5f43db" - }, - "ResponseBody": { - "value": [ - { - "dataFeedId": "d9bb5d8a-4ade-4b41-a912-a3f82ee93c14", - "dataFeedName": "SqlServerDatafeed", - "metrics": [ - { - "metricId": "81582df6-0272-40bf-994d-eb497b74d13b", - "metricName": "cost", - "metricDisplayName": "cost", - "metricDescription": "" - }, - { - "metricId": "507eaf33-3a65-4664-a7d6-5cdcc2dda6ff", - "metricName": "revenue", - "metricDisplayName": "revenue", - "metricDescription": "" - } - ], - "dimension": [ - { - "dimensionName": "category", - "dimensionDisplayName": "category" - }, - { - "dimensionName": "city", - "dimensionDisplayName": "city" - } - ], - "dataStartFrom": "2020-08-11T00:00:00Z", - "dataSourceType": "SqlServer", - "timestampColumn": "timestamp", - "startOffsetInSeconds": 0, - "maxQueryPerMinute": 30.0, - "granularityName": "Daily", - "granularityAmount": null, - "allUpIdentification": "__SUM__", - "needRollup": "NeedRollup", - "fillMissingPointType": "SmartFilling", - "fillMissingPointValue": 0.0, - "rollUpMethod": "Sum", - "rollUpColumns": [], - "dataFeedDescription": "", - "stopRetryAfterInSeconds": -1, - "minRetryIntervalInSeconds": -1, - "maxConcurrency": -1, - "viewMode": "Private", - "admins": [ - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com" - ], - "viewers": [], - "creator": "foo@contoso.com", - "status": "Active", - "createdTime": "2020-10-16T17:35:24Z", - "isAdmin": true, - "actionLinkTemplate": "", - "dataSourceParameter": { - "connectionString": "Sanitized", - "query": "select * from adsample2 where Timestamp = @StartTime" - } - } - ], - "@nextLink": "https://js-metrics-advisor.cognitiveservices.azure.com:443/metricsadvisor/v1.0/dataFeeds?$top=1\u0026$skip=1" - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds?$top=1", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "e8b28b0f46db365e51f89dd76ac929c4", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "210b7bb7-b07b-4c4c-a956-1c25ae197bc9", - "Content-Length": "1581", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:19 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "231", - "X-Request-ID": "210b7bb7-b07b-4c4c-a956-1c25ae197bc9" - }, - "ResponseBody": { - "value": [ - { - "dataFeedId": "d9bb5d8a-4ade-4b41-a912-a3f82ee93c14", - "dataFeedName": "SqlServerDatafeed", - "metrics": [ - { - "metricId": "81582df6-0272-40bf-994d-eb497b74d13b", - "metricName": "cost", - "metricDisplayName": "cost", - "metricDescription": "" - }, - { - "metricId": "507eaf33-3a65-4664-a7d6-5cdcc2dda6ff", - "metricName": "revenue", - "metricDisplayName": "revenue", - "metricDescription": "" - } - ], - "dimension": [ - { - "dimensionName": "category", - "dimensionDisplayName": "category" - }, - { - "dimensionName": "city", - "dimensionDisplayName": "city" - } - ], - "dataStartFrom": "2020-08-11T00:00:00Z", - "dataSourceType": "SqlServer", - "timestampColumn": "timestamp", - "startOffsetInSeconds": 0, - "maxQueryPerMinute": 30.0, - "granularityName": "Daily", - "granularityAmount": null, - "allUpIdentification": "__SUM__", - "needRollup": "NeedRollup", - "fillMissingPointType": "SmartFilling", - "fillMissingPointValue": 0.0, - "rollUpMethod": "Sum", - "rollUpColumns": [], - "dataFeedDescription": "", - "stopRetryAfterInSeconds": -1, - "minRetryIntervalInSeconds": -1, - "maxConcurrency": -1, - "viewMode": "Private", - "admins": [ - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com" - ], - "viewers": [], - "creator": "foo@contoso.com", - "status": "Active", - "createdTime": "2020-10-16T17:35:24Z", - "isAdmin": true, - "actionLinkTemplate": "", - "dataSourceParameter": { - "connectionString": "Sanitized", - "query": "select * from adsample2 where Timestamp = @StartTime" - } - } - ], - "@nextLink": "https://js-metrics-advisor.cognitiveservices.azure.com:443/metricsadvisor/v1.0/dataFeeds?$top=1\u0026$skip=1" - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "568", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-cb862c261855ee4796b6530e4821425d-f45311710caa1142-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "8cd8d19019573e5a39236b84a8733ede", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "NamebN2ov5kz", - "metricId": "81582df6-0272-40bf-994d-eb497b74d13b", - "wholeMetricConfiguration": { - "conditionOperator": "AND", - "smartDetectionCondition": { - "sensitivity": 42, - "anomalyDetectorDirection": "Both", - "suppressCondition": { - "minNumber": 1, - "minRatio": 67 - } - }, - "hardThresholdCondition": { - "lowerBound": 23, - "upperBound": 45, - "anomalyDetectorDirection": "Both", - "suppressCondition": { - "minNumber": 1, - "minRatio": 50 - } - }, - "changeThresholdCondition": { - "changePercentage": 12, - "shiftPoint": 5, - "withinRange": true, - "anomalyDetectorDirection": "Both", - "suppressCondition": { - "minNumber": 1, - "minRatio": 1 - } - } - } - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "31f0470a-2e99-4873-b675-7fe5bbfbd3d6", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:25 GMT", - "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations/bc310a1f-ab63-43b1-8214-76dabb87efa0", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "6218", - "X-Request-ID": "31f0470a-2e99-4873-b675-7fe5bbfbd3d6" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "281", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-e82a64e80498eb468996e676fd337b7d-a2dd0ad55616ba4e-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "3897a996a54889ad5c2558096dd2de38", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "testS25cqUDO", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "bc310a1f-ab63-43b1-8214-76dabb87efa0", - "anomalyScopeType": "TopN", - "dimensionAnomalyScope": { - "dimension": { - "test": "test2" - } - }, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "d9c80853-c6f0-4b02-97d8-caf019b54d1e", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:26 GMT", - "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/0f5cb05a-985d-4c11-8363-a693e58538d7", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "225", - "X-Request-ID": "d9c80853-c6f0-4b02-97d8-caf019b54d1e" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/0f5cb05a-985d-4c11-8363-a693e58538d7", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-c2ec3ff6a1bf254783094a3a88e70a09-683d2b38f1f84a4f-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "469e5f9da55d531c765defe4ee017083", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "b2b07813-354d-4597-8d6b-d46809eabc27", - "Content-Length": "341", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:26 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "78", - "X-Request-ID": "b2b07813-354d-4597-8d6b-d46809eabc27" - }, - "ResponseBody": { - "anomalyAlertingConfigurationId": "0f5cb05a-985d-4c11-8363-a693e58538d7", - "name": "testS25cqUDO", - "description": "", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "bc310a1f-ab63-43b1-8214-76dabb87efa0", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations/bc310a1f-ab63-43b1-8214-76dabb87efa0/alert/anomaly/configurations", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "aef5148a228293f576e127821a347002", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "0f5bdf6d-8407-4853-834f-ebc0883a4877", - "Content-Length": "353", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:26 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "97", - "X-Request-ID": "0f5bdf6d-8407-4853-834f-ebc0883a4877" - }, - "ResponseBody": { - "value": [ - { - "anomalyAlertingConfigurationId": "0f5cb05a-985d-4c11-8363-a693e58538d7", - "name": "testS25cqUDO", - "description": "", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "bc310a1f-ab63-43b1-8214-76dabb87efa0", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - } - ] - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/0f5cb05a-985d-4c11-8363-a693e58538d7", - "RequestMethod": "PATCH", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "305", - "Content-Type": "application/merge-patch\u002Bjson", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-58d7e01131b3594f8b0be70e39816085-77e0973fdc5ad549-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "be8f5f08006ef1668c43c1ebb6c89b5b", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "testS25cqUDO", - "description": "Updated", - "crossMetricsOperator": "AND", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "bc310a1f-ab63-43b1-8214-76dabb87efa0", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "e2f1cffe-5e60-4116-8f0b-541bfe206abb", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:26 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "139", - "X-Request-ID": "e2f1cffe-5e60-4116-8f0b-541bfe206abb" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/0f5cb05a-985d-4c11-8363-a693e58538d7", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-4422f4b8ec1f004d908f43002c303153-2197be22983c7946-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "597fd5b430dd7ab5690acf7c7d9a3841", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "a8c34429-7e63-4828-ba74-79007f42776a", - "Content-Length": "348", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:26 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "84", - "X-Request-ID": "a8c34429-7e63-4828-ba74-79007f42776a" - }, - "ResponseBody": { - "anomalyAlertingConfigurationId": "0f5cb05a-985d-4c11-8363-a693e58538d7", - "name": "testS25cqUDO", - "description": "Updated", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "bc310a1f-ab63-43b1-8214-76dabb87efa0", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/0f5cb05a-985d-4c11-8363-a693e58538d7", - "RequestMethod": "PATCH", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "341", - "Content-Type": "application/merge-patch\u002Bjson", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-e97c5d4710a9964288eedf425205d614-21f1cd13ca933d49-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "8edcecedb1718a14ae04223e610addae", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "testS25cqUDO", - "description": "updated again!", - "crossMetricsOperator": "AND", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "bc310a1f-ab63-43b1-8214-76dabb87efa0", - "anomalyScopeType": "TopN", - "dimensionAnomalyScope": { - "dimension": { - "test": "test2" - } - }, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "ea84bf6b-d0bc-41f3-8b50-83e2e5a846a5", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:26 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "149", - "X-Request-ID": "ea84bf6b-d0bc-41f3-8b50-83e2e5a846a5" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/0f5cb05a-985d-4c11-8363-a693e58538d7", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-ceb56fb7d1bc7c42ba2d89d318c15e88-bfb585c1ecba8842-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "45cecb4516b5d824a914546430e973f2", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "a713d532-607d-443a-8cef-932e06bc4279", - "Content-Length": "355", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:27 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "145", - "X-Request-ID": "a713d532-607d-443a-8cef-932e06bc4279" - }, - "ResponseBody": { - "anomalyAlertingConfigurationId": "0f5cb05a-985d-4c11-8363-a693e58538d7", - "name": "testS25cqUDO", - "description": "updated again!", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "bc310a1f-ab63-43b1-8214-76dabb87efa0", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/0f5cb05a-985d-4c11-8363-a693e58538d7", - "RequestMethod": "DELETE", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-084846461ba5894983486405b45e38fc-0e5b7360119b0f43-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "c9fd7f0b0deb03eac1f4abd90d77195f", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "a0e20a67-a36f-4c0a-9a84-ea61f39d38b7", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:27 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "129", - "X-Request-ID": "a0e20a67-a36f-4c0a-9a84-ea61f39d38b7" - }, - "ResponseBody": [] - } - ], - "Variables": { - "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", - "METRICSADVISOR_ENDPOINT_SUFFIX": null, - "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", - "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", - "RandomSeed": "848324583" - } -} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/MetricsAdvisorAdministrationClientLiveTests/AnomalyAlertConfigurationOperationsAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/MetricsAdvisorAdministrationClientLiveTests/AnomalyAlertConfigurationOperationsAsync.json deleted file mode 100644 index 724bd734cbd81..0000000000000 --- a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/MetricsAdvisorAdministrationClientLiveTests/AnomalyAlertConfigurationOperationsAsync.json +++ /dev/null @@ -1,642 +0,0 @@ -{ - "Entries": [ - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds?$top=1", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "d9f2f6fc7095cd8599ab83c4eea817e5", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "308b31d8-01f1-44d4-a3a1-a68f20a46350", - "Content-Length": "1581", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:28 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "123", - "X-Request-ID": "308b31d8-01f1-44d4-a3a1-a68f20a46350" - }, - "ResponseBody": { - "value": [ - { - "dataFeedId": "d9bb5d8a-4ade-4b41-a912-a3f82ee93c14", - "dataFeedName": "SqlServerDatafeed", - "metrics": [ - { - "metricId": "81582df6-0272-40bf-994d-eb497b74d13b", - "metricName": "cost", - "metricDisplayName": "cost", - "metricDescription": "" - }, - { - "metricId": "507eaf33-3a65-4664-a7d6-5cdcc2dda6ff", - "metricName": "revenue", - "metricDisplayName": "revenue", - "metricDescription": "" - } - ], - "dimension": [ - { - "dimensionName": "category", - "dimensionDisplayName": "category" - }, - { - "dimensionName": "city", - "dimensionDisplayName": "city" - } - ], - "dataStartFrom": "2020-08-11T00:00:00Z", - "dataSourceType": "SqlServer", - "timestampColumn": "timestamp", - "startOffsetInSeconds": 0, - "maxQueryPerMinute": 30.0, - "granularityName": "Daily", - "granularityAmount": null, - "allUpIdentification": "__SUM__", - "needRollup": "NeedRollup", - "fillMissingPointType": "SmartFilling", - "fillMissingPointValue": 0.0, - "rollUpMethod": "Sum", - "rollUpColumns": [], - "dataFeedDescription": "", - "stopRetryAfterInSeconds": -1, - "minRetryIntervalInSeconds": -1, - "maxConcurrency": -1, - "viewMode": "Private", - "admins": [ - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com" - ], - "viewers": [], - "creator": "foo@contoso.com", - "status": "Active", - "createdTime": "2020-10-16T17:35:24Z", - "isAdmin": true, - "actionLinkTemplate": "", - "dataSourceParameter": { - "connectionString": "Sanitized", - "query": "select * from adsample2 where Timestamp = @StartTime" - } - } - ], - "@nextLink": "https://js-metrics-advisor.cognitiveservices.azure.com:443/metricsadvisor/v1.0/dataFeeds?$top=1\u0026$skip=1" - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/dataFeeds?$top=1", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "dd04ab88f426e56b6f96a59bec8ea9a3", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "d3934f96-fd7f-4d9a-a305-7d24476d2e1d", - "Content-Length": "1581", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:28 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "118", - "X-Request-ID": "d3934f96-fd7f-4d9a-a305-7d24476d2e1d" - }, - "ResponseBody": { - "value": [ - { - "dataFeedId": "d9bb5d8a-4ade-4b41-a912-a3f82ee93c14", - "dataFeedName": "SqlServerDatafeed", - "metrics": [ - { - "metricId": "81582df6-0272-40bf-994d-eb497b74d13b", - "metricName": "cost", - "metricDisplayName": "cost", - "metricDescription": "" - }, - { - "metricId": "507eaf33-3a65-4664-a7d6-5cdcc2dda6ff", - "metricName": "revenue", - "metricDisplayName": "revenue", - "metricDescription": "" - } - ], - "dimension": [ - { - "dimensionName": "category", - "dimensionDisplayName": "category" - }, - { - "dimensionName": "city", - "dimensionDisplayName": "city" - } - ], - "dataStartFrom": "2020-08-11T00:00:00Z", - "dataSourceType": "SqlServer", - "timestampColumn": "timestamp", - "startOffsetInSeconds": 0, - "maxQueryPerMinute": 30.0, - "granularityName": "Daily", - "granularityAmount": null, - "allUpIdentification": "__SUM__", - "needRollup": "NeedRollup", - "fillMissingPointType": "SmartFilling", - "fillMissingPointValue": 0.0, - "rollUpMethod": "Sum", - "rollUpColumns": [], - "dataFeedDescription": "", - "stopRetryAfterInSeconds": -1, - "minRetryIntervalInSeconds": -1, - "maxConcurrency": -1, - "viewMode": "Private", - "admins": [ - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com", - "foo@contoso.com" - ], - "viewers": [], - "creator": "foo@contoso.com", - "status": "Active", - "createdTime": "2020-10-16T17:35:24Z", - "isAdmin": true, - "actionLinkTemplate": "", - "dataSourceParameter": { - "connectionString": "Sanitized", - "query": "select * from adsample2 where Timestamp = @StartTime" - } - } - ], - "@nextLink": "https://js-metrics-advisor.cognitiveservices.azure.com:443/metricsadvisor/v1.0/dataFeeds?$top=1\u0026$skip=1" - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "568", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-a864c6051c75cd4dba88c01838e6f53d-6aa68debe90ced4b-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "918bedaa0aa52b943b7c4a6e7feff107", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "NameQxRrjnPc", - "metricId": "81582df6-0272-40bf-994d-eb497b74d13b", - "wholeMetricConfiguration": { - "conditionOperator": "AND", - "smartDetectionCondition": { - "sensitivity": 42, - "anomalyDetectorDirection": "Both", - "suppressCondition": { - "minNumber": 1, - "minRatio": 67 - } - }, - "hardThresholdCondition": { - "lowerBound": 23, - "upperBound": 45, - "anomalyDetectorDirection": "Both", - "suppressCondition": { - "minNumber": 1, - "minRatio": 50 - } - }, - "changeThresholdCondition": { - "changePercentage": 12, - "shiftPoint": 5, - "withinRange": true, - "anomalyDetectorDirection": "Both", - "suppressCondition": { - "minNumber": 1, - "minRatio": 1 - } - } - } - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "f32263a2-5246-483f-acde-d1204af7053e", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:28 GMT", - "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations/eb298315-3d08-4c49-97f4-ab116458055e", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "78", - "X-Request-ID": "f32263a2-5246-483f-acde-d1204af7053e" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", - "RequestMethod": "POST", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "281", - "Content-Type": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-44d4df06e0f91e4cab0e1c3de9658e22-127119a80ff2724a-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "ebe0e002c91c10ecd5d4323868da3f65", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "testpTcyfRrH", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "eb298315-3d08-4c49-97f4-ab116458055e", - "anomalyScopeType": "TopN", - "dimensionAnomalyScope": { - "dimension": { - "test": "test2" - } - }, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - }, - "StatusCode": 201, - "ResponseHeaders": { - "apim-request-id": "7d49f76b-6b31-4a87-b37c-1ffff9884a8a", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:28 GMT", - "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a0e2b37c-903a-4758-88fa-6bacffb06e66", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "109", - "X-Request-ID": "7d49f76b-6b31-4a87-b37c-1ffff9884a8a" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a0e2b37c-903a-4758-88fa-6bacffb06e66", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-3908ee4f64fc044e94bb75391e456e3b-5384ca3304ce2f46-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "70607a013b43f4231184c3ec0dd765c1", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "9100e711-d295-4aa1-9eed-fe818c3e6146", - "Content-Length": "341", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:29 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "76", - "X-Request-ID": "9100e711-d295-4aa1-9eed-fe818c3e6146" - }, - "ResponseBody": { - "anomalyAlertingConfigurationId": "a0e2b37c-903a-4758-88fa-6bacffb06e66", - "name": "testpTcyfRrH", - "description": "", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "eb298315-3d08-4c49-97f4-ab116458055e", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations/eb298315-3d08-4c49-97f4-ab116458055e/alert/anomaly/configurations", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "c58f800da929710f903a98aabcb99eb0", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "b6bac7f0-ba92-43be-a040-d7a0d794f934", - "Content-Length": "353", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:29 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "85", - "X-Request-ID": "b6bac7f0-ba92-43be-a040-d7a0d794f934" - }, - "ResponseBody": { - "value": [ - { - "anomalyAlertingConfigurationId": "a0e2b37c-903a-4758-88fa-6bacffb06e66", - "name": "testpTcyfRrH", - "description": "", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "eb298315-3d08-4c49-97f4-ab116458055e", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - } - ] - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a0e2b37c-903a-4758-88fa-6bacffb06e66", - "RequestMethod": "PATCH", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "305", - "Content-Type": "application/merge-patch\u002Bjson", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-cf49d0a2b6b1be46a196a17a308ff1b4-d398f03e13558740-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "50fd05cd7088c6c7bcecd99706ff03fd", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "testpTcyfRrH", - "description": "Updated", - "crossMetricsOperator": "AND", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "eb298315-3d08-4c49-97f4-ab116458055e", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "6dd54c28-85a9-4dfc-86eb-e5fab2df8b05", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:29 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "105", - "X-Request-ID": "6dd54c28-85a9-4dfc-86eb-e5fab2df8b05" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a0e2b37c-903a-4758-88fa-6bacffb06e66", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-9b978514ea74ef458ac4b547631caab8-72e880327e4d6b4d-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "e82a706e7a4a583b6aefe009a2793758", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "18a5525d-b9ba-4536-ae1c-9248cd8c19c9", - "Content-Length": "348", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:29 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "66", - "X-Request-ID": "18a5525d-b9ba-4536-ae1c-9248cd8c19c9" - }, - "ResponseBody": { - "anomalyAlertingConfigurationId": "a0e2b37c-903a-4758-88fa-6bacffb06e66", - "name": "testpTcyfRrH", - "description": "Updated", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "eb298315-3d08-4c49-97f4-ab116458055e", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a0e2b37c-903a-4758-88fa-6bacffb06e66", - "RequestMethod": "PATCH", - "RequestHeaders": { - "Accept": "application/json", - "Content-Length": "341", - "Content-Type": "application/merge-patch\u002Bjson", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-0b508ff4556f5b4081ab3a82ba6d8c6b-4dbc2f49593d014a-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "071e12e515da9c39b9c9083ccf776a90", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": { - "name": "testpTcyfRrH", - "description": "updated again!", - "crossMetricsOperator": "AND", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "eb298315-3d08-4c49-97f4-ab116458055e", - "anomalyScopeType": "TopN", - "dimensionAnomalyScope": { - "dimension": { - "test": "test2" - } - }, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - }, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "55d2acaa-a3b4-4b71-b0a3-785239f75c0d", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:29 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "115", - "X-Request-ID": "55d2acaa-a3b4-4b71-b0a3-785239f75c0d" - }, - "ResponseBody": [] - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a0e2b37c-903a-4758-88fa-6bacffb06e66", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-f102a4261c34cd41a795e0ee6a001702-414e11f2da559846-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "4b3c9a36b68e5366c9a4e59890be2443", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 200, - "ResponseHeaders": { - "apim-request-id": "b6e45ea6-f308-4a43-b397-36bc8ed18cb2", - "Content-Length": "355", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 29 Oct 2020 21:55:29 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "84", - "X-Request-ID": "b6e45ea6-f308-4a43-b397-36bc8ed18cb2" - }, - "ResponseBody": { - "anomalyAlertingConfigurationId": "a0e2b37c-903a-4758-88fa-6bacffb06e66", - "name": "testpTcyfRrH", - "description": "updated again!", - "hookIds": [], - "metricAlertingConfigurations": [ - { - "anomalyDetectionConfigurationId": "eb298315-3d08-4c49-97f4-ab116458055e", - "anomalyScopeType": "TopN", - "negationOperation": false, - "topNAnomalyScope": { - "top": 8, - "period": 4, - "minTopCount": 2 - } - } - ] - } - }, - { - "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a0e2b37c-903a-4758-88fa-6bacffb06e66", - "RequestMethod": "DELETE", - "RequestHeaders": { - "Accept": "application/json", - "Ocp-Apim-Subscription-Key": "Sanitized", - "traceparent": "00-aa3b4c602794534584f75f36e2ba0856-7e3da5e34b37c141-00", - "User-Agent": [ - "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201029.1", - "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" - ], - "x-api-key": "Sanitized", - "x-ms-client-request-id": "f4b181b5fbe15823378e2e8171ff89f3", - "x-ms-return-client-request-id": "true" - }, - "RequestBody": null, - "StatusCode": 204, - "ResponseHeaders": { - "apim-request-id": "8fdf01bd-c641-4c5e-814c-70bfb9f9ef27", - "Content-Length": "0", - "Date": "Thu, 29 Oct 2020 21:55:29 GMT", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", - "X-Content-Type-Options": "nosniff", - "x-envoy-upstream-service-time": "141", - "X-Request-ID": "8fdf01bd-c641-4c5e-814c-70bfb9f9ef27" - }, - "ResponseBody": [] - } - ], - "Variables": { - "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", - "METRICSADVISOR_ENDPOINT_SUFFIX": null, - "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", - "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", - "RandomSeed": "848285796" - } -} \ No newline at end of file From ecfa61ded26b0ad271f4e930fd1d027aa883885b Mon Sep 17 00:00:00 2001 From: Caio Saldanha Date: Mon, 21 Dec 2020 18:29:41 -0800 Subject: [PATCH 7/7] Added recordings for new tests --- ...ationWithMultipleMetricConfigurations.json | 150 +++++ ...WithMultipleMetricConfigurationsAsync.json | 150 +++++ ...ionalSingleMetricConfigurationMembers.json | 289 ++++++++++ ...SingleMetricConfigurationMembersAsync.json | 289 ++++++++++ ...lertConfigurationWithSeriesGroupScope.json | 130 +++++ ...onfigurationWithSeriesGroupScopeAsync.json | 130 +++++ ...AndGetAlertConfigurationWithTopNScope.json | 130 +++++ ...tAlertConfigurationWithTopNScopeAsync.json | 130 +++++ ...lertConfigurationWithWholeSeriesScope.json | 120 ++++ ...onfigurationWithWholeSeriesScopeAsync.json | 120 ++++ .../DeleteAlertConfiguration.json | 111 ++++ .../DeleteAlertConfigurationAsync.json | 111 ++++ .../GetAlertConfigurations.json | 543 ++++++++++++++++++ .../GetAlertConfigurationsAsync.json | 543 ++++++++++++++++++ ...gurationWithEveryMemberAndGetInstance.json | 367 ++++++++++++ ...ionWithEveryMemberAndGetInstanceAsync.json | 367 ++++++++++++ ...gurationWithEveryMemberAndNewInstance.json | 301 ++++++++++ ...ionWithEveryMemberAndNewInstanceAsync.json | 301 ++++++++++ ...urationWithMinimumSetupAndGetInstance.json | 363 ++++++++++++ ...onWithMinimumSetupAndGetInstanceAsync.json | 363 ++++++++++++ ...urationWithMinimumSetupAndNewInstance.json | 296 ++++++++++ ...onWithMinimumSetupAndNewInstanceAsync.json | 296 ++++++++++ 22 files changed, 5600 insertions(+) create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithMultipleMetricConfigurations.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithMultipleMetricConfigurationsAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithOptionalSingleMetricConfigurationMembers.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithOptionalSingleMetricConfigurationMembersAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithSeriesGroupScope.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithSeriesGroupScopeAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithTopNScope.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithTopNScopeAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithWholeSeriesScope.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithWholeSeriesScopeAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/DeleteAlertConfiguration.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/DeleteAlertConfigurationAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/GetAlertConfigurations.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/GetAlertConfigurationsAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndGetInstance.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndGetInstanceAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndNewInstance.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndNewInstanceAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndGetInstance.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndGetInstanceAsync.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndNewInstance.json create mode 100644 sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndNewInstanceAsync.json diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithMultipleMetricConfigurations.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithMultipleMetricConfigurations.json new file mode 100644 index 0000000000000..6b1ba68800df6 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithMultipleMetricConfigurations.json @@ -0,0 +1,150 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "415", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-8dc21357dc19b1419e5963bdcebb0deb-81f12e0d8e02804f-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "0bd7bcf3a83a0bef03cdc015db3f9a65", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configRUbHcTl2", + "crossMetricsOperator": "XOR", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true, + "valueFilter": { + "upper": 20, + "direction": "Up" + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "valueFilter": { + "lower": 10, + "direction": "Down" + } + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "c5ddeb98-d6f9-4e1f-a0a1-d0dbb5518871", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:27:42 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/1899ab0d-5833-4209-9d8f-fb7e055df0db", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "200", + "X-Request-ID": "c5ddeb98-d6f9-4e1f-a0a1-d0dbb5518871" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/1899ab0d-5833-4209-9d8f-fb7e055df0db", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-895c3abb14b2ff4ba76d933f3a4ca3f4-865af4c9bf1fd44c-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "1b99e95263bf7c8b16b41db9fef765a1", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "77d718bc-4a70-46cb-995c-a17c806b6c2f", + "Content-Length": "586", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:27:53 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "10213", + "X-Request-ID": "77d718bc-4a70-46cb-995c-a17c806b6c2f" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "1899ab0d-5833-4209-9d8f-fb7e055df0db", + "name": "configRUbHcTl2", + "description": "", + "crossMetricsOperator": "XOR", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true, + "valueFilter": { + "upper": 20.0, + "direction": "Up", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "valueFilter": { + "lower": 10.0, + "direction": "Down", + "triggerForMissing": false + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/1899ab0d-5833-4209-9d8f-fb7e055df0db", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-2ced7661c7629d4ca4d09eef1fd8a2b4-354dca4c57cb3f4e-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "922cfe452c5ed4e78f2a22a55492480a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "fb371ce7-63ab-47b9-babf-e8d042ca97c4", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:27:59 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "5244", + "X-Request-ID": "fb371ce7-63ab-47b9-babf-e8d042ca97c4" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "221853661" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithMultipleMetricConfigurationsAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithMultipleMetricConfigurationsAsync.json new file mode 100644 index 0000000000000..9c21727c6cd29 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithMultipleMetricConfigurationsAsync.json @@ -0,0 +1,150 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "415", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-5d94bad53cd30d4ca4f716c5b40944cf-ce177debef2cd744-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "9c53efbbd99947cdf9cbfa628f01f571", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configtP7ePBS1", + "crossMetricsOperator": "XOR", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true, + "valueFilter": { + "upper": 20, + "direction": "Up" + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "valueFilter": { + "lower": 10, + "direction": "Down" + } + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "c6ec527c-1fdd-4808-a994-364febedfc1a", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:16 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/acd3e4e4-ffac-4236-ae56-4f77a4599b03", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "119", + "X-Request-ID": "c6ec527c-1fdd-4808-a994-364febedfc1a" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/acd3e4e4-ffac-4236-ae56-4f77a4599b03", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-1c4bca05a84e894fb43134356fa3a4e8-3ee89e5525e74443-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "4d52fdfaf7a88a9e2977f5270179bf77", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "15c084f5-4ab3-4bb1-a669-09273952daee", + "Content-Length": "586", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "93", + "X-Request-ID": "15c084f5-4ab3-4bb1-a669-09273952daee" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "acd3e4e4-ffac-4236-ae56-4f77a4599b03", + "name": "configtP7ePBS1", + "description": "", + "crossMetricsOperator": "XOR", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true, + "valueFilter": { + "upper": 20.0, + "direction": "Up", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "valueFilter": { + "lower": 10.0, + "direction": "Down", + "triggerForMissing": false + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/acd3e4e4-ffac-4236-ae56-4f77a4599b03", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-d7c8cca93327cd40b5518f026ea6d6bb-b07e4dee9b16d54b-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "49f336d7665629a5f7703d234871214a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "0ee9c8e8-267f-4777-866e-7eed2591a5bd", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "129", + "X-Request-ID": "0ee9c8e8-267f-4777-866e-7eed2591a5bd" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "83600501" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithOptionalSingleMetricConfigurationMembers.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithOptionalSingleMetricConfigurationMembers.json new file mode 100644 index 0000000000000..13b2c73d60da4 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithOptionalSingleMetricConfigurationMembers.json @@ -0,0 +1,289 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-30d7628760615b429f0ea013bf5ece4b-d658d770f5d4e045-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "6c2e4c3c49b1f0f9f6281f083be8def1", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookVhcyeEA7" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "5a81dfcf-f38d-4dba-ba24-6f3dfb6acd91", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:01 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/a78186d5-bd7e-4c45-b851-2b0b8a37600a", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "857", + "X-Request-ID": "5a81dfcf-f38d-4dba-ba24-6f3dfb6acd91" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0bc726b71448bd49bfe4e305806ab9d2-942c38b9f67efb43-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "03ec1029e02f878bc06fdbc287833173", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookgCRgOMal" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "5dc16b5f-dc69-415a-8f68-682c341f02b3", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:01 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/286ce586-9979-4c91-85ff-d1bac0529dfb", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "707", + "X-Request-ID": "5dc16b5f-dc69-415a-8f68-682c341f02b3" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "596", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-cdcf2d0735737d47b52bb20f0e04ee73-38549aaa66365d4a-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "890e875db35d426363557a0967398a5b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configVE8u702e", + "description": "This hook was created to test the .NET client.", + "hookIds": [ + "a78186d5-bd7e-4c45-b851-2b0b8a37600a", + "286ce586-9979-4c91-85ff-d1bac0529dfb" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "0e110de6-6e3a-49f7-afea-e448037b458f", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:02 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/b50958c0-37b8-41d1-9589-bb0b7d672c87", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "162", + "X-Request-ID": "0e110de6-6e3a-49f7-afea-e448037b458f" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/b50958c0-37b8-41d1-9589-bb0b7d672c87", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-224455926cfd64418cf26aecc7390d29-fee8b4dc58cf3646-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "42aca6c0376e7269f6ac061300c91f31", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "27e9b664-8f47-4037-86d3-bd88e8ba8937", + "Content-Length": "698", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:02 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "88", + "X-Request-ID": "27e9b664-8f47-4037-86d3-bd88e8ba8937" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "b50958c0-37b8-41d1-9589-bb0b7d672c87", + "name": "configVE8u702e", + "description": "This hook was created to test the .NET client.", + "hookIds": [ + "a78186d5-bd7e-4c45-b851-2b0b8a37600a", + "286ce586-9979-4c91-85ff-d1bac0529dfb" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/b50958c0-37b8-41d1-9589-bb0b7d672c87", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-7a8777907d6ae64790c5c76fa6e51e20-0ddb9a201985f946-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "a7a6fb2102d10c2a0b995e3109270bc8", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "267c4b91-2d51-4570-b155-f406c46d8a74", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:02 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "96", + "X-Request-ID": "267c4b91-2d51-4570-b155-f406c46d8a74" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/286ce586-9979-4c91-85ff-d1bac0529dfb", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-2a666f970c4f934d98403734005f6762-fc6399a39cf0ce49-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "2b558d9dac4b25821e9c92b0ad504299", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "b9386e99-f5e5-4191-af1e-c66506bc7b52", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:02 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "177", + "X-Request-ID": "b9386e99-f5e5-4191-af1e-c66506bc7b52" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/a78186d5-bd7e-4c45-b851-2b0b8a37600a", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-cbac6cfa5e5cda4c9468473b956b3503-4144ee4ede5d5a45-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "6be74936e292be8a7c9f36d4d83769cf", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "5b4c0921-9616-4bc8-bd68-eb8ca3da0c54", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:03 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "186", + "X-Request-ID": "5b4c0921-9616-4bc8-bd68-eb8ca3da0c54" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1652686928" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithOptionalSingleMetricConfigurationMembersAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithOptionalSingleMetricConfigurationMembersAsync.json new file mode 100644 index 0000000000000..6b13dfe7baf36 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithOptionalSingleMetricConfigurationMembersAsync.json @@ -0,0 +1,289 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-b5bbf828b9dff24f99454efb49e79653-f358ef3762848745-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "495704b88ec4916bd0f05e38f0568269", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookV8Nrq89J" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "1a676057-f36a-47a1-9923-4f59275531df", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:17 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/79a3f140-2a30-4acc-8438-c79b5e166bfc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "652", + "X-Request-ID": "1a676057-f36a-47a1-9923-4f59275531df" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-323f5c635d229a41a87f16d073d90d4a-10a74c28d61f4041-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "cd50283ff6b9348d46029618c90c039e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookghHUkSkB" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "8593d901-f464-4a37-bd13-5c86c9bea9be", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:18 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/5b3c2468-0345-4799-976c-dbb5b6e0da0e", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "655", + "X-Request-ID": "8593d901-f464-4a37-bd13-5c86c9bea9be" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "596", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-c8a59d3f9659764f9a0bdf15de7b0d83-a38b4428ec4de74a-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "1e0970a579320b9398d1663008c584c1", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configvPRezZUI", + "description": "This hook was created to test the .NET client.", + "hookIds": [ + "79a3f140-2a30-4acc-8438-c79b5e166bfc", + "5b3c2468-0345-4799-976c-dbb5b6e0da0e" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "483b664f-ac45-4759-9ec3-11b830b12cd3", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:18 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/f0b40ced-ac9b-40b6-8784-79546d84f1ec", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "150", + "X-Request-ID": "483b664f-ac45-4759-9ec3-11b830b12cd3" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/f0b40ced-ac9b-40b6-8784-79546d84f1ec", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-ff818bc160d6ef46a6f77f8d55145845-ef90e5e29efd8044-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "c203227652f7c4c8ecbf675877663bb7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "b189b786-1bf2-4e70-95c1-3c5e9143d548", + "Content-Length": "698", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:18 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "92", + "X-Request-ID": "b189b786-1bf2-4e70-95c1-3c5e9143d548" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "f0b40ced-ac9b-40b6-8784-79546d84f1ec", + "name": "configvPRezZUI", + "description": "This hook was created to test the .NET client.", + "hookIds": [ + "79a3f140-2a30-4acc-8438-c79b5e166bfc", + "5b3c2468-0345-4799-976c-dbb5b6e0da0e" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/f0b40ced-ac9b-40b6-8784-79546d84f1ec", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-10c45944846c114c89a66fc6409ee7bf-4806731b0318af45-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "49271de36feccc026e8a80f7a5d3960b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "9b43cf25-33ed-488c-88e3-1750627a3400", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:18 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "97", + "X-Request-ID": "9b43cf25-33ed-488c-88e3-1750627a3400" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/5b3c2468-0345-4799-976c-dbb5b6e0da0e", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-d0ba3eebe53aff46a7f00b3b8727ada7-e058e88386702b4e-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "0ba61d138383533ba7453273113b9431", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "9896c469-9c48-4ffd-8c69-31539c852f8a", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:18 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "161", + "X-Request-ID": "9896c469-9c48-4ffd-8c69-31539c852f8a" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/79a3f140-2a30-4acc-8438-c79b5e166bfc", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-372bf9bf1d6d4f459fa003d5d9c6ea3d-171730d2b069eb4f-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "eb4dae963b9d07d41f37536dd1d01e19", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "5f516b9b-8c31-4b9a-b663-fb96ca098641", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:19 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "182", + "X-Request-ID": "5f516b9b-8c31-4b9a-b663-fb96ca098641" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "219998573" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithSeriesGroupScope.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithSeriesGroupScope.json new file mode 100644 index 0000000000000..40eeeb5cf7f94 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithSeriesGroupScope.json @@ -0,0 +1,130 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "232", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-d31d4d878495764780c3c44c66491fa3-95ac427904dd8844-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "b445f7e4ac579422b261a2b83c18cefc", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configCpHBcSmG", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "Dimension", + "dimensionAnomalyScope": { + "dimension": { + "city": "Delhi" + } + } + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "44f71589-a78f-4b74-87a4-9eb8190e6dc2", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:03 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/c8ee1b62-5942-43d0-8994-3af1bbd62996", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "176", + "X-Request-ID": "44f71589-a78f-4b74-87a4-9eb8190e6dc2" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/c8ee1b62-5942-43d0-8994-3af1bbd62996", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-f9ef74cc0db6d04b8e36a40cb865d577-0d7f82e7f1b5d941-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "75420facd7f99819ab512aeb99d432b9", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "8090385a-315d-46e2-aba1-1f8bb3b9b13f", + "Content-Length": "347", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:03 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "102", + "X-Request-ID": "8090385a-315d-46e2-aba1-1f8bb3b9b13f" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "c8ee1b62-5942-43d0-8994-3af1bbd62996", + "name": "configCpHBcSmG", + "description": "", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "Dimension", + "negationOperation": false, + "dimensionAnomalyScope": { + "dimension": { + "city": "Delhi" + } + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/c8ee1b62-5942-43d0-8994-3af1bbd62996", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-d56e7352abbd8944a681776719a13022-0b8edd5c1332c545-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "d942bc757aea71c30cbf5e4622befb1a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "e9897a04-f7be-4f89-b7f7-25d3b48332fb", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:03 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "89", + "X-Request-ID": "e9897a04-f7be-4f89-b7f7-25d3b48332fb" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1674950393" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithSeriesGroupScopeAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithSeriesGroupScopeAsync.json new file mode 100644 index 0000000000000..9ab48918295cf --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithSeriesGroupScopeAsync.json @@ -0,0 +1,130 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "232", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0ab04c9b8d833b4d86c00421336ed2a2-326d9bbbed665b49-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "bca4cb4e370f4adce81c5398b92e5b5e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configInSGyQiJ", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "Dimension", + "dimensionAnomalyScope": { + "dimension": { + "city": "Delhi" + } + } + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "5090a445-50ac-48df-91a2-b7d1e0aca9ff", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:20 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/fd20169e-25fe-4055-85f7-b0600bc7f96c", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "159", + "X-Request-ID": "5090a445-50ac-48df-91a2-b7d1e0aca9ff" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/fd20169e-25fe-4055-85f7-b0600bc7f96c", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-fa63f1984b40234685974284d1dd98f5-f4182c7cfa4b6842-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "11aca2138e4a4caac898e4954fa51a60", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "14d95770-43c6-4722-b0c0-f3a0086e980e", + "Content-Length": "347", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:20 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "87", + "X-Request-ID": "14d95770-43c6-4722-b0c0-f3a0086e980e" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "fd20169e-25fe-4055-85f7-b0600bc7f96c", + "name": "configInSGyQiJ", + "description": "", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "Dimension", + "negationOperation": false, + "dimensionAnomalyScope": { + "dimension": { + "city": "Delhi" + } + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/fd20169e-25fe-4055-85f7-b0600bc7f96c", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-80817cd59357dd41a848cd9012d3af97-9b45744648776d44-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "d490af8642c63bcb6ecca9046984fc4b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "e4e6ce6a-5fac-45fe-a1fc-31a9f37d9cef", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:20 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "96", + "X-Request-ID": "e4e6ce6a-5fac-45fe-a1fc-31a9f37d9cef" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1397715374" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithTopNScope.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithTopNScope.json new file mode 100644 index 0000000000000..7247bc7e835a1 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithTopNScope.json @@ -0,0 +1,130 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "231", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-4ae6bb44d3400c4dbd8585b1b9a2a91c-031d8579e4966749-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "f73903b0ce09111b4025e817eb4e3e2e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configcUJctDmU", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "topNAnomalyScope": { + "top": 30, + "period": 20, + "minTopCount": 10 + } + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "48505a81-5f2d-4c5a-90cd-b055026aafdb", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:04 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/3a91cd4e-5668-4c47-ba59-1f200c059585", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "118", + "X-Request-ID": "48505a81-5f2d-4c5a-90cd-b055026aafdb" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/3a91cd4e-5668-4c47-ba59-1f200c059585", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0bac609427c96c48888b0f9041f612ac-08878538a2e77746-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "032d37b14d7ebbff6a1d927a1e88c82a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "9bae164b-423c-4a3f-8855-fbae85d1b092", + "Content-Length": "346", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:04 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "110", + "X-Request-ID": "9bae164b-423c-4a3f-8855-fbae85d1b092" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "3a91cd4e-5668-4c47-ba59-1f200c059585", + "name": "configcUJctDmU", + "description": "", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": false, + "topNAnomalyScope": { + "top": 30, + "period": 20, + "minTopCount": 10 + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/3a91cd4e-5668-4c47-ba59-1f200c059585", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-479526ae6c1d9d468b3f0d8f0a45a3a7-f3a313cf7451334b-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "c91ca633ef75a9a75c5faa0f56b5fea4", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "5cb84571-df06-466a-b30e-efd2df097825", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:04 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "108", + "X-Request-ID": "5cb84571-df06-466a-b30e-efd2df097825" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1539431285" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithTopNScopeAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithTopNScopeAsync.json new file mode 100644 index 0000000000000..877bf54b4a21d --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithTopNScopeAsync.json @@ -0,0 +1,130 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "231", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-47aee0b88b068a41b3a4060fef408918-ef4d9bac4831fe45-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "c4b4dfc18a3c2ad0b022f2785de7a0f5", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configscgv9Oyh", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "topNAnomalyScope": { + "top": 30, + "period": 20, + "minTopCount": 10 + } + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "0b711bd4-b828-4597-8404-184777532bdb", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:20 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a89a555b-e117-4162-9549-5af48c8ade00", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "120", + "X-Request-ID": "0b711bd4-b828-4597-8404-184777532bdb" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a89a555b-e117-4162-9549-5af48c8ade00", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-4cfa03d03ad5954baf94292631f0822f-90ca0342daf5e541-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "5392b0d9389b56ca2b410b6336d0bddd", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "e8e7bf38-16b7-47d2-a0b6-339230eb45ff", + "Content-Length": "346", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:21 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "80", + "X-Request-ID": "e8e7bf38-16b7-47d2-a0b6-339230eb45ff" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "a89a555b-e117-4162-9549-5af48c8ade00", + "name": "configscgv9Oyh", + "description": "", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": false, + "topNAnomalyScope": { + "top": 30, + "period": 20, + "minTopCount": 10 + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/a89a555b-e117-4162-9549-5af48c8ade00", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-1078df63586a054c9d416b4d6983e9dc-395529ec72cb9043-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "df8d3641c0aa3b0ec8a053ccd484094c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "4c5ac50f-d044-45da-bedb-4b46f2e3cec1", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:21 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "103", + "X-Request-ID": "4c5ac50f-d044-45da-bedb-4b46f2e3cec1" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1540521114" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithWholeSeriesScope.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithWholeSeriesScope.json new file mode 100644 index 0000000000000..7d16646ec4d85 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithWholeSeriesScope.json @@ -0,0 +1,120 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "171", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-88c7f045c9d6bc449e9a987fffd3390e-df383d89dc284a4e-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "dd7621356403fa9dd711b61f798bf148", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "config2FhEIU5p", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "3243c027-2053-41cc-92bd-52d002a4c8d8", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:04 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/86e8d565-9155-421a-a995-15ab28c1ed0a", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "113", + "X-Request-ID": "3243c027-2053-41cc-92bd-52d002a4c8d8" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/86e8d565-9155-421a-a995-15ab28c1ed0a", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-840b436f2354cd44b5aa1a356ad550e8-3cfda608376fd24c-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "e72af47db80504d2b9bd4e1547e7df87", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "6704acd9-9786-4d76-9f50-ba7e09c30df2", + "Content-Length": "286", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:04 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "85", + "X-Request-ID": "6704acd9-9786-4d76-9f50-ba7e09c30df2" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "86e8d565-9155-421a-a995-15ab28c1ed0a", + "name": "config2FhEIU5p", + "description": "", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/86e8d565-9155-421a-a995-15ab28c1ed0a", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-8fcea19838ac154ba9a19b2cce30ff15-bb9591182a542b47-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "827c1473431bf891f3648c9d04ac44d2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "db23b412-35c5-4b26-b23f-86143be7128c", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:04 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "102", + "X-Request-ID": "db23b412-35c5-4b26-b23f-86143be7128c" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "5187136" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithWholeSeriesScopeAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithWholeSeriesScopeAsync.json new file mode 100644 index 0000000000000..4c948b2ee4a0f --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/CreateAndGetAlertConfigurationWithWholeSeriesScopeAsync.json @@ -0,0 +1,120 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "171", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-3cc5641fb720fe4dba3cdfc2fa7c57ea-a2d64e661bdf464f-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "215e26339d984b79c2ff15fb75ce00e4", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configDEcBGucH", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "72e0be12-48dc-4bdc-9e12-67bb68cdce8c", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:21 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/d4b63d35-1627-4133-95d9-ded9b56fd3a6", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "106", + "X-Request-ID": "72e0be12-48dc-4bdc-9e12-67bb68cdce8c" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/d4b63d35-1627-4133-95d9-ded9b56fd3a6", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-e0864b009ae4a0409a9767b8db079b08-e1bc499d4efe6049-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "974911f9089adc2028b611a20b7fb6f6", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "2fefbedc-2821-4430-be3b-2fdab48315e0", + "Content-Length": "286", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:21 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "85", + "X-Request-ID": "2fefbedc-2821-4430-be3b-2fdab48315e0" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "d4b63d35-1627-4133-95d9-ded9b56fd3a6", + "name": "configDEcBGucH", + "description": "", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/d4b63d35-1627-4133-95d9-ded9b56fd3a6", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-54cb9fc64696b844b1183ab58900f901-4501f2c378b07741-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "5a25c8c515e3920e089fb438b1969e4c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "2e57b4f3-0bc4-476d-8fe4-0ef937329609", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:21 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "112", + "X-Request-ID": "2e57b4f3-0bc4-476d-8fe4-0ef937329609" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "413718544" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/DeleteAlertConfiguration.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/DeleteAlertConfiguration.json new file mode 100644 index 0000000000000..d222d9973f054 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/DeleteAlertConfiguration.json @@ -0,0 +1,111 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "193", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-8e2a72a8bc7cca49bbab4c718f6964d2-d2917bf5fd5bfe46-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "9dbe014d6650e879b167ce223a0e7ddd", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "b33868fd-db06-494e-a133-1f03d34edd95", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:05 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/cd51aa63-7e44-465f-8faa-99a244df6c6c", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "110", + "X-Request-ID": "b33868fd-db06-494e-a133-1f03d34edd95" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/cd51aa63-7e44-465f-8faa-99a244df6c6c", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-3dbd1605ef14064c8007b98084198e4e-8c1d8bc3ece6c44f-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "3b94d31568d7daf8a5bd86f7b87b17a4", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "4212c7dd-a283-46d9-8a09-816ecfb6361e", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:05 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "106", + "X-Request-ID": "4212c7dd-a283-46d9-8a09-816ecfb6361e" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/cd51aa63-7e44-465f-8faa-99a244df6c6c", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-42cee41c1a68cd4fa140b579ec4b9fda-171474d41f805b4d-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "16f8fe04e943f8045dde25b4b0985c10", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 404, + "ResponseHeaders": { + "apim-request-id": "831ec250-6ac6-4e1f-87ca-81cf5f8616a5", + "Content-Length": "123", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:05 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "62", + "X-Request-ID": "831ec250-6ac6-4e1f-87ca-81cf5f8616a5" + }, + "ResponseBody": { + "code": "Not Found", + "message": "Not found this AnomalyAlertingConfiguration. TraceId: 3be7efba-8b0a-4f74-b140-8b7e50b88c64" + } + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "2039408270" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/DeleteAlertConfigurationAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/DeleteAlertConfigurationAsync.json new file mode 100644 index 0000000000000..4381f9af8b722 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/DeleteAlertConfigurationAsync.json @@ -0,0 +1,111 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "193", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-e69ec3f2e6c0e14898b2279e07bf36dc-739dbc9dade4dd49-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "cca4c13bf0c475a0890f0153980ebb65", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All" + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "08ee79f1-1be4-4d18-9a38-e571cdb4e064", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:21 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/e1b44948-ec4c-494f-94b9-6db164acfba6", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "104", + "X-Request-ID": "08ee79f1-1be4-4d18-9a38-e571cdb4e064" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/e1b44948-ec4c-494f-94b9-6db164acfba6", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-a4a2de853b56a242a25bb2599a123235-dc52736cd6239543-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "bd9768e834d9234c2cb6cc19df606c67", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "afce656f-daf5-4a9e-9a68-e369aa1b02ba", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:21 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "98", + "X-Request-ID": "afce656f-daf5-4a9e-9a68-e369aa1b02ba" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/e1b44948-ec4c-494f-94b9-6db164acfba6", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-48f3a05e234d354a8be0bc994fe37467-4ae40b135464ca42-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "6e8570945bbe1a51ec147c863fd2f06c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 404, + "ResponseHeaders": { + "apim-request-id": "5d72320f-6fa9-4844-a8a1-73283c3c9193", + "Content-Length": "123", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:21 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "67", + "X-Request-ID": "5d72320f-6fa9-4844-a8a1-73283c3c9193" + }, + "ResponseBody": { + "code": "Not Found", + "message": "Not found this AnomalyAlertingConfiguration. TraceId: ab42eea3-278e-4253-9928-e535e46ace77" + } + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1629710057" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/GetAlertConfigurations.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/GetAlertConfigurations.json new file mode 100644 index 0000000000000..3c45e56b64848 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/GetAlertConfigurations.json @@ -0,0 +1,543 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations/fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c/alert/anomaly/configurations", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "5efbea41febe85db1dbb648ffa46e7fe", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "8108e112-2a76-4466-80c7-87e1fc4b52c8", + "Content-Length": "12404", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:05 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "120", + "X-Request-ID": "8108e112-2a76-4466-80c7-87e1fc4b52c8" + }, + "ResponseBody": { + "value": [ + { + "anomalyAlertingConfigurationId": "b3dc6db3-617f-4229-b338-ac31baee2445", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "65e1606b-0254-4c18-8f66-877490e74b6a", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "3636f929-f7c5-494e-9eb3-8915d1552317", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "aaeb0a37-7402-4e2e-927a-8698e0ba41c4", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "e2c7ca76-56f6-4c2c-b435-b4bdf9825d2c", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "ccf99404-9296-4007-8611-1c626d9f01d8", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "e016612d-a658-436a-86e4-415b44e1d3aa", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "25ceef54-60cf-4d80-9886-3984f8cec8a2", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "81a9b3db-a888-4455-b1d4-ebf0b0c44b5e", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "0478e1a7-a5c1-4b46-bee9-7f76b09352b2", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "aed0331c-0784-4cd1-b182-7f5f47d02356", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "27cd885d-29e1-42c8-815b-ad2dbc8aa2e1", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "d53fe955-592b-4361-8250-69890aa2db0d", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "e48633d8-a7c2-4273-83c3-d13256fd2c65", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "bc872469-3e01-43ef-9acd-c89020c59537", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "84add77a-24d8-4392-9310-a0ef277cfa30", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "923534ae-5fd8-44d5-8b64-d34fce188f4b", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "f183f2ef-f03c-4f51-9b88-e3091a60f1db", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "18048d3f-693d-423b-82db-a3143377d48e", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "da927a66-4973-41c3-8727-36623e22e4e8", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "ef670bea-6d6a-4977-9d25-ec5eb27bcb04", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "12a22817-8c13-4d59-88a9-12235d3c2bb9", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "26e157f0-7b52-4f0d-a6a8-78e9be343a82", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "902c97ca-d21e-4baa-bb76-188cf90d9ba1", + "name": "test_alert_config_1605052664635", + "description": "Alerting config description", + "hookIds": [ + "dc6acf85-fa8f-4f72-a6fa-1ef6af8071f9" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "snoozeFilter": { + "autoSnooze": 0, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + }, + { + "anomalyAlertingConfigurationId": "204a211a-c5f4-45f3-a30e-512fb25d1d2c", + "name": "alert-test-setting", + "description": "", + "hookIds": [ + "65fa0aa4-9b71-451c-a04c-cc74cb413ad7" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "High" + }, + "snoozeFilter": { + "autoSnooze": 0, + "snoozeScope": "Series", + "onlyForSuccessive": true + } + } + ] + } + ] + } + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "2011634348" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/GetAlertConfigurationsAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/GetAlertConfigurationsAsync.json new file mode 100644 index 0000000000000..d54bc9e05f910 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/GetAlertConfigurationsAsync.json @@ -0,0 +1,543 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/enrichment/anomalyDetection/configurations/fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c/alert/anomaly/configurations", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "1c057f8d95449ce29f10223558f72c09", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "0bf04f1f-94a3-4ad5-a514-e0ec44e0521d", + "Content-Length": "12404", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:22 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "100", + "X-Request-ID": "0bf04f1f-94a3-4ad5-a514-e0ec44e0521d" + }, + "ResponseBody": { + "value": [ + { + "anomalyAlertingConfigurationId": "b3dc6db3-617f-4229-b338-ac31baee2445", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "65e1606b-0254-4c18-8f66-877490e74b6a", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "3636f929-f7c5-494e-9eb3-8915d1552317", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "aaeb0a37-7402-4e2e-927a-8698e0ba41c4", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "e2c7ca76-56f6-4c2c-b435-b4bdf9825d2c", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "ccf99404-9296-4007-8611-1c626d9f01d8", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "e016612d-a658-436a-86e4-415b44e1d3aa", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "25ceef54-60cf-4d80-9886-3984f8cec8a2", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "81a9b3db-a888-4455-b1d4-ebf0b0c44b5e", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "0478e1a7-a5c1-4b46-bee9-7f76b09352b2", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "aed0331c-0784-4cd1-b182-7f5f47d02356", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "27cd885d-29e1-42c8-815b-ad2dbc8aa2e1", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "d53fe955-592b-4361-8250-69890aa2db0d", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "e48633d8-a7c2-4273-83c3-d13256fd2c65", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "bc872469-3e01-43ef-9acd-c89020c59537", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "84add77a-24d8-4392-9310-a0ef277cfa30", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "923534ae-5fd8-44d5-8b64-d34fce188f4b", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "f183f2ef-f03c-4f51-9b88-e3091a60f1db", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "18048d3f-693d-423b-82db-a3143377d48e", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "da927a66-4973-41c3-8727-36623e22e4e8", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "ef670bea-6d6a-4977-9d25-ec5eb27bcb04", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "12a22817-8c13-4d59-88a9-12235d3c2bb9", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "26e157f0-7b52-4f0d-a6a8-78e9be343a82", + "name": "test_alert_configuration", + "description": "testing_alert_configuration_description", + "crossMetricsOperator": "XOR", + "hookIds": [ + "793adcdb-5293-4e4a-a60c-7c32cd5829fc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false + }, + { + "anomalyDetectionConfigurationId": "e17f32d4-3ddf-4dc7-84ee-b4130c7e1777", + "anomalyScopeType": "All", + "negationOperation": false + } + ] + }, + { + "anomalyAlertingConfigurationId": "902c97ca-d21e-4baa-bb76-188cf90d9ba1", + "name": "test_alert_config_1605052664635", + "description": "Alerting config description", + "hookIds": [ + "dc6acf85-fa8f-4f72-a6fa-1ef6af8071f9" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "snoozeFilter": { + "autoSnooze": 0, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + }, + { + "anomalyAlertingConfigurationId": "204a211a-c5f4-45f3-a30e-512fb25d1d2c", + "name": "alert-test-setting", + "description": "", + "hookIds": [ + "65fa0aa4-9b71-451c-a04c-cc74cb413ad7" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "High" + }, + "snoozeFilter": { + "autoSnooze": 0, + "snoozeScope": "Series", + "onlyForSuccessive": true + } + } + ] + } + ] + } + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "2141653951" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndGetInstance.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndGetInstance.json new file mode 100644 index 0000000000000..176051a702f44 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndGetInstance.json @@ -0,0 +1,367 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-5e07b9eae2ac3445a362d5d436f3fd6b-d2cb6c92a19efe47-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "71cb7994c6b66edb15b6c05fb26f5f00", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookXsKZvjKB" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "f35d3a5e-f048-4e6b-a0e3-fc8fd545dfdb", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:08 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/c1da0726-7bfa-4871-bc2e-fac3a9155168", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "3374", + "X-Request-ID": "f35d3a5e-f048-4e6b-a0e3-fc8fd545dfdb" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "648", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-a5ecb2a20d73aa42abb78a36c32f7d57-dcf6c9d51a83b64a-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "4d427ec9556b24d783eccd93a0a70fda", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configDti0qANK", + "crossMetricsOperator": "XOR", + "hookIds": [ + "c1da0726-7bfa-4871-bc2e-fac3a9155168" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "7ae30875-fb93-4550-bdb5-59252e1be162", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:09 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/1e4a904f-99c0-4d3b-96bf-791244957af1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "148", + "X-Request-ID": "7ae30875-fb93-4550-bdb5-59252e1be162" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/1e4a904f-99c0-4d3b-96bf-791244957af1", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-e3b568f922e73d489d9685e9ed266200-661bfc81ac67b443-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "dbe4b46228cf782afa4579da951b668d", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "836bfb8c-ca48-40f1-8d75-83a931666883", + "Content-Length": "767", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:09 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "91", + "X-Request-ID": "836bfb8c-ca48-40f1-8d75-83a931666883" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "1e4a904f-99c0-4d3b-96bf-791244957af1", + "name": "configDti0qANK", + "description": "", + "crossMetricsOperator": "XOR", + "hookIds": [ + "c1da0726-7bfa-4871-bc2e-fac3a9155168" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/1e4a904f-99c0-4d3b-96bf-791244957af1", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "709", + "Content-Type": "application/merge-patch\u002Bjson", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-a737322f4ffe4840b9de11cd2098747c-6e385665c51ece4a-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "38a71db08d84c003df9cdcc5a1cc6025", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configDti0qANK", + "description": "This hook was created to test the .NET client.", + "crossMetricsOperator": "AND", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "valueFilter": { + "lower": 5, + "upper": 15, + "direction": "Both", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": true, + "topNAnomalyScope": { + "top": 50, + "period": 40, + "minTopCount": 30 + }, + "snoozeFilter": { + "autoSnooze": 4, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "63e84189-8e78-4bdd-95f7-b8f9f3c7cfca", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:09 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "121", + "X-Request-ID": "63e84189-8e78-4bdd-95f7-b8f9f3c7cfca" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/1e4a904f-99c0-4d3b-96bf-791244957af1", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-b671f4b42106564eb2a2c8e936467d80-d1c2724a7d514a4f-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "8195568aee22a1de53ca5225dbfd8f68", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "b10cbcba-6142-4e5a-8934-6e25103b66de", + "Content-Length": "785", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:09 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "86", + "X-Request-ID": "b10cbcba-6142-4e5a-8934-6e25103b66de" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "1e4a904f-99c0-4d3b-96bf-791244957af1", + "name": "configDti0qANK", + "description": "This hook was created to test the .NET client.", + "crossMetricsOperator": "AND", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "valueFilter": { + "lower": 5.0, + "upper": 15.0, + "direction": "Both", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": true, + "topNAnomalyScope": { + "top": 50, + "period": 40, + "minTopCount": 30 + }, + "snoozeFilter": { + "autoSnooze": 4, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/1e4a904f-99c0-4d3b-96bf-791244957af1", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-6c0fc65890b1a24d8c50e964cf40ac09-12944735bcd0fa42-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "83e24086d600d556b123fb334c65d72e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "5ab61c42-ca25-4027-a010-1594e80e31e5", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:09 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "112", + "X-Request-ID": "5ab61c42-ca25-4027-a010-1594e80e31e5" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/c1da0726-7bfa-4871-bc2e-fac3a9155168", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-db89a67537ce7b4b987de4e4f090b0c9-d28b1785c712e346-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "3e4f54e4e485c26a3e06e5b93bdde4e2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "c716f9d2-4de8-4d9d-95f6-ca6ccaf8bff9", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:09 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "164", + "X-Request-ID": "c716f9d2-4de8-4d9d-95f6-ca6ccaf8bff9" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1390271409" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndGetInstanceAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndGetInstanceAsync.json new file mode 100644 index 0000000000000..5b4f183ce7605 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndGetInstanceAsync.json @@ -0,0 +1,367 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-bbc8382037325f4e93f78a20fd40054c-754b4cba33562043-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "1c8a0c386da02e79c403cc2b5065d1a8", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookw4cgJZAG" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "25a92f35-c5ec-49db-bc69-379ec16d7b27", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:23 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/894de0a3-56db-44ab-af03-ea3223fa27eb", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "904", + "X-Request-ID": "25a92f35-c5ec-49db-bc69-379ec16d7b27" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "648", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-37e5a9392cc13e409733739669aa0618-cf9665c85de0c241-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "52eb56c17798bec810c3f7f019df1d53", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configsvjeElq2", + "crossMetricsOperator": "XOR", + "hookIds": [ + "894de0a3-56db-44ab-af03-ea3223fa27eb" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "fc850474-ca89-4222-933a-b505ffd02d17", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:23 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ba3a1685-ef31-40bd-a99f-f7ba435d1c38", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "155", + "X-Request-ID": "fc850474-ca89-4222-933a-b505ffd02d17" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ba3a1685-ef31-40bd-a99f-f7ba435d1c38", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-1bb20132e382784a8738582eabc178b4-9af2e9b921b4934c-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "0fd4e100f899b70bbd58eb388638fffc", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "80071005-c7f5-4512-9a96-3cef76c9e5c8", + "Content-Length": "767", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:23 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "91", + "X-Request-ID": "80071005-c7f5-4512-9a96-3cef76c9e5c8" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "ba3a1685-ef31-40bd-a99f-f7ba435d1c38", + "name": "configsvjeElq2", + "description": "", + "crossMetricsOperator": "XOR", + "hookIds": [ + "894de0a3-56db-44ab-af03-ea3223fa27eb" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ba3a1685-ef31-40bd-a99f-f7ba435d1c38", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "709", + "Content-Type": "application/merge-patch\u002Bjson", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-56a7257474e7cc4491fbf54c709b5f99-8875fb2cd3440444-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "495a929927814c963a0d1b8d6ee08ff6", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configsvjeElq2", + "description": "This hook was created to test the .NET client.", + "crossMetricsOperator": "AND", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "valueFilter": { + "lower": 5, + "upper": 15, + "direction": "Both", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": true, + "topNAnomalyScope": { + "top": 50, + "period": 40, + "minTopCount": 30 + }, + "snoozeFilter": { + "autoSnooze": 4, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "b98edf0a-deb4-4e05-b6f7-288184243890", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:23 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "133", + "X-Request-ID": "b98edf0a-deb4-4e05-b6f7-288184243890" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ba3a1685-ef31-40bd-a99f-f7ba435d1c38", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-d6cebe82190b034497d6483782b2fdf3-cdf15b5ffcf0bb49-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "b7456d986367c85e4b3394408b9038d7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "9f73b7d9-2495-48f3-bb93-9e1fbaa8f814", + "Content-Length": "785", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:23 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "98", + "X-Request-ID": "9f73b7d9-2495-48f3-bb93-9e1fbaa8f814" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "ba3a1685-ef31-40bd-a99f-f7ba435d1c38", + "name": "configsvjeElq2", + "description": "This hook was created to test the .NET client.", + "crossMetricsOperator": "AND", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "valueFilter": { + "lower": 5.0, + "upper": 15.0, + "direction": "Both", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": true, + "topNAnomalyScope": { + "top": 50, + "period": 40, + "minTopCount": 30 + }, + "snoozeFilter": { + "autoSnooze": 4, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ba3a1685-ef31-40bd-a99f-f7ba435d1c38", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-0d14da856c9a1941bd4f6f40edca1fd6-9d85a901d8913c49-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "8656fac4d485d9d14b87d48cdd7d49dc", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "e094860a-5ce3-4d75-8e3f-834f13ade23d", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:23 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "126", + "X-Request-ID": "e094860a-5ce3-4d75-8e3f-834f13ade23d" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/894de0a3-56db-44ab-af03-ea3223fa27eb", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-f75c3c2c503b314a921ee727e431d39c-3eaf6efbac904745-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "19a0f4c948f336943491fd4d9355c0aa", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "2049399c-b8fe-4c1e-90c2-1beda656d587", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:24 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "194", + "X-Request-ID": "2049399c-b8fe-4c1e-90c2-1beda656d587" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "952237586" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndNewInstance.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndNewInstance.json new file mode 100644 index 0000000000000..cb26761c73c85 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndNewInstance.json @@ -0,0 +1,301 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9634ec4da9c05b46bad652d59c012f89-626845cde96cf44b-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "a557d9a5886b8b49d9e6860c22d9efaa", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hook1XKyQJGU" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "55a4e025-f7cd-4e5f-8adc-e9f021961f1e", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:10 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/8fbf3ae7-4130-4b24-8891-709687a6beae", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "740", + "X-Request-ID": "55a4e025-f7cd-4e5f-8adc-e9f021961f1e" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "648", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-4407b1d99463934e9ea5ced4f8f92da0-02779dc1012c5543-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "11fbf12e0cb17f55394128b5481353f6", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configASxi3Wsh", + "crossMetricsOperator": "XOR", + "hookIds": [ + "8fbf3ae7-4130-4b24-8891-709687a6beae" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "09d29e1c-8cd4-41a2-87cf-3e21665db888", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:11 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/72ed515f-0d84-44db-9595-037de37d5696", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "126", + "X-Request-ID": "09d29e1c-8cd4-41a2-87cf-3e21665db888" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/72ed515f-0d84-44db-9595-037de37d5696", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "683", + "Content-Type": "application/merge-patch\u002Bjson", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-4cbb3de36d391e4992d3cf4e7bf9718b-102c5ac609c30a4f-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "511b448603ad05a24938456bfa66886a", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configASxi3Wsh", + "description": "This hook was created to test the .NET client.", + "crossMetricsOperator": "AND", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "valueFilter": { + "lower": 5, + "upper": 15, + "direction": "Both", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": true, + "topNAnomalyScope": { + "top": 50, + "period": 40, + "minTopCount": 30 + }, + "snoozeFilter": { + "autoSnooze": 4, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "52d8a318-70c4-461c-aeb6-46b573451888", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:11 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "129", + "X-Request-ID": "52d8a318-70c4-461c-aeb6-46b573451888" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/72ed515f-0d84-44db-9595-037de37d5696", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-c1391c5b7f2c0a4e9123fbe5f3f7509e-8a003e11a1952044-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "7a77f8e6388ccdda9106d3e0b13a6121", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "5ef54231-51c0-4130-8bd0-a4ff4a53a8f8", + "Content-Length": "785", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:11 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "77", + "X-Request-ID": "5ef54231-51c0-4130-8bd0-a4ff4a53a8f8" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "72ed515f-0d84-44db-9595-037de37d5696", + "name": "configASxi3Wsh", + "description": "This hook was created to test the .NET client.", + "crossMetricsOperator": "AND", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "valueFilter": { + "lower": 5.0, + "upper": 15.0, + "direction": "Both", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": true, + "topNAnomalyScope": { + "top": 50, + "period": 40, + "minTopCount": 30 + }, + "snoozeFilter": { + "autoSnooze": 4, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/72ed515f-0d84-44db-9595-037de37d5696", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-ac817e0b2d340446a9752d7bb562aa46-d600d7c5ab4a5c42-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "32a7fdc6a21f2bb04ef6c778c6e985d2", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "3a2b265f-3672-4476-a707-e6298207650b", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:11 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "113", + "X-Request-ID": "3a2b265f-3672-4476-a707-e6298207650b" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/8fbf3ae7-4130-4b24-8891-709687a6beae", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-03f6886bf350e942861916ecad37051b-2f1bba14323a384e-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "50cfbeb8d99b4d696a4ec0a730c1530f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "03445367-e41d-4bac-af22-08c5ecee50e7", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:11 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "179", + "X-Request-ID": "03445367-e41d-4bac-af22-08c5ecee50e7" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1411619225" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndNewInstanceAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndNewInstanceAsync.json new file mode 100644 index 0000000000000..a62fdbfa1bd56 --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithEveryMemberAndNewInstanceAsync.json @@ -0,0 +1,301 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-440734f74d3eaf4d9ee41d40fc1a34f6-9bea234ab7122147-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "355a31a13708170ff784b197e1af996c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookOdTqGNa9" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "41cf31ff-8deb-459c-b496-2d08dbc189f4", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:25 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/558ff3c4-7d66-49b1-b249-3ac991b3932e", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "905", + "X-Request-ID": "41cf31ff-8deb-459c-b496-2d08dbc189f4" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "648", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-41238cf0070e694b8976527338ae6732-ed16311b70039e4f-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "6dca5c0556fcdcfb26ae9d4b89da29bc", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "confignSIYRHjo", + "crossMetricsOperator": "XOR", + "hookIds": [ + "558ff3c4-7d66-49b1-b249-3ac991b3932e" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "23c7f8ec-998e-46d3-a30b-e233e8765d2a", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:25 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/189ac968-9e2d-4821-91bf-625f6150ea19", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "150", + "X-Request-ID": "23c7f8ec-998e-46d3-a30b-e233e8765d2a" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/189ac968-9e2d-4821-91bf-625f6150ea19", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "683", + "Content-Type": "application/merge-patch\u002Bjson", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-7b7dccdfbf21e4478aa6942ff388dad3-8d4650b7f4fc7649-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "2ea15abfcfad535727b63fc807e1bf02", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "confignSIYRHjo", + "description": "This hook was created to test the .NET client.", + "crossMetricsOperator": "AND", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "valueFilter": { + "lower": 5, + "upper": 15, + "direction": "Both", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": true, + "topNAnomalyScope": { + "top": 50, + "period": 40, + "minTopCount": 30 + }, + "snoozeFilter": { + "autoSnooze": 4, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "7824a3b6-ada7-415c-b562-190820a7aab0", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:25 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "129", + "X-Request-ID": "7824a3b6-ada7-415c-b562-190820a7aab0" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/189ac968-9e2d-4821-91bf-625f6150ea19", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-37cac0957cdcdd49bda4a72fa0bbdb64-5f9afa4da830d54d-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "ab2f3605a26ca01b89d57132114ee3cd", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "6d046ce0-0c15-49d6-b16d-9ca825622f13", + "Content-Length": "785", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:25 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "99", + "X-Request-ID": "6d046ce0-0c15-49d6-b16d-9ca825622f13" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "189ac968-9e2d-4821-91bf-625f6150ea19", + "name": "confignSIYRHjo", + "description": "This hook was created to test the .NET client.", + "crossMetricsOperator": "AND", + "hookIds": [], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Medium", + "maxAlertSeverity": "High" + }, + "valueFilter": { + "lower": 5.0, + "upper": 15.0, + "direction": "Both", + "triggerForMissing": false + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "TopN", + "negationOperation": true, + "topNAnomalyScope": { + "top": 50, + "period": 40, + "minTopCount": 30 + }, + "snoozeFilter": { + "autoSnooze": 4, + "snoozeScope": "Metric", + "onlyForSuccessive": true + } + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/189ac968-9e2d-4821-91bf-625f6150ea19", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-3c504ee3eb61d141b93facbe12cb6e9e-dcf13123e2ae7d4a-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "337a0700fefd3677047745451732d445", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "2691e39e-e04a-491b-b4ed-4b3d6030f9ba", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:26 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "124", + "X-Request-ID": "2691e39e-e04a-491b-b4ed-4b3d6030f9ba" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/558ff3c4-7d66-49b1-b249-3ac991b3932e", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-9b99e262b8e4784199ee6690bbac1b42-c2b48fa3566e8c49-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "52469bef7daa1d4f3e00a4d75d2541d8", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "e20f8121-59c3-48a0-99e5-c4e945ebeda6", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:26 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "179", + "X-Request-ID": "e20f8121-59c3-48a0-99e5-c4e945ebeda6" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1836132380" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndGetInstance.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndGetInstance.json new file mode 100644 index 0000000000000..82dd743478c9a --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndGetInstance.json @@ -0,0 +1,363 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-ba3800231d14244fb192e834c1d13850-04759a113166c440-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "e3751a58e913cd2c6f76d4dc6cd5c06f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hook9VQiznII" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "28f4a290-fe0a-49ee-8591-ca2fc88dad70", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:12 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/b0aee2d3-c805-4bd3-a536-b08da845f225", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "879", + "X-Request-ID": "28f4a290-fe0a-49ee-8591-ca2fc88dad70" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "648", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-040ecce201ef134fb1614d53eef35b57-640982542a9ebf40-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "a614de00fc3af32472f8e1a8dff5db22", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configRLmIGBPo", + "crossMetricsOperator": "XOR", + "hookIds": [ + "b0aee2d3-c805-4bd3-a536-b08da845f225" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "edb8679c-ea2f-457b-a6df-e3d33ace0a20", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:13 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ca5ab69e-5b65-4bc5-a96f-f1c170c35139", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "135", + "X-Request-ID": "edb8679c-ea2f-457b-a6df-e3d33ace0a20" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ca5ab69e-5b65-4bc5-a96f-f1c170c35139", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-5345c847997a5a4ca1975e228344a7d1-649b1e8e3c0b6d47-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "22aaf74dd48c097edf7e2cc9d163fd6b", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "2be2f3c6-97d8-4815-9e5f-7090330671a8", + "Content-Length": "767", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:13 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "88", + "X-Request-ID": "2be2f3c6-97d8-4815-9e5f-7090330671a8" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "ca5ab69e-5b65-4bc5-a96f-f1c170c35139", + "name": "configRLmIGBPo", + "description": "", + "crossMetricsOperator": "XOR", + "hookIds": [ + "b0aee2d3-c805-4bd3-a536-b08da845f225" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ca5ab69e-5b65-4bc5-a96f-f1c170c35139", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "690", + "Content-Type": "application/merge-patch\u002Bjson", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-6ec1b3d0e5be8647ac02ee92f095797a-34952c2b348e8543-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "35e29aba86d4729352e16973f3188ffe", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configRLmIGBPo", + "description": "", + "crossMetricsOperator": "OR", + "hookIds": [ + "b0aee2d3-c805-4bd3-a536-b08da845f225" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "1ed2517e-9d59-45a9-b224-dbaef8ddd10f", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:13 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "163", + "X-Request-ID": "1ed2517e-9d59-45a9-b224-dbaef8ddd10f" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ca5ab69e-5b65-4bc5-a96f-f1c170c35139", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-ff1b3fdb914e1b4da88f9c3c35860418-0194992830bf9f4e-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "99c00e633d422c4e5f0bc6bbd05a220f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "e936b8c3-76d9-4dac-a67f-bc77e500d13c", + "Content-Length": "766", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:13 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "109", + "X-Request-ID": "e936b8c3-76d9-4dac-a67f-bc77e500d13c" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "ca5ab69e-5b65-4bc5-a96f-f1c170c35139", + "name": "configRLmIGBPo", + "description": "", + "crossMetricsOperator": "OR", + "hookIds": [ + "b0aee2d3-c805-4bd3-a536-b08da845f225" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/ca5ab69e-5b65-4bc5-a96f-f1c170c35139", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-e22a4eb1f424fe40b740c2df49ab4b0f-3f05cc9f0a070744-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "45ee76fba512c64d6337d0aa6a0b15c7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "7175b75f-bdee-4dbf-af21-8b461ed2826e", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:13 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "111", + "X-Request-ID": "7175b75f-bdee-4dbf-af21-8b461ed2826e" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/b0aee2d3-c805-4bd3-a536-b08da845f225", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-15adf1b6b57f3d45a7191257bab7484c-e215aedf28a96e4e-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "c2652dee64a27c284cb6d6c9bfd7a2f7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "06d17044-388e-4ff4-9972-932f0c34e7ed", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:14 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "166", + "X-Request-ID": "06d17044-388e-4ff4-9972-932f0c34e7ed" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "769449677" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndGetInstanceAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndGetInstanceAsync.json new file mode 100644 index 0000000000000..7dbd5a7be56ac --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndGetInstanceAsync.json @@ -0,0 +1,363 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-5db1e909635ce1458247ad678bcb5a65-f2761b4196a61349-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "d9454b5a3b47828c5b6322c4906d42f5", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookKW78sbnO" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "a7da0f37-0055-4a9d-9f81-9ecc413ae5d9", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:27 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/0a001c01-c1b9-4837-8b40-35cb5283ec3d", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "662", + "X-Request-ID": "a7da0f37-0055-4a9d-9f81-9ecc413ae5d9" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "648", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-199540f3799a4644b7febd3c70156e95-d83f7f760684354b-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "b6f14dc8b3ea8e8e09cbc05d6d856174", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configVZGpcoSR", + "crossMetricsOperator": "XOR", + "hookIds": [ + "0a001c01-c1b9-4837-8b40-35cb5283ec3d" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "62b2932c-dae2-4af9-b919-a060d61a6145", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:27 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/cf28141e-f711-4e82-a943-814bb5e6b029", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "131", + "X-Request-ID": "62b2932c-dae2-4af9-b919-a060d61a6145" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/cf28141e-f711-4e82-a943-814bb5e6b029", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-b9539cc4b24b8a4cb44096a61bc55639-462cc97a9a792b4b-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "dc685e48f73da10e0b49ff03e461b73e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "27e079b1-84cc-4c39-82cf-b63d81286975", + "Content-Length": "767", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:27 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "103", + "X-Request-ID": "27e079b1-84cc-4c39-82cf-b63d81286975" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "cf28141e-f711-4e82-a943-814bb5e6b029", + "name": "configVZGpcoSR", + "description": "", + "crossMetricsOperator": "XOR", + "hookIds": [ + "0a001c01-c1b9-4837-8b40-35cb5283ec3d" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/cf28141e-f711-4e82-a943-814bb5e6b029", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "690", + "Content-Type": "application/merge-patch\u002Bjson", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-3429422acc6e0f4caa0177d462e63381-fa5404c2f3793b49-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "fa117128d64aa897d593bbc5ade5874f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configVZGpcoSR", + "description": "", + "crossMetricsOperator": "OR", + "hookIds": [ + "0a001c01-c1b9-4837-8b40-35cb5283ec3d" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "1ff68268-30e3-4da7-af33-971cfd4647b7", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:27 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "131", + "X-Request-ID": "1ff68268-30e3-4da7-af33-971cfd4647b7" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/cf28141e-f711-4e82-a943-814bb5e6b029", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-bdd14a7bcb520e4c9330ce92762910ce-b4aad98178d4c04c-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "2225144645b3d0973e50aaa1b38baaa7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "f5be2cca-bc16-48bb-b1eb-c57d18bb7dfc", + "Content-Length": "766", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:27 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "109", + "X-Request-ID": "f5be2cca-bc16-48bb-b1eb-c57d18bb7dfc" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "cf28141e-f711-4e82-a943-814bb5e6b029", + "name": "configVZGpcoSR", + "description": "", + "crossMetricsOperator": "OR", + "hookIds": [ + "0a001c01-c1b9-4837-8b40-35cb5283ec3d" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/cf28141e-f711-4e82-a943-814bb5e6b029", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-a2979f43f34ab846a011c4a2a5b1b7a5-014974d87b42dd49-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "fc3481136773722ac7bf07a93c49f326", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "60c22b6e-1794-4597-a42f-f14d5b661e34", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:27 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "136", + "X-Request-ID": "60c22b6e-1794-4597-a42f-f14d5b661e34" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/0a001c01-c1b9-4837-8b40-35cb5283ec3d", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-86059c6deeae354d963b03dc057e10da-f23c51969514dc4b-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "d0bdb0c1943ce38bd940bbf92bf5f449", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "e409fa9e-9d67-4f02-95e4-43611d0ceb5b", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:28 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "179", + "X-Request-ID": "e409fa9e-9d67-4f02-95e4-43611d0ceb5b" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "1311815241" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndNewInstance.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndNewInstance.json new file mode 100644 index 0000000000000..d178c7e8027dd --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndNewInstance.json @@ -0,0 +1,296 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-be9e959e79162a4babbd1e8c23bc07a3-5e930487e9ae084a-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "c205b4c4fd60e39fd4a2b49f9e2364db", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookCbmaRckO" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "b682e43c-6214-49eb-8e29-31ab19025de4", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:14 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/5528778e-896b-476f-952e-5ab86ce138f9", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "669", + "X-Request-ID": "b682e43c-6214-49eb-8e29-31ab19025de4" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "648", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-fe3f48566e348a4aa9aa1f2ac521d6f2-2e22bf1000e30645-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "1e04315272ee1d82d3b4a6e6e9edce4c", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configbmc8z96Z", + "crossMetricsOperator": "XOR", + "hookIds": [ + "5528778e-896b-476f-952e-5ab86ce138f9" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "3de24307-c754-4536-9262-d4a7fd61bdb3", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:15 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/7985c8bd-0723-426b-a513-2b91da2076e1", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "143", + "X-Request-ID": "3de24307-c754-4536-9262-d4a7fd61bdb3" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/7985c8bd-0723-426b-a513-2b91da2076e1", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "647", + "Content-Type": "application/merge-patch\u002Bjson", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-5af8d8108aaf0440b4222561b603f926-db2427977ae1ba4f-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "41dfd3fd18b53a8ca256a06285068e80", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configbmc8z96Z", + "crossMetricsOperator": "OR", + "hookIds": [ + "5528778e-896b-476f-952e-5ab86ce138f9" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "4a43c16d-ebc9-4991-92ac-da1b372df1fe", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "166", + "X-Request-ID": "4a43c16d-ebc9-4991-92ac-da1b372df1fe" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/7985c8bd-0723-426b-a513-2b91da2076e1", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-20a037817f3afd4596a72ab707255575-5c4214c0992b5b44-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "2f70ecaf81f962f42096cce97c7df164", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "5e0ab4aa-c097-40c6-bfbc-5ab93f10346a", + "Content-Length": "766", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "84", + "X-Request-ID": "5e0ab4aa-c097-40c6-bfbc-5ab93f10346a" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "7985c8bd-0723-426b-a513-2b91da2076e1", + "name": "configbmc8z96Z", + "description": "", + "crossMetricsOperator": "OR", + "hookIds": [ + "5528778e-896b-476f-952e-5ab86ce138f9" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/7985c8bd-0723-426b-a513-2b91da2076e1", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-a96121ccafe3134b9e9687c9b54a3b67-1bd1f90c7cc6d549-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "5d05c6bbc3643962a4c97b97d11f97cc", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "a9f19624-5be5-478c-a1e9-952e78a2a1c9", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:15 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "120", + "X-Request-ID": "a9f19624-5be5-478c-a1e9-952e78a2a1c9" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/5528778e-896b-476f-952e-5ab86ce138f9", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-333b3126e973a146829d85bf1ea43644-762d3a8b23411048-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "fc3726259f7d7b53de7c201f4ca2be24", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "f68f1e7a-1650-464e-a9fa-55136bddaed9", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:16 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "182", + "X-Request-ID": "f68f1e7a-1650-464e-a9fa-55136bddaed9" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "542956108" + } +} \ No newline at end of file diff --git a/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndNewInstanceAsync.json b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndNewInstanceAsync.json new file mode 100644 index 0000000000000..1b6e7aacdff8c --- /dev/null +++ b/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/tests/SessionRecords/AnomalyAlertConfigurationLiveTests/UpdateAlertConfigurationWithMinimumSetupAndNewInstanceAsync.json @@ -0,0 +1,296 @@ +{ + "Entries": [ + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "98", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-c953100bcc52904e80f5d183c58c7ec2-11af024625698449-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "5b3e93ae67f83cae97804a6487c66c88", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "hookParameter": { + "endpoint": "http://contoso.com" + }, + "hookType": "Webhook", + "hookName": "hookHLjffVVG" + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "a0b4aa90-1481-42e7-9cd2-974e9873a149", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:29 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/8b67b2d1-3ff8-43dd-a508-e9cce7f02efc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "961", + "X-Request-ID": "a0b4aa90-1481-42e7-9cd2-974e9873a149" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "648", + "Content-Type": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-34ccb6fb81e0a041ab69c9beba3159c3-7213bfe75c508447-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "dc065d590607cf9fa86754613c1a7a3f", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configE6fdYxvm", + "crossMetricsOperator": "XOR", + "hookIds": [ + "8b67b2d1-3ff8-43dd-a508-e9cce7f02efc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 201, + "ResponseHeaders": { + "apim-request-id": "a221839e-66f7-42bb-8647-2bd0aa8a8a14", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:29 GMT", + "Location": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/3b0c79d1-d4bb-477c-8c4e-61b0080d5f2e", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "136", + "X-Request-ID": "a221839e-66f7-42bb-8647-2bd0aa8a8a14" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/3b0c79d1-d4bb-477c-8c4e-61b0080d5f2e", + "RequestMethod": "PATCH", + "RequestHeaders": { + "Accept": "application/json", + "Content-Length": "647", + "Content-Type": "application/merge-patch\u002Bjson", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-59fdae8440d341488510774d54576db2-a0616ab0beaafd40-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "ee22d79be322e83ff101bf4e13cf66d5", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "name": "configE6fdYxvm", + "crossMetricsOperator": "OR", + "hookIds": [ + "8b67b2d1-3ff8-43dd-a508-e9cce7f02efc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10, + "upper": 20, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + }, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "191ae415-0a7c-49ca-b30f-6b8b60c344ed", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:29 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "133", + "X-Request-ID": "191ae415-0a7c-49ca-b30f-6b8b60c344ed" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/3b0c79d1-d4bb-477c-8c4e-61b0080d5f2e", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-f9cf7e4d08aa2347bd055f1ab91e070d-838cb74566150f4a-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "9b024150d2609035e07abc1f720a4b58", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "apim-request-id": "37617b6c-3cd0-442a-8e69-fa1c29d0620d", + "Content-Length": "766", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 22 Dec 2020 02:28:29 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "88", + "X-Request-ID": "37617b6c-3cd0-442a-8e69-fa1c29d0620d" + }, + "ResponseBody": { + "anomalyAlertingConfigurationId": "3b0c79d1-d4bb-477c-8c4e-61b0080d5f2e", + "name": "configE6fdYxvm", + "description": "", + "crossMetricsOperator": "OR", + "hookIds": [ + "8b67b2d1-3ff8-43dd-a508-e9cce7f02efc" + ], + "metricAlertingConfigurations": [ + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": false, + "severityFilter": { + "minAlertSeverity": "Low", + "maxAlertSeverity": "Medium" + }, + "snoozeFilter": { + "autoSnooze": 12, + "snoozeScope": "Series", + "onlyForSuccessive": true + }, + "valueFilter": { + "lower": 10.0, + "upper": 20.0, + "direction": "Both", + "metricId": "27e3015f-04fd-44ba-a20b-bc529a0aebae", + "triggerForMissing": true + } + }, + { + "anomalyDetectionConfigurationId": "fb5a6ed6-2b9e-4b72-8b0c-0046ead1c15c", + "anomalyScopeType": "All", + "negationOperation": true + } + ] + } + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/alert/anomaly/configurations/3b0c79d1-d4bb-477c-8c4e-61b0080d5f2e", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-1b4aebac4546ea4d92dcd4ea4e32cc6d-e87c4612eae4d142-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "86f8cb4554b675da1e1dea054750bbd8", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "5eaec6f3-ecd5-4694-8901-cb954be67f16", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:29 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "122", + "X-Request-ID": "5eaec6f3-ecd5-4694-8901-cb954be67f16" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/hooks/8b67b2d1-3ff8-43dd-a508-e9cce7f02efc", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Ocp-Apim-Subscription-Key": "Sanitized", + "traceparent": "00-3ae68f0340971e408cac9ac02c8f546c-09fcfc24f56c434b-00", + "User-Agent": [ + "azsdk-net-AI.MetricsAdvisor/1.0.0-alpha.20201221.1", + "(.NET Core 4.6.29321.03; Microsoft Windows 10.0.19042 )" + ], + "x-api-key": "Sanitized", + "x-ms-client-request-id": "fb117f01df18c9dea1920da7271f76e7", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 204, + "ResponseHeaders": { + "apim-request-id": "cb3d0aa0-31d1-4042-9f89-3177fc59f00a", + "Content-Length": "0", + "Date": "Tue, 22 Dec 2020 02:28:30 GMT", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload", + "X-Content-Type-Options": "nosniff", + "x-envoy-upstream-service-time": "176", + "X-Request-ID": "cb3d0aa0-31d1-4042-9f89-3177fc59f00a" + }, + "ResponseBody": [] + } + ], + "Variables": { + "METRICSADVISOR_ACCOUNT_NAME": "js-metrics-advisor", + "METRICSADVISOR_ENDPOINT_SUFFIX": null, + "METRICSADVISOR_PRIMARY_API_KEY": "Sanitized", + "METRICSADVISOR_SUBSCRIPTION_KEY": "Sanitized", + "RandomSeed": "308509140" + } +} \ No newline at end of file