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

[BUG] Unknown MonitorConditionOperator value. (Parameter 'value') Actual value was Equal. #41377

Closed
geolawton opened this issue Jan 18, 2024 · 4 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. Monitor Monitor, Monitor Ingestion, Monitor Query needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@geolawton
Copy link

Library name and version

Azure.ResourceManager.Monitor 1.3.0

Describe the bug

It's possible for alert rules to have the Operator of "Equal" when created in the Azure Portal. The enum MointorConditionOperator Does not have a value for this to map to and will crash when it attempts to do so.

Expected behavior

Should be able to query for alerts that have a "Equal to" operator

Actual behavior

Will crash with an ArgumentOutOfRangeException when attempting to get an alert rule that has "table rows = 0"

Reproduction Steps

Create a log search alert rule using Application Insights.

  • Set the Alert Logic condition to be as such:
    image
  • Confirm that the operator is set to Equal on "Review + Create"
    image
  • Run the following code to get all alert rules. It will crash on GetAllAsync() when trying to get the alert with the Equal operator
var client = new ArmClient(new DefaultAzureCredential());
var subscription = client.GetDefaultSubscription();
var allRgs = subscription.GetResourceGroups();

var scheduledQueryRules = new List<ScheduledQueryRuleResource>();
foreach(var rg in allRgs)
{
     await foreach(var scheduledQueryRule in rg.GetScheduledQueryRules().GetAllAsync())
     {
         currentScheduledQueryRule = scheduledQueryRule;
         scheduledQueryRules.Add(scheduledQueryRule);
     }
}

Environment

IDE: Rider
Version: Build #RD-233.13135.100

dotnet --info output

.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.8d38d0cc

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22621
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.100\

.NET workloads installed:
 Workload version: 8.0.100-manifests.8d38d0cc
There are no installed workloads to display.

Host:
  Version:      8.0.0
  Architecture: x64
  Commit:       5535e31a71

.NET SDKs installed:
  8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 18, 2024
@geolawton
Copy link
Author

There is a workaround where changing the alert in the Azure Portal to use GreaterThen and LessThan will circumnavigate the issue. E.g. table rows = 0 becomes table rows < 1

@jsquire jsquire added this to the gmt milestone Jan 18, 2024
@jsquire jsquire added Monitor Monitor, Monitor Ingestion, Monitor Query Mgmt This issue is related to a management-plane library. needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Jan 18, 2024
@jsquire
Copy link
Member

jsquire commented Jan 18, 2024

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@jsquire jsquire removed this from the gmt milestone Jan 29, 2024
@HarveyLink
Copy link
Member

This is a service issue. The defined value is: Equals, but the actual response is Equal.
https://github.com/Azure/azure-rest-api-specs/blob/2491b616cde43277fae339604f03f59412e016aa/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/scheduledQueryRule_API.json#L607
We had a quick fix on the SDK, waiting for review & merge.

HarveyLink added a commit that referenced this issue Mar 7, 2024
* Fix for issue 41377

* Update CHANGELOG.md

* Update MonitorConditionOperator.Serialization.cs
@HarveyLink
Copy link
Member

Issue fixed, will ship in the next release.

angiurgiu pushed a commit that referenced this issue Mar 20, 2024
* Fix for issue 41377

* Update CHANGELOG.md

* Update MonitorConditionOperator.Serialization.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. Monitor Monitor, Monitor Ingestion, Monitor Query needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

4 participants