question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[@azure/arm-monitor] containsAny support for ActivityLogAlertLeafCondition

See original GitHub issue

Feature request In order to create and update Service Health Activity Log Alerts with containsAny property inside allOf condition the SDK needs to support the property.

It seems that the SDK uses apiVersion: 2017-04-01 which does not yet support containsAny property. Azure portal seems to already use apiVersion: 2020-06-01 which does support it.

This results in a scenario where I can manually create alert in the portal with containsAny property inside allOf condition, which can be returned with the SDK by calling MonitorClient(...).activityLogAlerts.get(resourceGroupName, alertName):

"condition": {
    "allOf": [
      ...
      {
        "field": "properties.impactedServices[*].ImpactedRegions[*].RegionName",
        "equals": null,
        "containsAny": [
          "Global",
          "West Europe",
        ],
        "odata.type": null
      }
    ],
    "odata.type": null
  }

But if I want to create (or update) an alert with containsAny rule with the SDK it isn’t possible. As a workaround I tried to create alert by using equals property in a following condition:

{
        "field": "properties.impactedServices[*].ImpactedRegions[*].RegionName",
        "equals": "West Europe",
}   

but when shown in the portal it shows that “Region(s)” is set to “all” and when trying to open the alert for modification the ui shows an error page with “Unexpected error”.

As a workaround I created alerts that are scoped to my resource groups and only use following condition:

{
     field: 'category',
     equals: 'ServiceHealth'
}

This should work fine, but it would be great if it would be possible to create alerts with containsAny conditions and also update them with the SDK.

Additional context

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
eero3commented, Jul 2, 2022

First of all, thank you for the fast fix!

Unfortunately I cannot test the changes due my summer vacation - but I briefly checked the source code for the beta and it seems to include the changes that were requested in the issue!

1reaction
MaryGaocommented, May 26, 2022

@eero3 I think this is a valid issue and we’ll contact the service team to update and release our package to the latest one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@azure/arm-monitor package | Microsoft Learn
An action group object for the body of patch operations. ActionGroups. Interface representing a ActionGroups. ActionGroupsCreateOrUpdateOptionalParams. Optional ...
Read more >
@azure/arm-monitor - NET
Azure Monitor client library for JavaScript. This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Monitor client....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found