Skip to content

Commit

Permalink
Implemented a toast to display successful attempts to acknowledge ale…
Browse files Browse the repository at this point in the history
…rts. Refactored alerts dashboard flyout to refresh its alerts table when alerts are acknowledged. (opensearch-project#160)

* Implemented unit and integ tests for the alerts dashboard flyout. Refactored AlertsDashboardFlyoutComponent::getBucketLevelGraphConditions to return a string with line breaks instead of an array of HTML elements. Signed-off-by: AWSHurneyt <[email protected]>

Signed-off-by:  AWSHurneyt <[email protected]>

* Removed an unused test variable.

Signed-off-by: AWSHurneyt <[email protected]>

* Removed debug logs.

Signed-off-by: AWSHurneyt <[email protected]>

* Implemented unit test. Refactored integration tests to use fewer wait periods.

Signed-off-by: AWSHurneyt <[email protected]>

* Examining flakiness in cypress test.

Signed-off-by: AWSHurneyt <[email protected]>

* Added short wait period to flyout cypress tests to alleviate flakiness.

Signed-off-by: AWSHurneyt <[email protected]>

* Refactored flyout cypress tests to use aliases.

Signed-off-by: AWSHurneyt <[email protected]>
Signed-off-by: AWSHurneyt <[email protected]>
  • Loading branch information
AWSHurneyt committed Mar 11, 2022
1 parent f15a3d1 commit dab2efe
Show file tree
Hide file tree
Showing 15 changed files with 2,181 additions and 356 deletions.
134 changes: 134 additions & 0 deletions cypress/fixtures/sample_alerts_flyout_bucket_level_monitor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"name": "sample_alerts_flyout_bucket_level_monitor",
"type": "monitor",
"monitor_type": "bucket_level_monitor",
"enabled": true,
"schedule": {
"period": {
"unit": "MINUTES",
"interval": 1
}
},
"inputs": [
{
"search": {
"indices": ["opensearch_dashboards_sample_data_ecommerce"],
"query": {
"size": 0,
"aggregations": {
"composite_agg": {
"composite": {
"sources": [
{
"customer_gender": {
"terms": {
"field": "customer_gender"
}
}
},
{
"user": {
"terms": {
"field": "user"
}
}
}
]
},
"aggs": {
"avg_products_price": {
"avg": {
"field": "products.price"
}
}
}
}
},
"query": {
"bool": {
"filter": [
{
"range": {
"order_date": {
"gte": "{{period_end}}||-10d",
"lte": "{{period_end}}",
"format": "epoch_millis"
}
}
}
]
}
}
}
}
}
],
"triggers": [
{
"bucket_level_trigger": {
"id": "JHpsfH0BYHgJ26-yS5n7",
"name": "sample_alerts_flyout_bucket_level_trigger",
"severity": "4",
"condition": {
"buckets_path": {
"_count": "_count",
"avg_products_price": "avg_products_price"
},
"parent_bucket_path": "composite_agg",
"script": {
"source": "params._count < 10000 || params.avg_products_price == 10",
"lang": "painless"
},
"gap_policy": "skip"
},
"actions": []
}
}
],
"ui_metadata": {
"schedule": {
"timezone": null,
"frequency": "interval",
"period": {
"unit": "MINUTES",
"interval": 1
},
"daily": 0,
"weekly": {
"tue": false,
"wed": false,
"thur": false,
"sat": false,
"fri": false,
"mon": false,
"sun": false
},
"monthly": {
"type": "day",
"day": 1
},
"cronExpression": "0 */1 * * *"
},
"search": {
"searchType": "graph",
"timeField": "order_date",
"aggregations": [
{
"aggregationType": "avg",
"fieldName": "products.price"
}
],
"groupBy": ["customer_gender", "user"],
"bucketValue": 10,
"bucketUnitOfTime": "d",
"where": {
"fieldName": [],
"fieldRangeEnd": 0,
"fieldRangeStart": 0,
"fieldValue": "",
"operator": "is"
}
},
"monitor_type": "bucket_level_monitor"
}
}
101 changes: 101 additions & 0 deletions cypress/fixtures/sample_alerts_flyout_query_level_monitor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"name": "sample_alerts_flyout_query_level_monitor",
"type": "monitor",
"monitor_type": "query_level_monitor",
"enabled": true,
"schedule": {
"period": {
"unit": "MINUTES",
"interval": 1
}
},
"inputs": [
{
"search": {
"indices": ["opensearch_dashboards_sample_data_ecommerce"],
"query": {
"size": 0,
"aggregations": {
"terms_agg": {
"terms": {
"field": "user"
}
}
},
"query": {
"bool": {
"filter": [
{
"range": {
"order_date": {
"gte": "{{period_end}}||-10d",
"lte": "{{period_end}}",
"format": "epoch_millis"
}
}
}
]
}
}
}
}
}
],
"triggers": [
{
"query_level_trigger": {
"id": "YHpufH0BYHgJ26-yhJm-",
"name": "sample_alerts_flyout_query_level_trigger",
"severity": "2",
"condition": {
"script": {
"source": "ctx.results[0].hits.total.value < 10000",
"lang": "painless"
}
},
"actions": []
}
}
],
"ui_metadata": {
"schedule": {
"timezone": null,
"frequency": "interval",
"period": {
"unit": "MINUTES",
"interval": 1
},
"daily": 0,
"weekly": {
"tue": false,
"wed": false,
"thur": false,
"sat": false,
"fri": false,
"mon": false,
"sun": false
},
"monthly": {
"type": "day",
"day": 1
},
"cronExpression": "0 */1 * * *"
},
"search": {
"searchType": "graph",
"timeField": "order_date",
"aggregations": [],
"groupBy": ["user"],
"bucketValue": 10,
"bucketUnitOfTime": "d",
"where": {
"fieldName": [],
"fieldRangeEnd": 0,
"fieldRangeStart": 0,
"fieldValue": "",
"operator": "is"
}
},
"monitor_type": "query_level_monitor"
}
}
Loading

0 comments on commit dab2efe

Please sign in to comment.