Skip to content

Commit 9112af1

Browse files
Merge pull request #63 from decentraland/feat/slack-alerts
feat: add job to monitor squids and send alerts
2 parents 9215fb6 + aa646f5 commit 9112af1

17 files changed

+2310
-51
lines changed

.env.example

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Slack configuration
2+
SLACK_BOT_TOKEN=xoxb-your-bot-token
3+
SLACK_CHANNEL=alerts
4+
5+
# Local testing configuration
6+
NODE_ENV=development
7+
USE_MOCK_SQUIDS=true
8+
FORCE_ETA_UNAVAILABLE=false

README.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Squid Management Server
2+
3+
This server manages Decentraland squids.
4+
5+
## Features
6+
7+
### Squid Monitoring
8+
9+
The server includes a daemon that monitors active squids every minute. This daemon checks:
10+
11+
1. If active squids (those whose `schema_name` matches `project_active_schema`) have an estimated synchronization time (`sqd_processor_sync_eta_seconds`) greater than 10 seconds.
12+
2. If the estimated synchronization time cannot be obtained.
13+
14+
In either case, the daemon sends an alert through Slack with detailed information about the affected squid.
15+
16+
## Configuration
17+
18+
To enable Slack alerts, you need to configure the following environment variables:
19+
20+
```
21+
SLACK_BOT_TOKEN=xoxb-your-bot-token
22+
SLACK_CHANNEL=alerts
23+
```
24+
25+
- `SLACK_BOT_TOKEN`: Slack bot token with permissions to send messages.
26+
- `SLACK_CHANNEL`: Slack channel where alerts will be sent (optional, default is 'general').
27+
28+
## Local Testing
29+
30+
For local development and testing without AWS access, you can use the following environment variables:
31+
32+
```
33+
NODE_ENV=development
34+
# or
35+
USE_MOCK_SQUIDS=true
36+
```
37+
38+
This will enable mock data with a simulated out-of-sync squid.
39+
40+
To test the "ETA unavailable" scenario, you can set:
41+
42+
```
43+
FORCE_ETA_UNAVAILABLE=true
44+
```
45+
46+
## Development
47+
48+
### Requirements
49+
50+
- Node.js
51+
- npm
52+
53+
### Installation
54+
55+
```bash
56+
npm install
57+
```
58+
59+
### Running
60+
61+
```bash
62+
npm start
63+
```
64+
65+
### Tests
66+
67+
```bash
68+
npm test
69+
```

0 commit comments

Comments
 (0)