Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboard alerting dashboards plugin #103

Merged
merged 13 commits into from
Mar 7, 2022
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ $ yarn cypress run --spec "cypress/integration/core-opensearch-dashboards/vanill

`ENDPOINT_WITH_PROXY`: for an OpenSearch endpoint wrapped with a proxy that redirects the visiting url to the login url, even with auth option provided in `cy.visit`, the redirection to the login url still happens. So a login request before tests and cache the security cookie are needed and can be switched on by this argument.

`MANAGED_SERVICE_ENDPOINT`: set to true if tests are running against managed service domains.
### Formatting

`prettier` is used to standardize formatting of files. You can format all files (new and existing) by running
Expand Down
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"SECURITY_ENABLED": false,
"username": "admin",
"password": "admin",
"ENDPOINT_WITH_PROXY": false
"ENDPOINT_WITH_PROXY": false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference between ENDPOINT_WITH_PROXY and MANAGED_SERVICE_ENDPOINT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for the MANAGED_SERVICE_ENDPOINT flag we are trying to separate the tests that are only applicable to managed service side domain. In this case the Amazon SNS type destination is only on AWS Opensearch so it will fail on an open source domain. I believe there are cases when the domain is on managed service side and is not proxy enabled, so it could be 2 different flags.

I will add the description of this flag to the documentation too.

"MANAGED_SERVICE_ENDPOINT": false
},
"experimentalNetworkStubbing": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"range": {
"order_date": {
"from": "{{period_end}}||-1h",
"to": "{{period_end}}",
"include_lower": true,
"include_upper": true,
"format": "epoch_millis",
"boost": 1.0
}
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"aggregations": {
"composite_agg": {
"composite": {
"size": 10,
"sources": [
{
"user": {
"terms": {
"field": "user",
"missing_bucket": false,
"order": "asc"
}
}
}
]
}
}
}
}
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"
}
}
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"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "sample_destination_chime",
"type": "chime",
"chime": {
"url": "https://hooks.chime.aws/incomingwebhooks/XXX?token=XXX"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "sample_destination",
"type": "custom_webhook",
"custom_webhook": {
"header_params": {
"Content-Type": "application/json"
},
"url": "http://www.sampledestination.com"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "sample_extraction_query_bucket_level_monitor",
"monitor_type": "bucket_level_monitor",
"enabled": true,
"schedule": {
"period": {
"interval": 1,
"unit": "MINUTES"
}
},
"inputs": [
{
"search": {
"indices": ["*"],
"query": {
"size": 0,
"query": {
"bool": {
"filter": [
{
"range": {
"order_date": {
"from": "{{period_end}}||-1h",
"to": "{{period_end}}",
"include_lower": true,
"include_upper": true,
"format": "epoch_millis",
"boost": 1.0
}
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"aggregations": {
"composite_agg": {
"composite": {
"size": 10,
"sources": [
{
"user": {
"terms": {
"field": "user",
"missing_bucket": false,
"order": "asc"
}
}
}
]
}
}
}
}
}
}
],
"triggers": [],
"ui_metadata": {
"schedule": {}
}
}
Loading