Skip to content

Commit 2664334

Browse files
author
Rishabh Singh
authored
feat: Add alerting service (#269)
* Add alerting service * .
1 parent 404476c commit 2664334

File tree

5 files changed

+86
-1
lines changed

5 files changed

+86
-1
lines changed

docker/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ This will start all services required for Hypertrace. Once you see the service h
2525

2626
If you are facing any issues with docker-compose setup, we have listed down common issues and resolutions [here](https://docs.hypertrace.org/troubleshooting/docker-compose/).
2727

28+
#### To start alerting related serivces
29+
30+
Run ```docker-compose -f docker-compose.yml -f docker-compose.alerting.yml up```
31+
32+
Update alerting rule definition in alert-rules.json, notification-rules.json
33+
2834
### Ports
2935

3036
Here are the default Hypertrace ports:

docker/configs/alert-rules.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"id": "notification_rule_1",
4+
"ruleName": "high_avg_latency",
5+
"description": "Alert for high avg latency of payment service",
6+
"eventConditionId": "event_condition_1",
7+
"eventConditionType": "MetricAnomalyEventCondition",
8+
"channelId": "channel-id-1",
9+
"eventCondition" : {
10+
"metricSelection": {
11+
"metricAttribute": {
12+
"key": "numCalls",
13+
"scope": "SERVICE"
14+
},
15+
"metricAggregationFunction": "METRIC_AGGREGATION_FUNCTION_TYPE_SUM",
16+
"metricAggregationInterval": "PT15S",
17+
"filter": {
18+
"leafFilter": {
19+
"lhsExpression": {
20+
"attribute": {
21+
"key": "name",
22+
"scope": "SERVICE"
23+
}
24+
},
25+
"valueOperator": "VALUE_OPERATOR_EQ",
26+
"rhsExpression": {
27+
"stringValue": "customer"
28+
}
29+
}
30+
}
31+
},
32+
"violationCondition": [{
33+
"staticThresholdCondition": {
34+
"operator": "STATIC_THRESHOLD_OPERATOR_GT",
35+
"value": 0.0,
36+
"minimumViolationDuration": "PT5M",
37+
"severity": "SEVERITY_CRITICAL"
38+
}
39+
}]
40+
}
41+
}
42+
]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"channelName": "channel-1",
4+
"channelId": "channel-id-1",
5+
"channelConfig": [
6+
{
7+
"channelConfigType": "WEBHOOK",
8+
"url": "<add slack url here>",
9+
"webhookFormat": "WEBHOOK_FORMAT_SLACK"
10+
}
11+
]
12+
}
13+
]

docker/docker-compose.alerting.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
version: '2.4'
3+
services:
4+
5+
hypertrace-alert-engine:
6+
image: hypertrace/hypertrace-alert-engine
7+
container_name: hypertrace-alert-engine
8+
environment:
9+
- ALERT_RULES_PATH=/app/resources/alert-rules.json
10+
- NOTIFICATION_RULES_PATH=/app/resources/notification-rules.json
11+
- QUERY_SERVICE_HOST_CONFIG=hypertrace
12+
- QUERY_SERVICE_PORT_CONFIG=9001
13+
- ATTRIBUTE_SERVICE_HOST_CONFIG=hypertrace
14+
- ATTRIBUTE_SERVICE_PORT_CONFIG=9001
15+
volumes:
16+
- ../docker/configs/alert-rules.json:/app/resources/alert-rules.json:ro
17+
- ../docker/configs/notification-rules.json:/app/resources/notification-rules.json:ro
18+
depends_on:
19+
hypertrace:
20+
# service_started, not service_healthy as pinot and deps can take longer than 60s to start
21+
condition: service_healthy

docker/docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Note: Our stack is dependent on pinot and it is a cpu heavy during startup.
44
## The depends_on has a max wait time of 1 min, so if you don't have enough resources, you may have to re-run the same command.
55
## we are looking at improving this.
6-
version: "2.4"
6+
version: '2.4'
77
services:
88

99

@@ -73,6 +73,7 @@ services:
7373
hypertrace:
7474
# service_started, not service_healthy as pinot and deps can take longer than 60s to start
7575
condition: service_started
76+
7677

7778
# Third-party data services:
7879

@@ -105,3 +106,5 @@ services:
105106
depends_on:
106107
kafka-zookeeper:
107108
condition: service_healthy
109+
110+

0 commit comments

Comments
 (0)