Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MetricsAdvisor] Fixed UpdateAlertConfiguration methods #21514

Merged
merged 10 commits into from
Jun 4, 2021

Conversation

kinelski
Copy link
Member

@kinelski kinelski commented Jun 2, 2021

Part of #21177.
Fixes #18457.

@kinelski kinelski added Client This issue points to a problem in the data-plane of the library. Cognitive - Metrics Advisor labels Jun 2, 2021
@kinelski kinelski self-assigned this Jun 2, 2021
@kinelski kinelski requested a review from maririos June 2, 2021 13:46
@kinelski kinelski marked this pull request as ready for review June 2, 2021 13:46
@@ -11,6 +11,7 @@

namespace Azure.AI.MetricsAdvisor.Tests
{
[Ignore("Data is old and tests can't be recorded again")]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is too suspicious, but the problem is that I can't record these tests again because the data we're trying to get from the service is not there anymore. My guess is that the service periodically deletes entries that are too old. I'll adjust the date times we use accordingly (and always use a relative time), but I'll do this in a separate PR to make this one easier to review.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have an issue with that? consider linking the issue to this ignore message so it is easier to map

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I was too sleepy when I did this. The change is just updating some local IDs and rerecording some tests, so I think I can do it in this PR.

Copy link
Member Author

@kinelski kinelski Jun 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the end, the issue was caused because of a configuration we deleted by accident. Talked to the service team and they were able to restore the deleted config, so I removed the Ignore attribute.

@@ -47,12 +47,12 @@ internal MetricAnomalyAlertConfiguration(string detectionConfigurationId, Metric
/// The identifier of the anomaly detection configuration to which this configuration applies.
/// </summary>
[CodeGenMember("AnomalyDetectionConfigurationId")]
public string DetectionConfigurationId { get; }
public string DetectionConfigurationId { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if my assumption of codegen serializing with custom type is wrong then this is ok. If it is right, shouldn't there be a patch method for this property?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still haven't figured out what you were trying to say, but I think I explained the issue properly in the other PR.

In fact, the service doesn't have a patch version for MetricAnomalyAlertConfiguration. This type is not used directly in Create/Update methods. Actually, it is part of a collection (an array in the REST API):

// Type passed to the Create/Update methods
public class AnomalyAlertConfiguration
{
  public IList<MetricAnomalyAlertConfiguration> AlertConfigurations { get; }

  internal <model-name>Patch GetPatchModel()
  {
    ...
  }
}

The service does not support a "partial" array update. According to Johan, this is what's expected according to the JSON "merge-patch" format, used by the MA service. So every time a user wants to update this array, all of its members must be specified in their entirety. That's why they didn't add a patch model for this type.

@@ -11,6 +11,7 @@

namespace Azure.AI.MetricsAdvisor.Tests
{
[Ignore("Data is old and tests can't be recorded again")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have an issue with that? consider linking the issue to this ignore message so it is easier to map

@kinelski kinelski merged commit 7f9ea76 into Azure:master Jun 4, 2021
@kinelski kinelski deleted the ma-alertConfig branch June 4, 2021 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Metrics Advisor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MetricsAdvisor] Consider making required properties in MetricAnomalyAlertConfiguration settable
2 participants