Skip to content

Commit f2e202a

Browse files
feat(alerts): Add config for alerting worker (#767)
1 parent f91a4ca commit f2e202a

2 files changed

Lines changed: 32 additions & 10 deletions

File tree

docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ x-backend-environment: &backend-env
7070
# - SIDEKIQ_CLOCK=true
7171
# - SIDEKIQ_WEBHOOK=true
7272
# - SIDEKIQ_AI_AGENT=true
73+
# - SIDEKIQ_ALERTS=true
7374
x-frontend-environment: &frontend-env
7475
"API_URL": ${LAGO_API_URL:-http://localhost:3000}
7576
"APP_ENV": production
@@ -228,6 +229,20 @@ services:
228229
# environment:
229230
# <<: [*backend-env, *lago-api-url]
230231

232+
# You can uncomment this if you want to use a dedicated Sidekiq worker for the usage monitoring & alerting jobs.
233+
# It is recommended if you have a high usage of alerts to not impact the other Sidekiq Jobs.
234+
# Set SIDEKIQ_ALERTS=true on the other workers so alerting jobs are routed to this worker.
235+
#api-alerts-worker:
236+
# <<: *backend-image
237+
# container_name: lago-alerts-worker
238+
# restart: unless-stopped
239+
# depends_on:
240+
# api:
241+
# condition: service_healthy
242+
# command: ["./scripts/start.alerts.worker.sh"]
243+
# environment:
244+
# <<: [*backend-env, *lago-api-url]
245+
231246
# You can uncomment this if you want to use a dedicated Sidekiq worker for the invoices pdf creation.
232247
# It is recommended if you have a high usage of invoices being created to not impact the other Sidekiq Jobs.
233248
#api-pdfs-worker:

docs/architecture.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,19 @@ Lago supports dedicated workers for specific job types to improve performance an
7979

8080
#### Configuration
8181

82-
| Environment Variable | Queue Name | Default Concurrency (Production) | Purpose |
83-
|----------------------|------------------|----------------------------------|----------------------|
84-
| `SIDEKIQ_ANALYTICS` | `analytics` | 10 | Analytics processing |
85-
| `SIDEKIQ_BILLING` | `billing` | 5 | Billing operations |
86-
| `SIDEKIQ_CLOCK` | `clock_worker` | 5 | Scheduled tasks |
87-
| `SIDEKIQ_EVENTS` | `events` | 10 | Event processing |
88-
| `SIDEKIQ_PAYMENTS` | `payments` | 10 | Payment operations |
89-
| `SIDEKIQ_PDF` | `pdfs` | 10 | PDF generation |
90-
| `SIDEKIQ_WEBHOOK` | `webhook_worker` | 10 | Webhook delivery |
91-
| `SIDEKIQ_AI_AGENT` | `ai_agent` | 10 | AI Agent |
82+
| Environment Variable | Queue Name(s) | Default Concurrency (Production) | Purpose |
83+
|----------------------|------------------------------------|----------------------------------|----------------------|
84+
| `SIDEKIQ_ANALYTICS` | `analytics`, `analytics_low_priority` | 10 | Analytics processing |
85+
| `SIDEKIQ_BILLING` | `billing`, `billing_low_priority` | 5 | Billing operations |
86+
| `SIDEKIQ_CLOCK` | `clock_worker` | 5 | Scheduled tasks |
87+
| `SIDEKIQ_EVENTS` | `events` | 10 | Event processing |
88+
| `SIDEKIQ_PAYMENTS` | `payments` | 10 | Payment operations |
89+
| `SIDEKIQ_PDF` | `pdfs` | 10 | PDF generation |
90+
| `SIDEKIQ_WEBHOOK` | `webhook_worker` | 10 | Webhook delivery |
91+
| `SIDEKIQ_AI_AGENT` | `ai_agent` | 10 | AI Agent |
92+
| `SIDEKIQ_ALERTS` | `alerts_high_priority`, `alerts` | 5 | Usage Alerting |
93+
| `SIDEKIQ_WALLETS` | `wallets` | 10 | Wallet balance refresh |
94+
| _(always on, no toggle)_ | `meilisearch` | 10 | Meilisearch invoice indexing |
9295

9396
#### Queue Routing Logic
9497

@@ -215,6 +218,10 @@ Lago's production deployment includes multiple worker types, each handling speci
215218
| **Payments Worker** | `payments` | Handles payment processing operations | Recommended | Enable with `SIDEKIQ_PAYMENTS=true`; scale based on payment volume |
216219
| **PDF Worker** | `pdfs` | Generates PDF invoices and documents | Highly Recommended | Enable with `SIDEKIQ_PDF=true`; PDF generation is CPU-intensive |
217220
| **Webhook Worker** | `webhook_worker` | Delivers webhooks to customer endpoints | Highly Recommended | Enable with `SIDEKIQ_WEBHOOK=true`; isolate webhook delays from core processing |
221+
| **Wallet Worker** | `wallets` | Refreshes wallet ongoing balances | Optional | Enable with `SIDEKIQ_WALLETS=true`; otherwise jobs fall back to `low_priority` |
222+
| **Alerts Worker** | `alerts_high_priority`, `alerts` | Processes usage alerting jobs | Optional | Enable with `SIDEKIQ_ALERTS=true`; otherwise jobs fall back to `default` |
223+
| **AI Agent Worker** | `ai_agent` | Handles AI Agent jobs | Optional | Enable with `SIDEKIQ_AI_AGENT=true` |
224+
| **Meilisearch Worker** | `meilisearch` | Indexes invoices into Meilisearch | Optional | Always routes to the `meilisearch` queue (no toggle); requires this worker when Meilisearch search is used |
218225

219226
#### Specialized Workers
220227

0 commit comments

Comments
 (0)