From 77ceca4f6ffb19c1a144ea4c842a0d61bca4963f Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Mon, 23 Jan 2023 16:22:35 +0200 Subject: [PATCH 01/16] Adds base for updating Microsoft.AlertsManagement from version preview/2021-07-22-preview to version 2023-03-01 --- .../2023-03-01/PrometheusRuleGroups.json | 497 ++++++++++++++++++ .../createOrUpdatePrometheusRuleGroup.json | 167 ++++++ .../examples/deletePrometheusRuleGroup.json | 12 + .../examples/getPrometheusRuleGroup.json | 60 +++ .../examples/listPrometheusRuleGroups.json | 63 +++ .../listSubscriptionPrometheusRuleGroups.json | 109 ++++ .../examples/patchPrometheusRuleGroup.json | 72 +++ 7 files changed, 980 insertions(+) create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json create mode 100644 specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json new file mode 100644 index 000000000000..1caf4906694b --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -0,0 +1,497 @@ +{ + "swagger": "2.0", + "info": { + "version": "2021-07-22-preview", + "title": "Azure Alerts Management Service Resource Provider", + "description": "Azure Alerts Management Service provides a single pane of glass of alerts across Azure Monitor." + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/prometheusRuleGroups": { + "get": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Retrieve Prometheus rule group definitions in a subscription.", + "operationId": "PrometheusRuleGroups_ListBySubscription", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Successful request for a list of Prometheus rule groups", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResourceCollection" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "ListSubscriptionResourcePrometheusRuleGroups": { + "$ref": "./examples/listSubscriptionPrometheusRuleGroups.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/prometheusRuleGroups": { + "get": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Retrieve Prometheus rule group definitions in a resource group.", + "operationId": "PrometheusRuleGroups_ListByResourceGroup", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Successful request for a list of Prometheus rule groups", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResourceCollection" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": null + }, + "x-ms-examples": { + "ListResourcePrometheusRuleGroups": { + "$ref": "./examples/listPrometheusRuleGroups.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/prometheusRuleGroups/{ruleGroupName}": { + "get": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Retrieve a Prometheus rule group definition.", + "operationId": "PrometheusRuleGroups_Get", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/RuleGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Successful request for a list of Prometheus rule groups", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "GetPrometheusRuleGroup": { + "$ref": "./examples/getPrometheusRuleGroup.json" + } + } + }, + "put": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Create or update a Prometheus rule group definition.", + "operationId": "PrometheusRuleGroups_CreateOrUpdate", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/RuleGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "parameters", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + }, + "description": "The parameters of the rule group to create or update." + } + ], + "responses": { + "200": { + "description": "OK (Updated).", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + } + }, + "201": { + "description": "Created (New Alert rule was created).", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "CreatePrometheusRuleGroup": { + "$ref": "./examples/createOrUpdatePrometheusRuleGroup.json" + } + } + }, + "patch": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Update an Prometheus rule group definition.", + "operationId": "PrometheusRuleGroups_Update", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/RuleGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "parameters", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResourcePatch" + }, + "description": "The parameters of the rule group to update." + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "PatchPrometheusRuleGroup": { + "$ref": "./examples/patchPrometheusRuleGroup.json" + } + } + }, + "delete": { + "tags": [ + "PrometheusRuleGroups" + ], + "description": "Delete a Prometheus rule group definition.", + "operationId": "PrometheusRuleGroups_Delete", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "$ref": "#/parameters/RuleGroupNameParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Successful request to delete a Prometheus rule group" + }, + "204": { + "description": "No content: the request was successful, but the response is empty" + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "DeletePrometheusRuleGroup": { + "$ref": "./examples/deletePrometheusRuleGroup.json" + } + } + } + } + }, + "definitions": { + "PrometheusRuleGroupAction": { + "type": "object", + "description": "An alert action. Only relevant for alerts.", + "properties": { + "actionGroupId": { + "type": "string", + "description": "The resource id of the action group to use." + }, + "actionProperties": { + "type": "object", + "additionalProperties": { + "type": "string", + "description": "The dictionary of custom properties for the action." + }, + "description": "The properties of an action group object." + } + } + }, + "PrometheusRuleGroupProperties": { + "type": "object", + "required": [ + "scopes", + "rules" + ], + "properties": { + "description": { + "type": "string", + "description": "the description of the Prometheus rule group that will be included in the alert email." + }, + "enabled": { + "type": "boolean", + "description": "the flag that indicates whether the Prometheus rule group is enabled." + }, + "clusterName": { + "type": "string", + "description": "the cluster name of the rule group evaluation." + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "x-ms-identifiers": [], + "description": "the list of resource id's that this rule group is scoped to." + }, + "interval": { + "type": "string", + "description": "the interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and 15 minutes" + }, + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRule" + }, + "x-ms-identifiers": [], + "description": "defines the rules in the Prometheus rule group." + } + }, + "description": "An alert rule." + }, + "PrometheusRuleGroupResource": { + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/TrackedResource" + } + ], + "required": [ + "properties" + ], + "properties": { + "properties": { + "x-ms-client-flatten": true, + "$ref": "#/definitions/PrometheusRuleGroupProperties", + "description": "The Prometheus rule group properties of the resource." + } + }, + "description": "The Prometheus rule group resource." + }, + "PrometheusRuleGroupResourcePatch": { + "type": "object", + "properties": { + "tags": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Resource tags" + }, + "properties": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "the flag that indicates whether the Prometheus rule group is enabled." + } + } + } + }, + "description": "The Prometheus rule group resource for patch operations." + }, + "PrometheusRuleGroupResourceCollection": { + "type": "object", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRuleGroupResource" + }, + "description": "the values for the alert rule resources." + } + }, + "description": "Represents a collection of alert rule resources." + }, + "PrometheusRule": { + "type": "object", + "required": [ + "expression" + ], + "properties": { + "record": { + "type": "string", + "description": "the name of the recording rule." + }, + "alert": { + "type": "string", + "description": "the name of the alert rule." + }, + "enabled": { + "type": "boolean", + "description": "the flag that indicates whether the Prometheus rule is enabled." + }, + "expression": { + "type": "string", + "description": "the expression to run for the rule." + }, + "severity": { + "type": "integer", + "format": "int32", + "description": "the severity of the alerts fired by the rule. Only relevant for alerts." + }, + "for": { + "type": "string", + "description": "the amount of time alert must be active before firing. Only relevant for alerts." + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "labels for rule group. Only relevant for alerts." + }, + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "annotations for rule group. Only relevant for alerts." + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRuleGroupAction" + }, + "x-ms-identifiers": [], + "description": "The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only relevant for alerts." + }, + "resolveConfiguration": { + "$ref": "#/definitions/PrometheusRuleResolveConfiguration", + "description": "defines the configuration for resolving fired alerts. Only relevant for alerts." + } + } + }, + "PrometheusRuleResolveConfiguration": { + "type": "object", + "properties": { + "autoResolved": { + "type": "boolean", + "description": "the flag that indicates whether or not to auto resolve a fired alert." + }, + "timeToResolve": { + "type": "string", + "description": "the duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration format. Should be between 1 and 15 minutes" + } + }, + "description": "Specifies the Prometheus alert rule configuration." + } + }, + "parameters": { + "RuleGroupNameParameter": { + "name": "ruleGroupName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the rule group.", + "x-ms-parameter-location": "method" + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json new file mode 100644 index 000000000000..c01c1c08fcfa --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json @@ -0,0 +1,167 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladstest", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2021-07-22-preview", + "parameters": { + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + } + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + ], + "interval": "PT5M", + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + } + }, + "201": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + ], + "interval": "PT5M", + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json new file mode 100644 index 000000000000..5c08be786219 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json @@ -0,0 +1,12 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladsteset", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2021-07-22-preview" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json new file mode 100644 index 000000000000..08a28bf9a863 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json @@ -0,0 +1,60 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladstest", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2021-07-22-preview" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "global", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "5m", + "labels": { + "team": "prod" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "10m" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json new file mode 100644 index 000000000000..11a7b3037abf --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json @@ -0,0 +1,63 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladstest", + "api-version": "2021-07-22-preview" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "value": [ + { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "5m", + "labels": { + "team": "prod" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "10m" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + } + ] + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json new file mode 100644 index 000000000000..ac58f7c16626 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json @@ -0,0 +1,109 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "api-version": "2021-07-22-preview" + }, + "responses": { + "200": { + "headers": {}, + "body": { + "value": [ + { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/monitoringAcount/myMonitoringAccount" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "5m", + "labels": { + "team": "prod" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "10m" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + }, + { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/rg-2/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup2", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/rg-2/providers/microsoft.monitor/accounts/monitoringAcount/myMonitoringAccount" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "5m", + "labels": { + "team": "prod" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "10m" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:13Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:13Z" + } + } + ] + } + } + } +} diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json new file mode 100644 index 000000000000..01aa83cb3439 --- /dev/null +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json @@ -0,0 +1,72 @@ +{ + "parameters": { + "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "giladstest", + "ruleGroupName": "myPrometheusRuleGroup", + "api-version": "2021-07-22-preview", + "parameters": { + "tags": { + "tag1": "value1" + }, + "properties": { + "enabled": false + } + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "tags": { + "tag1": "value1" + }, + "properties": { + "description": "This is the description of the first rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/monitoringAcount/myMonitoringAccount" + ], + "enabled": false, + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "5m", + "labels": { + "team": "prod" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "10m" + }, + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + } + ] + } + ] + }, + "systemData": { + "createdBy": "abc@microsoft.com", + "createdByType": "User", + "createdAt": "2018-06-12T22:05:09Z", + "lastModifiedBy": "xyz@microsoft.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2018-06-12T22:05:09Z" + } + } + } + } +} From 29c4c7fa4cbb20b3b4691183cb0181172e5fb074 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Mon, 23 Jan 2023 16:22:40 +0200 Subject: [PATCH 02/16] Updates readme --- .../alertsmanagement/resource-manager/readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/specification/alertsmanagement/resource-manager/readme.md b/specification/alertsmanagement/resource-manager/readme.md index 81ebea9dc031..2910d5c49431 100644 --- a/specification/alertsmanagement/resource-manager/readme.md +++ b/specification/alertsmanagement/resource-manager/readme.md @@ -45,6 +45,15 @@ tag: package-2021-08 ``` + +### Tag: package-2023-03 + +These settings apply only when `--tag=package-2023-03` is specified on the command line. + +```yaml $(tag) == 'package-2023-03' +input-file: + - Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +``` ### Tag: package-2021-08 These settings apply only when `--tag=package-2021-08` is specified on the command line. From 04e9cc93a9493b7c43adc34b0d3a6ef528c3e669 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Mon, 23 Jan 2023 16:22:43 +0200 Subject: [PATCH 03/16] Updates API version in new specs and examples --- .../stable/2023-03-01/PrometheusRuleGroups.json | 2 +- .../2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json | 2 +- .../stable/2023-03-01/examples/deletePrometheusRuleGroup.json | 2 +- .../stable/2023-03-01/examples/getPrometheusRuleGroup.json | 2 +- .../stable/2023-03-01/examples/listPrometheusRuleGroups.json | 2 +- .../examples/listSubscriptionPrometheusRuleGroups.json | 2 +- .../stable/2023-03-01/examples/patchPrometheusRuleGroup.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index 1caf4906694b..9b08186a3f48 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "2021-07-22-preview", + "version": "2023-03-01", "title": "Azure Alerts Management Service Resource Provider", "description": "Azure Alerts Management Service provides a single pane of glass of alerts across Azure Monitor." }, diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json index c01c1c08fcfa..5c99e7288c65 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json @@ -3,7 +3,7 @@ "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", "resourceGroupName": "giladstest", "ruleGroupName": "myPrometheusRuleGroup", - "api-version": "2021-07-22-preview", + "api-version": "2023-03-01", "parameters": { "location": "East US", "properties": { diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json index 5c08be786219..89a4a6cdf88e 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json @@ -3,7 +3,7 @@ "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", "resourceGroupName": "giladsteset", "ruleGroupName": "myPrometheusRuleGroup", - "api-version": "2021-07-22-preview" + "api-version": "2023-03-01" }, "responses": { "200": {}, diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json index 08a28bf9a863..41246f3ccd28 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json @@ -3,7 +3,7 @@ "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", "resourceGroupName": "giladstest", "ruleGroupName": "myPrometheusRuleGroup", - "api-version": "2021-07-22-preview" + "api-version": "2023-03-01" }, "responses": { "200": { diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json index 11a7b3037abf..5c58bccaf21b 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json @@ -2,7 +2,7 @@ "parameters": { "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", "resourceGroupName": "giladstest", - "api-version": "2021-07-22-preview" + "api-version": "2023-03-01" }, "responses": { "200": { diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json index ac58f7c16626..acbaccc5f4f1 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json @@ -1,7 +1,7 @@ { "parameters": { "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - "api-version": "2021-07-22-preview" + "api-version": "2023-03-01" }, "responses": { "200": { diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json index 01aa83cb3439..a9a55362f258 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json @@ -3,7 +3,7 @@ "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", "resourceGroupName": "giladstest", "ruleGroupName": "myPrometheusRuleGroup", - "api-version": "2021-07-22-preview", + "api-version": "2023-03-01", "parameters": { "tags": { "tag1": "value1" From 1784a9463817923401f7df4b4c5071380d8ba744 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Mon, 23 Jan 2023 16:30:57 +0200 Subject: [PATCH 04/16] adding PrometheusRuleGroups stable api-version --- .../2023-03-01/PrometheusRuleGroups.json | 191 +++++++++--------- .../createOrUpdatePrometheusRuleGroup.json | 99 +++++---- .../examples/deletePrometheusRuleGroup.json | 2 +- .../examples/getPrometheusRuleGroup.json | 51 ++--- .../examples/listPrometheusRuleGroups.json | 99 ++++++--- .../listSubscriptionPrometheusRuleGroups.json | 95 +++++---- .../examples/patchPrometheusRuleGroup.json | 57 +++--- .../resource-manager/readme.md | 5 +- 8 files changed, 337 insertions(+), 262 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index 9b08186a3f48..7f57e6b84475 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -32,7 +32,7 @@ "tags": [ "PrometheusRuleGroups" ], - "description": "Retrieve Prometheus rule group definitions in a subscription.", + "description": "Retrieve Prometheus all rule group definitions in a subscription.", "operationId": "PrometheusRuleGroups_ListBySubscription", "parameters": [ { @@ -228,7 +228,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/PrometheusRuleGroupResourcePatch" + "$ref": "#/definitions/PrometheusRuleGroupResourcePatchParameters" }, "description": "The parameters of the rule group to update." } @@ -296,66 +296,6 @@ } }, "definitions": { - "PrometheusRuleGroupAction": { - "type": "object", - "description": "An alert action. Only relevant for alerts.", - "properties": { - "actionGroupId": { - "type": "string", - "description": "The resource id of the action group to use." - }, - "actionProperties": { - "type": "object", - "additionalProperties": { - "type": "string", - "description": "The dictionary of custom properties for the action." - }, - "description": "The properties of an action group object." - } - } - }, - "PrometheusRuleGroupProperties": { - "type": "object", - "required": [ - "scopes", - "rules" - ], - "properties": { - "description": { - "type": "string", - "description": "the description of the Prometheus rule group that will be included in the alert email." - }, - "enabled": { - "type": "boolean", - "description": "the flag that indicates whether the Prometheus rule group is enabled." - }, - "clusterName": { - "type": "string", - "description": "the cluster name of the rule group evaluation." - }, - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "x-ms-identifiers": [], - "description": "the list of resource id's that this rule group is scoped to." - }, - "interval": { - "type": "string", - "description": "the interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and 15 minutes" - }, - "rules": { - "type": "array", - "items": { - "$ref": "#/definitions/PrometheusRule" - }, - "x-ms-identifiers": [], - "description": "defines the rules in the Prometheus rule group." - } - }, - "description": "An alert rule." - }, "PrometheusRuleGroupResource": { "type": "object", "allOf": [ @@ -375,7 +315,7 @@ }, "description": "The Prometheus rule group resource." }, - "PrometheusRuleGroupResourcePatch": { + "PrometheusRuleGroupResourcePatchParameters": { "type": "object", "properties": { "tags": { @@ -410,6 +350,48 @@ }, "description": "Represents a collection of alert rule resources." }, + "PrometheusRuleGroupProperties": { + "description": "An Azure Prometheus rule group.", + "type": "object", + "required": [ + "scopes", + "rules" + ], + "properties": { + "description": { + "type": "string", + "description": "The description of the Prometheus rule group that will be included in the alert email." + }, + "enabled": { + "type": "boolean", + "description": "The flag that indicates whether the Prometheus rule group is enabled." + }, + "clusterName": { + "type": "string", + "description": "The cluster name of the rule group evaluation." + }, + "scopes": { + "$ref": "#/definitions/StringArray", + "description": "The list of azure resource id's that this rule group is scoped to.", + "minItems": 1, + "maxItems": 1 + }, + "interval": { + "type": "string", + "description": "the interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and 15 minutes", + "format": "duration" + }, + "rules": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRule" + }, + "description": "defines the rules in the Prometheus rule group.", + "minItems": 1, + "maxItems": 20 + } + } + }, "PrometheusRule": { "type": "object", "required": [ @@ -417,50 +399,44 @@ ], "properties": { "record": { - "type": "string", - "description": "the name of the recording rule." + "description": "The name of the time series to output to. Must be a valid metric name.", + "type": "string" }, "alert": { - "type": "string", - "description": "the name of the alert rule." + "description": "The name of the alert. Must be a valid metric name.", + "type": "string" }, "enabled": { "type": "boolean", "description": "the flag that indicates whether the Prometheus rule is enabled." }, "expression": { - "type": "string", - "description": "the expression to run for the rule." + "description": "The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and the result recorded as a new set of time series with the metric name as given by 'record'.", + "type": "string" + }, + "labels": { + "$ref": "#/definitions/StringDictionary", + "description": "Labels to add or overwrite before storing the result.", + "maxProperties": 10 }, "severity": { "type": "integer", "format": "int32", - "description": "the severity of the alerts fired by the rule. Only relevant for alerts." + "description": "The severity of the alerts fired by the rule.", + "minimum": 1, + "maximum": 4 }, "for": { "type": "string", - "description": "the amount of time alert must be active before firing. Only relevant for alerts." - }, - "labels": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "labels for rule group. Only relevant for alerts." + "description": "The amount of time alert must be active before firing.", + "format": "duration" }, "annotations": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "annotations for rule group. Only relevant for alerts." + "$ref": "#/definitions/StringDictionary", + "description": "Annotations for rule group." }, "actions": { - "type": "array", - "items": { - "$ref": "#/definitions/PrometheusRuleGroupAction" - }, - "x-ms-identifiers": [], + "$ref": "#/definitions/PrometheusRuleGroupActions", "description": "The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only relevant for alerts." }, "resolveConfiguration": { @@ -469,19 +445,52 @@ } } }, + "PrometheusRuleGroupActions": { + "type": "object", + "description": "An alert action. Only relevant for alerts.", + "properties": { + "actionGroups": { + "$ref": "#/definitions/StringArray", + "description": "The resource ids of the action group to use." + }, + "actionProperties": { + "$ref": "#/definitions/StringDictionary", + "description": "The properties of an action group object." + }, + "customProperties": { + "$ref": "#/definitions/StringDictionary", + "description": "The custom properties of an action group object." + } + } + }, "PrometheusRuleResolveConfiguration": { "type": "object", + "description": "Specifies the Prometheus alert rule configuration.", "properties": { "autoResolved": { "type": "boolean", - "description": "the flag that indicates whether or not to auto resolve a fired alert." + "description": "The flag that indicates whether or not to auto resolve a fired alert." }, "timeToResolve": { "type": "string", - "description": "the duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration format. Should be between 1 and 15 minutes" + "description": "the duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration format. Should be between 1 and 15 minutes", + "format": "duration" } + } + }, + "StringDictionary": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "A dictionary from string to string." + }, + "StringArray": { + "type": "array", + "items": { + "type": "string" }, - "description": "Specifies the Prometheus alert rule configuration." + "description": "An array of strings." } }, "parameters": { diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json index 5c99e7288c65..45386f05a5f8 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json @@ -1,15 +1,15 @@ { "parameters": { "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - "resourceGroupName": "giladstest", + "resourceGroupName": "promResourceGroup", "ruleGroupName": "myPrometheusRuleGroup", "api-version": "2023-03-01", "parameters": { "location": "East US", "properties": { - "description": "This is the description of the first rule group", + "description": "This is the description of the following rule group", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" ], "rules": [ { @@ -34,15 +34,20 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", - "actionProperties": { - "key11": "value11", - "key12": "value12" - } + "actions": { + "actionGroups": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" + ], + "actionProperties": { + "ActionType1.Field1": "value11", + "ActionType2.Field1": "value12" + }, + "customProperties": { + "key11": "value11", + "key12": "value12" } - ] + } } ] } @@ -52,15 +57,14 @@ "200": { "headers": {}, "body": { - "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", "type": "Microsoft.AlertsManagement/prometheusRuleGroups", "location": "East US", "properties": { - "description": "This is the description of the first rule group", + "description": "This is the description of the following rule group", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" ], - "interval": "PT5M", "rules": [ { "record": "job_type:billing_jobs_duration_seconds:99p5m", @@ -84,40 +88,36 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", - "actionProperties": { - "key11": "value11", - "key12": "value12" - } + "actions": { + "actionGroups": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" + ], + "actionProperties": { + "ActionType1.Field1": "value11", + "ActionType2.Field1": "value12" + }, + "customProperties": { + "key11": "value11", + "key12": "value12" } - ] + } } ] - }, - "systemData": { - "createdBy": "abc@microsoft.com", - "createdByType": "User", - "createdAt": "2018-06-12T22:05:09Z", - "lastModifiedBy": "xyz@microsoft.com", - "lastModifiedByType": "User", - "lastModifiedAt": "2018-06-12T22:05:09Z" } } }, "201": { "headers": {}, "body": { - "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", "type": "Microsoft.AlertsManagement/prometheusRuleGroups", "location": "East US", "properties": { - "description": "This is the description of the first rule group", + "description": "This is the description of the following rule group", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" ], - "interval": "PT5M", "rules": [ { "record": "job_type:billing_jobs_duration_seconds:99p5m", @@ -141,25 +141,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", - "actionProperties": { - "key11": "value11", - "key12": "value12" - } + "actions": { + "actionGroups": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" + ], + "actionProperties": { + "ActionType1.Field1": "value11", + "ActionType2.Field1": "value12" + }, + "customProperties": { + "key11": "value11", + "key12": "value12" } - ] + } } ] - }, - "systemData": { - "createdBy": "abc@microsoft.com", - "createdByType": "User", - "createdAt": "2018-06-12T22:05:09Z", - "lastModifiedBy": "xyz@microsoft.com", - "lastModifiedByType": "User", - "lastModifiedAt": "2018-06-12T22:05:09Z" } } } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json index 89a4a6cdf88e..53fd889f677f 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/deletePrometheusRuleGroup.json @@ -1,7 +1,7 @@ { "parameters": { "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - "resourceGroupName": "giladsteset", + "resourceGroupName": "promResourceGroup", "ruleGroupName": "myPrometheusRuleGroup", "api-version": "2023-03-01" }, diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json index 41246f3ccd28..727358c43572 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json @@ -1,7 +1,7 @@ { "parameters": { "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - "resourceGroupName": "giladstest", + "resourceGroupName": "promResourceGroup", "ruleGroupName": "myPrometheusRuleGroup", "api-version": "2023-03-01" }, @@ -9,50 +9,53 @@ "200": { "headers": {}, "body": { - "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", "type": "Microsoft.AlertsManagement/prometheusRuleGroups", - "location": "global", + "location": "East US", "properties": { - "description": "This is the description of the first rule group", + "description": "This is the description of the following rule group", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" ], "rules": [ { "record": "job_type:billing_jobs_duration_seconds:99p5m", - "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } }, { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", "severity": 2, - "for": "5m", + "for": "PT5M", "labels": { "team": "prod" }, + "annotations": { + "annotationName1": "annotationValue1" + }, "resolveConfiguration": { "autoResolved": true, - "timeToResolve": "10m" + "timeToResolve": "PT10M" }, - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", - "actionProperties": { - "key11": "value11", - "key12": "value12" - } + "actions": { + "actionGroups": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" + ], + "actionProperties": { + "ActionType1.Field1": "value11", + "ActionType2.Field1": "value12" + }, + "customProperties": { + "key11": "value11", + "key12": "value12" } - ] + } } ] - }, - "systemData": { - "createdBy": "abc@microsoft.com", - "createdByType": "User", - "createdAt": "2018-06-12T22:05:09Z", - "lastModifiedBy": "xyz@microsoft.com", - "lastModifiedByType": "User", - "lastModifiedAt": "2018-06-12T22:05:09Z" } } } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json index 5c58bccaf21b..f82fa9ba65ac 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json @@ -1,7 +1,7 @@ { "parameters": { "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - "resourceGroupName": "giladstest", + "resourceGroupName": "promResourceGroup", "api-version": "2023-03-01" }, "responses": { @@ -10,50 +10,103 @@ "body": { "value": [ { - "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/ruleGroupName1", "type": "Microsoft.AlertsManagement/prometheusRuleGroups", "location": "East US", "properties": { - "description": "This is the description of the first rule group", + "description": "This is the description of the following rule group", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" ], "rules": [ { "record": "job_type:billing_jobs_duration_seconds:99p5m", - "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } + }, + { + "alert": "Billing_Processing_Very_Slow", + "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "severity": 2, + "for": "PT5M", + "labels": { + "team": "prod" + }, + "annotations": { + "annotationName1": "annotationValue1" + }, + "resolveConfiguration": { + "autoResolved": true, + "timeToResolve": "PT10M" + }, + "actions": { + "actionGroups": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" + ], + "actionProperties": { + "ActionType1.Field1": "value11", + "ActionType2.Field1": "value12" + }, + "customProperties": { + "key11": "value11", + "key12": "value12" + } + } + } + ] + } + }, + { + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/ruleGroupName2", + "type": "Microsoft.AlertsManagement/prometheusRuleGroups", + "location": "East US", + "properties": { + "description": "This is the description of the following rule group", + "scopes": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + ], + "rules": [ + { + "record": "job_type:billing_jobs_duration_seconds:99p5m", + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } }, { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", "severity": 2, - "for": "5m", + "for": "PT5M", "labels": { "team": "prod" }, + "annotations": { + "annotationName1": "annotationValue1" + }, "resolveConfiguration": { "autoResolved": true, - "timeToResolve": "10m" + "timeToResolve": "PT10M" }, - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2", - "actionProperties": { - "key11": "value11", - "key12": "value12" - } + "actions": { + "actionGroups": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" + ], + "actionProperties": { + "ActionType1.Field1": "value11", + "ActionType2.Field1": "value12" + }, + "customProperties": { + "key11": "value11", + "key12": "value12" } - ] + } } ] - }, - "systemData": { - "createdBy": "abc@microsoft.com", - "createdByType": "User", - "createdAt": "2018-06-12T22:05:09Z", - "lastModifiedBy": "xyz@microsoft.com", - "lastModifiedByType": "User", - "lastModifiedAt": "2018-06-12T22:05:09Z" } } ] diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json index acbaccc5f4f1..4974cfb46283 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json @@ -1,6 +1,7 @@ { "parameters": { "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", + "resourceGroupName": "promResourceGroup", "api-version": "2023-03-01" }, "responses": { @@ -9,97 +10,103 @@ "body": { "value": [ { - "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/resourceGroupName1/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", "type": "Microsoft.AlertsManagement/prometheusRuleGroups", "location": "East US", "properties": { - "description": "This is the description of the first rule group", + "description": "This is the description of the following rule group", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/monitoringAcount/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" ], "rules": [ { "record": "job_type:billing_jobs_duration_seconds:99p5m", - "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } }, { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", "severity": 2, - "for": "5m", + "for": "PT5M", "labels": { "team": "prod" }, + "annotations": { + "annotationName1": "annotationValue1" + }, "resolveConfiguration": { "autoResolved": true, - "timeToResolve": "10m" + "timeToResolve": "PT10M" }, - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2", - "actionProperties": { - "key11": "value11", - "key12": "value12" - } + "actions": { + "actionGroups": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" + ], + "actionProperties": { + "ActionType1.Field1": "value11", + "ActionType2.Field1": "value12" + }, + "customProperties": { + "key11": "value11", + "key12": "value12" } - ] + } } ] - }, - "systemData": { - "createdBy": "abc@microsoft.com", - "createdByType": "User", - "createdAt": "2018-06-12T22:05:09Z", - "lastModifiedBy": "xyz@microsoft.com", - "lastModifiedByType": "User", - "lastModifiedAt": "2018-06-12T22:05:09Z" } }, { - "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/rg-2/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup2", + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/resourceGroupName2/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", "type": "Microsoft.AlertsManagement/prometheusRuleGroups", "location": "East US", "properties": { - "description": "This is the description of the first rule group", + "description": "This is the description of the following rule group", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/rg-2/providers/microsoft.monitor/accounts/monitoringAcount/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" ], "rules": [ { "record": "job_type:billing_jobs_duration_seconds:99p5m", - "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } }, { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", "severity": 2, - "for": "5m", + "for": "PT5M", "labels": { "team": "prod" }, + "annotations": { + "annotationName1": "annotationValue1" + }, "resolveConfiguration": { "autoResolved": true, - "timeToResolve": "10m" + "timeToResolve": "PT10M" }, - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2", - "actionProperties": { - "key11": "value11", - "key12": "value12" - } + "actions": { + "actionGroups": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" + ], + "actionProperties": { + "ActionType1.Field1": "value11", + "ActionType2.Field1": "value12" + }, + "customProperties": { + "key11": "value11", + "key12": "value12" } - ] + } } ] - }, - "systemData": { - "createdBy": "abc@microsoft.com", - "createdByType": "User", - "createdAt": "2018-06-12T22:05:13Z", - "lastModifiedBy": "xyz@microsoft.com", - "lastModifiedByType": "User", - "lastModifiedAt": "2018-06-12T22:05:13Z" } } ] diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json index a9a55362f258..92071db9f803 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json @@ -1,7 +1,7 @@ { "parameters": { "subscriptionId": "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - "resourceGroupName": "giladstest", + "resourceGroupName": "promResourceGroup", "ruleGroupName": "myPrometheusRuleGroup", "api-version": "2023-03-01", "parameters": { @@ -17,54 +17,57 @@ "200": { "headers": {}, "body": { - "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", + "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/promResourceGroup/providers/providers/Microsoft.AlertsManagement/prometheusRuleGroups/myPrometheusRuleGroup", "type": "Microsoft.AlertsManagement/prometheusRuleGroups", "location": "East US", - "tags": { - "tag1": "value1" - }, "properties": { - "description": "This is the description of the first rule group", + "description": "This is the description of the following rule group", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/giladstest/providers/microsoft.monitor/accounts/monitoringAcount/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" ], - "enabled": false, "rules": [ { "record": "job_type:billing_jobs_duration_seconds:99p5m", - "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))" + "expression": "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))", + "labels": { + "team": "prod" + } }, { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", "severity": 2, - "for": "5m", + "for": "PT5M", "labels": { "team": "prod" }, + "annotations": { + "annotationName1": "annotationValue1" + }, "resolveConfiguration": { "autoResolved": true, - "timeToResolve": "10m" + "timeToResolve": "PT10M" }, - "actions": [ - { - "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/giladstest/providers/microsoft.insights/notificationgroups/group2", - "actionProperties": { - "key11": "value11", - "key12": "value12" - } + "actions": { + "actionGroups": [ + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" + ], + "actionProperties": { + "ActionType1.Field1": "value11", + "ActionType2.Field1": "value12" + }, + "customProperties": { + "key11": "value11", + "key12": "value12" } - ] + } } - ] + ], + "enabled": false }, - "systemData": { - "createdBy": "abc@microsoft.com", - "createdByType": "User", - "createdAt": "2018-06-12T22:05:09Z", - "lastModifiedBy": "xyz@microsoft.com", - "lastModifiedByType": "User", - "lastModifiedAt": "2018-06-12T22:05:09Z" + "tags": { + "tag1": "value1" } } } diff --git a/specification/alertsmanagement/resource-manager/readme.md b/specification/alertsmanagement/resource-manager/readme.md index 2910d5c49431..d3a9d6bb8c69 100644 --- a/specification/alertsmanagement/resource-manager/readme.md +++ b/specification/alertsmanagement/resource-manager/readme.md @@ -41,7 +41,7 @@ directive: title: AlertsManagementClient description: AlertsManagement Client openapi-type: arm -tag: package-2021-08 +tag: package-2023-03 ``` @@ -53,6 +53,9 @@ These settings apply only when `--tag=package-2023-03` is specified on the comma ```yaml $(tag) == 'package-2023-03' input-file: - Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json + - Microsoft.AlertsManagement/stable/2021-08-08/AlertProcessingRules.json + - Microsoft.AlertsManagement/preview/2019-05-05-preview/AlertsManagement.json + - Microsoft.AlertsManagement/preview/2019-05-05-preview/SmartGroups.json ``` ### Tag: package-2021-08 From e48c842152a4f969f4878456a4dc7a1817ca8575 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Mon, 23 Jan 2023 16:41:00 +0200 Subject: [PATCH 05/16] rename example titles --- .../stable/2023-03-01/PrometheusRuleGroups.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index 7f57e6b84475..e121e1090922 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -60,7 +60,7 @@ "nextLinkName": null }, "x-ms-examples": { - "ListSubscriptionResourcePrometheusRuleGroups": { + "List Subscription Resource PrometheusRuleGroups": { "$ref": "./examples/listSubscriptionPrometheusRuleGroups.json" } } @@ -102,7 +102,7 @@ "nextLinkName": null }, "x-ms-examples": { - "ListResourcePrometheusRuleGroups": { + "List Resource group PrometheusRuleGroups": { "$ref": "./examples/listPrometheusRuleGroups.json" } } @@ -144,7 +144,7 @@ } }, "x-ms-examples": { - "GetPrometheusRuleGroup": { + "Get a PrometheusRuleGroup": { "$ref": "./examples/getPrometheusRuleGroup.json" } } @@ -199,7 +199,7 @@ } }, "x-ms-examples": { - "CreatePrometheusRuleGroup": { + "Create or Update a PrometheusRuleGroup": { "$ref": "./examples/createOrUpdatePrometheusRuleGroup.json" } } @@ -248,7 +248,7 @@ } }, "x-ms-examples": { - "PatchPrometheusRuleGroup": { + "Patch a PrometheusRuleGroup": { "$ref": "./examples/patchPrometheusRuleGroup.json" } } @@ -288,7 +288,7 @@ } }, "x-ms-examples": { - "DeletePrometheusRuleGroup": { + "Delete a PrometheusRuleGroup": { "$ref": "./examples/deletePrometheusRuleGroup.json" } } From 5a6434b335aad009d1317f10d65b97d15e64d46a Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Wed, 25 Jan 2023 17:34:23 +0200 Subject: [PATCH 06/16] improve descriptions --- .../2023-03-01/PrometheusRuleGroups.json | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index e121e1090922..6f58f0fdd589 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -360,25 +360,25 @@ "properties": { "description": { "type": "string", - "description": "The description of the Prometheus rule group that will be included in the alert email." + "description": "Rule group description." }, "enabled": { "type": "boolean", - "description": "The flag that indicates whether the Prometheus rule group is enabled." + "description": "Enable/disable rule group." }, "clusterName": { "type": "string", - "description": "The cluster name of the rule group evaluation." + "description": "Apply rule to data from a specific cluster." }, "scopes": { "$ref": "#/definitions/StringArray", - "description": "The list of azure resource id's that this rule group is scoped to.", + "description": "Target Azure Monitor workspaces resource ids. Only one scope currently supported.", "minItems": 1, "maxItems": 1 }, "interval": { "type": "string", - "description": "the interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and 15 minutes", + "description": "The interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and 15 minutes", "format": "duration" }, "rules": { @@ -386,7 +386,7 @@ "items": { "$ref": "#/definitions/PrometheusRule" }, - "description": "defines the rules in the Prometheus rule group.", + "description": "Defines the rules in the Prometheus rule group.", "minItems": 1, "maxItems": 20 } @@ -399,16 +399,16 @@ ], "properties": { "record": { - "description": "The name of the time series to output to. Must be a valid metric name.", + "description": "Recorded metrics name.", "type": "string" }, "alert": { - "description": "The name of the alert. Must be a valid metric name.", + "description": "Alert rule name.", "type": "string" }, "enabled": { "type": "boolean", - "description": "the flag that indicates whether the Prometheus rule is enabled." + "description": "Enable/disable rule." }, "expression": { "description": "The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and the result recorded as a new set of time series with the metric name as given by 'record'.", @@ -433,15 +433,15 @@ }, "annotations": { "$ref": "#/definitions/StringDictionary", - "description": "Annotations for rule group." + "description": "Alert annotation key-value pairs." }, "actions": { "$ref": "#/definitions/PrometheusRuleGroupActions", - "description": "The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only relevant for alerts." + "description": "Actions that are performed when the alert rule becomes active, and when an alert condition is resolved." }, "resolveConfiguration": { "$ref": "#/definitions/PrometheusRuleResolveConfiguration", - "description": "defines the configuration for resolving fired alerts. Only relevant for alerts." + "description": "Defines the configuration for resolving fired alerts. Only relevant for alerts." } } }, @@ -451,15 +451,11 @@ "properties": { "actionGroups": { "$ref": "#/definitions/StringArray", - "description": "The resource ids of the action group to use." + "description": "One or more action group resource IDs. Each is activated when an alert is fired." }, "actionProperties": { "$ref": "#/definitions/StringDictionary", "description": "The properties of an action group object." - }, - "customProperties": { - "$ref": "#/definitions/StringDictionary", - "description": "The custom properties of an action group object." } } }, @@ -469,11 +465,11 @@ "properties": { "autoResolved": { "type": "boolean", - "description": "The flag that indicates whether or not to auto resolve a fired alert." + "description": "Enable alert auto-resolution." }, "timeToResolve": { "type": "string", - "description": "the duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration format. Should be between 1 and 15 minutes", + "description": "Alert auto-resolution timeout.", "format": "duration" } } From 3c51e73c9d42c00165f32449df46447139791e96 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Wed, 25 Jan 2023 17:35:17 +0200 Subject: [PATCH 07/16] improve examples --- .../createOrUpdatePrometheusRuleGroup.json | 30 +++++++++---------- .../examples/getPrometheusRuleGroup.json | 10 +++---- .../examples/listPrometheusRuleGroups.json | 20 ++++++------- .../listSubscriptionPrometheusRuleGroups.json | 20 ++++++------- .../examples/patchPrometheusRuleGroup.json | 17 +++++------ 5 files changed, 48 insertions(+), 49 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json index 45386f05a5f8..92b2a5826550 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json @@ -8,8 +8,11 @@ "location": "East US", "properties": { "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" ], "rules": [ { @@ -22,6 +25,7 @@ { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, "severity": 2, "for": "PT5M", "labels": { @@ -42,10 +46,6 @@ "actionProperties": { "ActionType1.Field1": "value11", "ActionType2.Field1": "value12" - }, - "customProperties": { - "key11": "value11", - "key12": "value12" } } } @@ -62,8 +62,11 @@ "location": "East US", "properties": { "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" ], "rules": [ { @@ -76,6 +79,7 @@ { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, "severity": 2, "for": "PT5M", "labels": { @@ -96,10 +100,6 @@ "actionProperties": { "ActionType1.Field1": "value11", "ActionType2.Field1": "value12" - }, - "customProperties": { - "key11": "value11", - "key12": "value12" } } } @@ -115,8 +115,11 @@ "location": "East US", "properties": { "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" ], "rules": [ { @@ -129,6 +132,7 @@ { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, "severity": 2, "for": "PT5M", "labels": { @@ -149,10 +153,6 @@ "actionProperties": { "ActionType1.Field1": "value11", "ActionType2.Field1": "value12" - }, - "customProperties": { - "key11": "value11", - "key12": "value12" } } } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json index 727358c43572..58d97a8ee4e5 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json @@ -14,8 +14,11 @@ "location": "East US", "properties": { "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" ], "rules": [ { @@ -28,6 +31,7 @@ { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, "severity": 2, "for": "PT5M", "labels": { @@ -48,10 +52,6 @@ "actionProperties": { "ActionType1.Field1": "value11", "ActionType2.Field1": "value12" - }, - "customProperties": { - "key11": "value11", - "key12": "value12" } } } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json index f82fa9ba65ac..85e4a5f828cb 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json @@ -15,8 +15,11 @@ "location": "East US", "properties": { "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" ], "rules": [ { @@ -29,6 +32,7 @@ { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, "severity": 2, "for": "PT5M", "labels": { @@ -49,10 +53,6 @@ "actionProperties": { "ActionType1.Field1": "value11", "ActionType2.Field1": "value12" - }, - "customProperties": { - "key11": "value11", - "key12": "value12" } } } @@ -65,8 +65,11 @@ "location": "East US", "properties": { "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" ], "rules": [ { @@ -79,6 +82,7 @@ { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, "severity": 2, "for": "PT5M", "labels": { @@ -99,10 +103,6 @@ "actionProperties": { "ActionType1.Field1": "value11", "ActionType2.Field1": "value12" - }, - "customProperties": { - "key11": "value11", - "key12": "value12" } } } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json index 4974cfb46283..1be48efa32e0 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json @@ -15,8 +15,11 @@ "location": "East US", "properties": { "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" ], "rules": [ { @@ -29,6 +32,7 @@ { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, "severity": 2, "for": "PT5M", "labels": { @@ -49,10 +53,6 @@ "actionProperties": { "ActionType1.Field1": "value11", "ActionType2.Field1": "value12" - }, - "customProperties": { - "key11": "value11", - "key12": "value12" } } } @@ -65,8 +65,11 @@ "location": "East US", "properties": { "description": "This is the description of the following rule group", + "enabled": true, + "interval": "PT10M", + "clusterName": "myClusterName", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" ], "rules": [ { @@ -79,6 +82,7 @@ { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, "severity": 2, "for": "PT5M", "labels": { @@ -99,10 +103,6 @@ "actionProperties": { "ActionType1.Field1": "value11", "ActionType2.Field1": "value12" - }, - "customProperties": { - "key11": "value11", - "key12": "value12" } } } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json index 92071db9f803..245250283677 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json @@ -6,7 +6,7 @@ "api-version": "2023-03-01", "parameters": { "tags": { - "tag1": "value1" + "tag1": "tagValueFromPatch" }, "properties": { "enabled": false @@ -22,8 +22,11 @@ "location": "East US", "properties": { "description": "This is the description of the following rule group", + "enabled": false, + "interval": "PT10M", + "clusterName": "myClusterName", "scopes": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myMonitoringAccount" + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace" ], "rules": [ { @@ -36,6 +39,7 @@ { "alert": "Billing_Processing_Very_Slow", "expression": "job_type:billing_jobs_duration_seconds:99p5m > 30", + "enabled": true, "severity": 2, "for": "PT5M", "labels": { @@ -56,18 +60,13 @@ "actionProperties": { "ActionType1.Field1": "value11", "ActionType2.Field1": "value12" - }, - "customProperties": { - "key11": "value11", - "key12": "value12" } } } - ], - "enabled": false + ] }, "tags": { - "tag1": "value1" + "tag1": "tagValueFromPatch" } } } From b352979ac5d7ce138dc44589ed812901597b22fc Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Wed, 25 Jan 2023 21:37:05 +0200 Subject: [PATCH 08/16] fix lintdiff errors --- .../stable/2023-03-01/PrometheusRuleGroups.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index 6f58f0fdd589..ee5f470eba48 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -327,6 +327,7 @@ }, "properties": { "type": "object", + "x-ms-client-flatten": true, "properties": { "enabled": { "type": "boolean", @@ -387,6 +388,7 @@ "$ref": "#/definitions/PrometheusRule" }, "description": "Defines the rules in the Prometheus rule group.", + "x-ms-identifiers": [], "minItems": 1, "maxItems": 20 } @@ -394,6 +396,7 @@ }, "PrometheusRule": { "type": "object", + "description": "An Azure Prometheus alerting or recording rule.", "required": [ "expression" ], From 05feb6fd827c3659d8acafa0027f818f92e00746 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Wed, 25 Jan 2023 21:54:00 +0200 Subject: [PATCH 09/16] add pattern to rule name --- .../stable/2023-03-01/PrometheusRuleGroups.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index ee5f470eba48..7a868a00f0f5 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -499,7 +499,8 @@ "required": true, "type": "string", "description": "The name of the rule group.", - "x-ms-parameter-location": "method" + "x-ms-parameter-location": "method", + "pattern": "^[^:@/#{}%&+*<>?\\]+$" } } } From a76417fa5edd92fa0d9bcc7950ee6c913e05a1e3 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Tue, 31 Jan 2023 22:45:14 +0200 Subject: [PATCH 10/16] fix pattern --- .../stable/2023-03-01/PrometheusRuleGroups.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index 7a868a00f0f5..d568e39d45e4 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -500,7 +500,7 @@ "type": "string", "description": "The name of the rule group.", "x-ms-parameter-location": "method", - "pattern": "^[^:@/#{}%&+*<>?\\]+$" + "pattern": "^[^:@/#{}%&+*<>?]+$" } } } From fef9f7c6d47daa078f615e1c8d0cae78427d695a Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Mon, 13 Feb 2023 15:05:02 +0200 Subject: [PATCH 11/16] remove validations --- .../stable/2023-03-01/PrometheusRuleGroups.json | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index d568e39d45e4..708aafbfde1f 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -373,9 +373,7 @@ }, "scopes": { "$ref": "#/definitions/StringArray", - "description": "Target Azure Monitor workspaces resource ids. Only one scope currently supported.", - "minItems": 1, - "maxItems": 1 + "description": "Target Azure Monitor workspaces resource ids. Only one scope currently supported." }, "interval": { "type": "string", @@ -388,9 +386,7 @@ "$ref": "#/definitions/PrometheusRule" }, "description": "Defines the rules in the Prometheus rule group.", - "x-ms-identifiers": [], - "minItems": 1, - "maxItems": 20 + "x-ms-identifiers": [] } } }, @@ -419,15 +415,12 @@ }, "labels": { "$ref": "#/definitions/StringDictionary", - "description": "Labels to add or overwrite before storing the result.", - "maxProperties": 10 + "description": "Labels to add or overwrite before storing the result." }, "severity": { "type": "integer", "format": "int32", - "description": "The severity of the alerts fired by the rule.", - "minimum": 1, - "maximum": 4 + "description": "The severity of the alerts fired by the rule." }, "for": { "type": "string", From 2b104157f25fd9ba4b0e16a0ccc9f9d509dae34e Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Tue, 21 Feb 2023 19:01:46 +0200 Subject: [PATCH 12/16] add recomandations --- specification/alertsmanagement/resource-manager/readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/specification/alertsmanagement/resource-manager/readme.md b/specification/alertsmanagement/resource-manager/readme.md index 27747664b183..7000c75d270c 100644 --- a/specification/alertsmanagement/resource-manager/readme.md +++ b/specification/alertsmanagement/resource-manager/readme.md @@ -64,6 +64,7 @@ input-file: - Microsoft.AlertsManagement/stable/2021-08-08/AlertProcessingRules.json - Microsoft.AlertsManagement/preview/2019-05-05-preview/AlertsManagement.json - Microsoft.AlertsManagement/preview/2019-05-05-preview/SmartGroups.json + - Microsoft.AlertsManagement/preview/2023-01-01-preview/AlertRuleRecommendations.json ``` ### Tag: package-2021-08 From 39f2e39c119d4862ce441c93b38a5d1eedb0cb44 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Thu, 9 Mar 2023 13:49:54 +0200 Subject: [PATCH 13/16] change actions --- .../createOrUpdatePrometheusRuleGroup.json | 72 ++++++++++++------- .../examples/getPrometheusRuleGroup.json | 24 ++++--- .../examples/listPrometheusRuleGroups.json | 48 ++++++++----- .../listSubscriptionPrometheusRuleGroups.json | 48 ++++++++----- .../examples/patchPrometheusRuleGroup.json | 24 ++++--- 5 files changed, 135 insertions(+), 81 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json index 92b2a5826550..c590ca51d7b9 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/createOrUpdatePrometheusRuleGroup.json @@ -38,16 +38,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": { - "actionGroups": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" - ], - "actionProperties": { - "ActionType1.Field1": "value11", - "ActionType2.Field1": "value12" + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } } - } + ] } ] } @@ -92,16 +98,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": { - "actionGroups": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" - ], - "actionProperties": { - "ActionType1.Field1": "value11", - "ActionType2.Field1": "value12" + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } } - } + ] } ] } @@ -145,16 +157,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": { - "actionGroups": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" - ], - "actionProperties": { - "ActionType1.Field1": "value11", - "ActionType2.Field1": "value12" + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } } - } + ] } ] } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json index 58d97a8ee4e5..0c70fb15b7c2 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/getPrometheusRuleGroup.json @@ -44,16 +44,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": { - "actionGroups": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" - ], - "actionProperties": { - "ActionType1.Field1": "value11", - "ActionType2.Field1": "value12" + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } } - } + ] } ] } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json index 85e4a5f828cb..0db60181773a 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listPrometheusRuleGroups.json @@ -45,16 +45,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": { - "actionGroups": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" - ], - "actionProperties": { - "ActionType1.Field1": "value11", - "ActionType2.Field1": "value12" + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } } - } + ] } ] } @@ -95,16 +101,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": { - "actionGroups": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" - ], - "actionProperties": { - "ActionType1.Field1": "value11", - "ActionType2.Field1": "value12" + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } } - } + ] } ] } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json index 1be48efa32e0..4642625c364c 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/listSubscriptionPrometheusRuleGroups.json @@ -45,16 +45,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": { - "actionGroups": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" - ], - "actionProperties": { - "ActionType1.Field1": "value11", - "ActionType2.Field1": "value12" + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } } - } + ] } ] } @@ -95,16 +101,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": { - "actionGroups": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" - ], - "actionProperties": { - "ActionType1.Field1": "value11", - "ActionType2.Field1": "value12" + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } } - } + ] } ] } diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json index 245250283677..4fe7a73ef948 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/examples/patchPrometheusRuleGroup.json @@ -52,16 +52,22 @@ "autoResolved": true, "timeToResolve": "PT10M" }, - "actions": { - "actionGroups": [ - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", - "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup" - ], - "actionProperties": { - "ActionType1.Field1": "value11", - "ActionType2.Field1": "value12" + "actions": [ + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup", + "actionProperties": { + "key11": "value11", + "key12": "value12" + } + }, + { + "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup", + "actionProperties": { + "key21": "value21", + "key22": "value22" + } } - } + ] } ] }, From 270dbb75c49119f8cfe6a42911c44ab89d721097 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Thu, 9 Mar 2023 13:54:53 +0200 Subject: [PATCH 14/16] change to last acions property version --- .../stable/2023-03-01/PrometheusRuleGroups.json | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index 708aafbfde1f..25778d4958f1 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -442,12 +442,20 @@ } }, "PrometheusRuleGroupActions": { + "type": "array", + "items": { + "$ref": "#/definitions/PrometheusRuleGroupAction" + }, + "x-ms-identifiers": [], + "description": "The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only relevant for alerts." + }, + "PrometheusRuleGroupAction":{ "type": "object", "description": "An alert action. Only relevant for alerts.", "properties": { - "actionGroups": { - "$ref": "#/definitions/StringArray", - "description": "One or more action group resource IDs. Each is activated when an alert is fired." + "actionGroupId": { + "type": "string", + "description": "The resource id of the action group to use." }, "actionProperties": { "$ref": "#/definitions/StringDictionary", From 6b3200dbf2e1e85da3b9f7417838a18d8b66e481 Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Thu, 9 Mar 2023 16:35:40 +0200 Subject: [PATCH 15/16] run prettier --- .../stable/2023-03-01/PrometheusRuleGroups.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index 25778d4958f1..6eefb3f06b43 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -443,13 +443,13 @@ }, "PrometheusRuleGroupActions": { "type": "array", - "items": { - "$ref": "#/definitions/PrometheusRuleGroupAction" - }, - "x-ms-identifiers": [], - "description": "The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only relevant for alerts." + "items": { + "$ref": "#/definitions/PrometheusRuleGroupAction" + }, + "x-ms-identifiers": [], + "description": "The array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. Only relevant for alerts." }, - "PrometheusRuleGroupAction":{ + "PrometheusRuleGroupAction": { "type": "object", "description": "An alert action. Only relevant for alerts.", "properties": { From ae8356cabc4d24040ec033df941a26fa98a6e2dd Mon Sep 17 00:00:00 2001 From: Moshe Malka Date: Tue, 14 Mar 2023 17:14:26 +0200 Subject: [PATCH 16/16] fix PR review comments --- .../2023-03-01/PrometheusRuleGroups.json | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json index 6eefb3f06b43..eaa743e0060f 100644 --- a/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json +++ b/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/stable/2023-03-01/PrometheusRuleGroups.json @@ -372,8 +372,11 @@ "description": "Apply rule to data from a specific cluster." }, "scopes": { - "$ref": "#/definitions/StringArray", - "description": "Target Azure Monitor workspaces resource ids. Only one scope currently supported." + "type": "array", + "items": { + "type": "string" + }, + "description": "Target Azure Monitor workspaces resource ids. This api-version is currently limited to creating with one scope. This may change in future." }, "interval": { "type": "string", @@ -410,17 +413,20 @@ "description": "Enable/disable rule." }, "expression": { - "description": "The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and the result recorded as a new set of time series with the metric name as given by 'record'.", + "description": "The PromQL expression to evaluate. https://prometheus.io/docs/prometheus/latest/querying/basics/. Evaluated periodically as given by 'interval', and the result recorded as a new set of time series with the metric name as given by 'record'.", "type": "string" }, "labels": { - "$ref": "#/definitions/StringDictionary", + "type": "object", + "additionalProperties": { + "type": "string" + }, "description": "Labels to add or overwrite before storing the result." }, "severity": { "type": "integer", "format": "int32", - "description": "The severity of the alerts fired by the rule." + "description": "The severity of the alerts fired by the rule. Must be between 0 and 4." }, "for": { "type": "string", @@ -428,8 +434,11 @@ "format": "duration" }, "annotations": { - "$ref": "#/definitions/StringDictionary", - "description": "Alert annotation key-value pairs." + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The annotations clause specifies a set of informational labels that can be used to store longer additional information such as alert descriptions or runbook links. The annotation values can be templated." }, "actions": { "$ref": "#/definitions/PrometheusRuleGroupActions", @@ -458,7 +467,10 @@ "description": "The resource id of the action group to use." }, "actionProperties": { - "$ref": "#/definitions/StringDictionary", + "type": "object", + "additionalProperties": { + "type": "string" + }, "description": "The properties of an action group object." } } @@ -477,20 +489,6 @@ "format": "duration" } } - }, - "StringDictionary": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "A dictionary from string to string." - }, - "StringArray": { - "type": "array", - "items": { - "type": "string" - }, - "description": "An array of strings." } }, "parameters": {