@stephenb
Okay, that didn't work. Consumer is set to infrastructure now but I'm still seeing the same issues.
Here are details for the two alerts:
{
"id": "debd0950-7e78-11ee-83ed-cbbbc46eadd0",
"name": "PlayNiceP",
"tags": [],
"enabled": true,
"consumer": "infrastructure",
"throttle": null,
"revision": 0,
"running": false,
"schedule": {
"interval": "5m"
},
"params": {
"criteria": [
{
"comparator": ">",
"threshold": [
1
],
"timeSize": 1,
"timeUnit": "h",
"aggType": "count"
}
],
"sourceId": "default",
"alertOnNoData": true,
"alertOnGroupDisappear": true,
"filterQueryText": "labels.http_route: \"/pos/order/{orderId}/{version}/void\" and url.path : *",
"filterQuery": "{\"bool\":{\"filter\":[{\"bool\":{\"should\":[{\"term\":{\"labels.http_route\":{\"value\":\"/pos/order/{orderId}/{version}/void\"}}}],\"minimum_should_match\":1}},{\"bool\":{\"should\":[{\"exists\":{\"field\":\"url.path\"}}],\"minimum_should_match\":1}}]}}"
},
"rule_type_id": "metrics.alert.threshold",
"created_by": "2804626948",
"updated_by": "2804626948",
"created_at": "2023-11-08T20:53:30.310Z",
"updated_at": "2023-11-08T20:53:30.310Z",
"api_key_owner": "2804626948",
"notify_when": null,
"mute_all": false,
"muted_alert_ids": [],
"scheduled_task_id": "debd0950-7e78-11ee-83ed-cbbbc46eadd0",
"execution_status": {
"status": "active",
"last_execution_date": "2023-11-08T20:53:45.926Z",
"last_duration": 273
},
"actions": [
{
"group": "metrics.threshold.fired",
"id": "elastic-cloud-email",
"params": {
"message": "{{context.reason}}\n\n{{rule.name}} is active with the following conditions:\n\n- Affected: {{context.group}}\n- Metric: {{context.metric}}\n- Observed value: {{context.value}}\n- Threshold: {{context.threshold}}\n\n[View alert details]({{context.alertDetailsUrl}})\n",
"to": [
"vlad@gmail.com"
],
"subject": "Working Test"
},
"connector_type_id": ".email",
"frequency": {
"summary": false,
"notify_when": "onActionGroupChange",
"throttle": null
},
"uuid": "f459c4a4-095f-4376-8c79-e1b35b8b8616"
}
],
"last_run": {
"alerts_count": {
"active": 1,
"new": 0,
"recovered": 0,
"ignored": 0
},
"outcome_msg": null,
"outcome_order": 0,
"outcome": "succeeded",
"warning": null
},
"next_run": "2023-11-08T20:58:45.863Z",
"api_key_created_by_user": false
},
{
"id": "5041aa00-7e78-11ee-83ed-cbbbc46eadd0",
"name": "Infrastructure",
"tags": [],
"enabled": true,
"consumer": "infrastructure",
"throttle": null,
"revision": 2,
"running": false,
"schedule": {
"interval": "30m"
},
"params": {
"criteria": [
{
"comparator": ">=",
"timeSize": 1,
"aggType": "count",
"threshold": [
1
],
"timeUnit": "h"
}
],
"sourceId": "default",
"alertOnNoData": true,
"alertOnGroupDisappear": true,
"groupBy": [
"labels.storeName",
"labels.retailer"
],
"filterQueryText": "labels.http_route: \"/pos/order/{orderId}/{version}/void\" and url.path : *"
},
"rule_type_id": "metrics.alert.threshold",
"created_by": "ruleMaker",
"updated_by": "2804626948",
"created_at": "2023-11-08T20:49:31.300Z",
"updated_at": "2023-11-08T20:50:15.827Z",
"api_key_owner": "2804626948",
"notify_when": null,
"mute_all": false,
"muted_alert_ids": [],
"scheduled_task_id": "5041aa00-7e78-11ee-83ed-cbbbc46eadd0",
"execution_status": {
"status": "active",
"last_execution_date": "2023-11-08T20:50:24.939Z",
"last_duration": 444
},
"actions": [
{
"group": "metrics.threshold.fired",
"id": "8f203190-7d54-11ed-a2f3-7763c1be2fed",
"params": {
"body": "{\"alertName\": \"{{rule.name}}\",\"reason\":\"{{context.reason}}\",\"group\":\"{{context.group}}\"}"
},
"connector_type_id": ".webhook",
"frequency": {
"summary": false,
"notify_when": "onActiveAlert",
"throttle": null
},
"uuid": "01262eae-49d1-4a9e-9e0b-86d0f7f12870"
},
{
"group": "metrics.threshold.fired",
"id": "elastic-cloud-email",
"params": {
"message": "{{context.reason}}\n\n{{rule.name}} is active with the following conditions:\n\n- Affected: {{context.group}}\n- Metric: {{context.metric}}\n- Observed value: {{context.value}}\n- Threshold: {{context.threshold}}\n\n[View alert details]({{context.alertDetailsUrl}})\n",
"to": [
"vlad@gmail.com"
],
"subject": "Test"
},
"connector_type_id": ".email",
"frequency": {
"summary": false,
"notify_when": "onActiveAlert",
"throttle": null
},
"uuid": "96a40134-9efe-4e58-aa03-3ad150fbb8bc"
}
],
"last_run": {
"alerts_count": {
"active": 1,
"new": 0,
"recovered": 0,
"ignored": 0
},
"outcome_msg": null,
"outcome_order": 0,
"outcome": "succeeded",
"warning": null
},
"next_run": "2023-11-08T21:20:24.874Z",
"api_key_created_by_user": false
},
Now there are hardly any difference between the two. But the one I created in the metric explorer works just fine while the other didn't. I'm just completely out of ideas now. This is such a strange behavior
EDIT:
I think I just got lead on something. That number it's popping out is close to what I would get if I didn't the filter query. When comparing those two jsons, it looks like the working one has a filterQuery field while the other one doesn't. Trying to figure out if we need to pass that as a part of the body in our request to kibana API