-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MetricsAdvisor] Updated Create methods to return whole models instea…
…d of ID (#18491)
- Loading branch information
Showing
266 changed files
with
28,585 additions
and
9,226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ Azure Cognitive Services Metrics Advisor is a cloud service that uses machine le | |
Install the Azure Metrics Advisor client library for .NET with [NuGet][nuget]: | ||
|
||
```PowerShell | ||
dotnet add package Azure.AI.MetricsAdvisor --version 1.0.0-beta.2 | ||
dotnet add package Azure.AI.MetricsAdvisor --version 1.0.0-beta.3 | ||
``` | ||
|
||
### Prerequisites | ||
|
@@ -203,36 +203,31 @@ dataFeed.IngestionSettings = new DataFeedIngestionSettings() | |
IngestionStartTime = DateTimeOffset.Parse("2020-01-01T00:00:00Z") | ||
}; | ||
|
||
Response<string> response = await adminClient.CreateDataFeedAsync(dataFeed); | ||
Response<DataFeed> response = await adminClient.CreateDataFeedAsync(dataFeed); | ||
|
||
string dataFeedId = response.Value; | ||
DataFeed createdDataFeed = response.Value; | ||
|
||
Console.WriteLine($"Data feed ID: {dataFeedId}"); | ||
``` | ||
|
||
Note that only the ID of the data feed is known at this point. You can perform another service call to `GetDataFeedAsync` or `GetDataFeed` to get more information, such as status, created time, the list of administrators, or the metric IDs. | ||
|
||
```C# Snippet:GetDataFeedAsync | ||
string dataFeedId = "<dataFeedId>"; | ||
|
||
Response<DataFeed> response = await adminClient.GetDataFeedAsync(dataFeedId); | ||
|
||
DataFeed dataFeed = response.Value; | ||
|
||
Console.WriteLine($"Data feed status: {dataFeed.Status.Value}"); | ||
Console.WriteLine($"Data feed created time: {dataFeed.CreatedTime.Value}"); | ||
Console.WriteLine($"Data feed ID: {createdDataFeed.Id}"); | ||
Console.WriteLine($"Data feed status: {createdDataFeed.Status.Value}"); | ||
Console.WriteLine($"Data feed created time: {createdDataFeed.CreatedTime.Value}"); | ||
|
||
Console.WriteLine($"Data feed administrators:"); | ||
foreach (string admin in dataFeed.Administrators) | ||
foreach (string admin in createdDataFeed.Administrators) | ||
{ | ||
Console.WriteLine($" - {admin}"); | ||
} | ||
|
||
Console.WriteLine($"Metric IDs:"); | ||
foreach (DataFeedMetric metric in dataFeed.Schema.MetricColumns) | ||
foreach (DataFeedMetric metric in createdDataFeed.Schema.MetricColumns) | ||
{ | ||
Console.WriteLine($" - {metric.MetricName}: {metric.MetricId}"); | ||
} | ||
|
||
Console.WriteLine($"Dimension columns:"); | ||
foreach (DataFeedDimension dimension in createdDataFeed.Schema.DimensionColumns) | ||
{ | ||
Console.WriteLine($" - {dimension.DimensionName}"); | ||
} | ||
``` | ||
|
||
### Check the ingestion status of a data feed | ||
|
@@ -297,11 +292,11 @@ detectCondition.SmartDetectionCondition = new SmartDetectionCondition(10.0, Anom | |
|
||
detectCondition.CrossConditionsOperator = DetectionConditionsOperator.Or; | ||
|
||
Response<string> response = await adminClient.CreateDetectionConfigurationAsync(detectionConfiguration); | ||
Response<AnomalyDetectionConfiguration> response = await adminClient.CreateDetectionConfigurationAsync(detectionConfiguration); | ||
|
||
string detectionConfigurationId = response.Value; | ||
AnomalyDetectionConfiguration createdDetectionConfiguration = response.Value; | ||
|
||
Console.WriteLine($"Anomaly detection configuration ID: {detectionConfigurationId}"); | ||
Console.WriteLine($"Anomaly detection configuration ID: {createdDetectionConfiguration.Id}"); | ||
``` | ||
|
||
### Create a hook for receiving anomaly alerts | ||
|
@@ -319,11 +314,11 @@ var emailHook = new EmailNotificationHook() | |
emailHook.EmailsToAlert.Add("[email protected]"); | ||
emailHook.EmailsToAlert.Add("[email protected]"); | ||
|
||
Response<string> response = await adminClient.CreateHookAsync(emailHook); | ||
Response<NotificationHook> response = await adminClient.CreateHookAsync(emailHook); | ||
|
||
string hookId = response.Value; | ||
NotificationHook createdHook = response.Value; | ||
|
||
Console.WriteLine($"Hook ID: {hookId}"); | ||
Console.WriteLine($"Hook ID: {createdHook.Id}"); | ||
``` | ||
|
||
### Create an anomaly alert configuration | ||
|
@@ -348,11 +343,11 @@ var metricAlertConfiguration = new MetricAnomalyAlertConfiguration(anomalyDetect | |
|
||
alertConfiguration.MetricAlertConfigurations.Add(metricAlertConfiguration); | ||
|
||
Response<string> response = await adminClient.CreateAlertConfigurationAsync(alertConfiguration); | ||
Response<AnomalyAlertConfiguration> response = await adminClient.CreateAlertConfigurationAsync(alertConfiguration); | ||
|
||
string alertConfigurationId = response.Value; | ||
AnomalyAlertConfiguration createdAlertConfiguration = response.Value; | ||
|
||
Console.WriteLine($"Alert configuration ID: {alertConfigurationId}"); | ||
Console.WriteLine($"Alert configuration ID: {createdAlertConfiguration.Id}"); | ||
``` | ||
|
||
### Query detected anomalies and triggered alerts | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.