Skip to content

Commit 932fd41

Browse files
authored
feat: support [alerts] (#12)
1 parent 434e995 commit 932fd41

5 files changed

Lines changed: 105 additions & 3 deletions

File tree

.github/workflows/render.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Render Helm chart
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
render:
8+
runs-on: blacksmith-4vcpu-ubuntu-2404
9+
permissions:
10+
contents: read
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Install Helm
17+
uses: azure/setup-helm@v4
18+
with:
19+
version: latest
20+
21+
- name: Lint chart
22+
run: helm lint .
23+
24+
- name: Render chart
25+
run: helm template control .

Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: pgdog-control
33
description: PgDog Control
44
type: application
5-
version: 0.2.6
6-
appVersion: "v2026-05-28"
5+
version: 0.2.7
6+
appVersion: "438ab3d1"

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ control:
496496

497497
### Helm
498498

499-
When the dashboard provisions a new PgDog cluster, it shells out to `helm upgrade --install` against a chart fetched from our Helm repository. `control.config.helm` controls which chart and which reposiory. The defaults point at the public `pgdogdev` chart on `helm.pgdog.dev`, which is what you want unless you mirror the chart internally.
499+
When the dashboard provisions a new PgDog cluster, it shells out to `helm upgrade --install` against a chart fetched from our Helm repository. `control.config.helm` controls which chart and which repository. The defaults point at the public `pgdogdev` chart on `helm.pgdog.dev`, which is what you want unless you mirror the chart internally.
500500

501501
```yaml
502502
control:
@@ -541,6 +541,33 @@ control:
541541
| `cloudwatch.lookback_secs` | How far back each fetch reaches. A fresh deploy pulls the full window on its first tick (int, default `3600`). |
542542
| `cloudwatch.period_secs` | CloudWatch aggregation period. The smallest bucket the metric API returns (int, default `60`). |
543543

544+
### Alerting
545+
546+
`control.config.alerts` enables outbound alert integrations. Leave `incident_io` unset to disable incident.io. Thresholds are optional and only configured metrics create alerts.
547+
548+
```yaml
549+
control:
550+
config:
551+
alerts:
552+
evaluation_window_secs: 300
553+
thresholds:
554+
clients_waiting: 10
555+
cpu: 90.0
556+
memory: 2048
557+
server_connections: 100
558+
incident_io:
559+
api_key: inc_live_xxx
560+
```
561+
562+
| Option | Description |
563+
|-|-|
564+
| `evaluation_window_secs` | How long metrics must remain at or above threshold before creating an alert (int, default `300`). |
565+
| `thresholds.clients_waiting` | Number of clients waiting on a server connection (int, optional). |
566+
| `thresholds.cpu` | CPU usage percentage. Must be between `0.0` and `100.0`, inclusive (float, optional). |
567+
| `thresholds.memory` | Memory used, in megabytes (int, optional). |
568+
| `thresholds.server_connections` | Number of open server connections (int, optional). |
569+
| `incident_io.api_key` | incident.io API key with permission to create incidents. Missing `incident_io` disables the integration (string, optional). |
570+
544571
### State store
545572

546573
`control.config.store` governs the in-memory metric store: how often it sweeps for stale data, when an instance is marked stale or evicted, and how long per-instance metric history is retained. The defaults are tight enough for an interactive dashboard; widen them if you keep the UI open against a cluster that's intentionally idle, or if you want a longer historical window in memory.
@@ -553,6 +580,7 @@ control:
553580
stale_after_secs: 5
554581
evict_after_secs: 60
555582
metrics_retention_secs: 300
583+
query_history_limit: 1000
556584
```
557585

558586
| Option | Description |
@@ -561,6 +589,7 @@ control:
561589
| `stale_after_secs` | Instance is marked stale if its newest metric is older than this. The UI dims it but keeps it visible (int, default `5`). |
562590
| `evict_after_secs` | Instance is dropped from the store entirely if its newest metric is older than this (int, default `60`). |
563591
| `metrics_retention_secs` | How much per-instance metric history is kept in memory. Older points are dropped as new ones arrive (int, default `300`). |
592+
| `query_history_limit` | Per-token historical query store capacity. Oldest deduped query entries are evicted first once the limit is reached (int, default `1000`). |
564593

565594
### Redis persistence
566595

templates/configmap.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ data:
7070
{{- with .metrics_retention_secs }}
7171
metrics_retention_secs = {{ . }}
7272
{{- end }}
73+
{{- if hasKey . "query_history_limit" }}
74+
query_history_limit = {{ .query_history_limit }}
75+
{{- end }}
7376
{{- end }}
7477
7578
{{- with $config.helm }}
@@ -81,6 +84,9 @@ data:
8184
{{- with .repo }}
8285
repo = {{ . | quote }}
8386
{{- end }}
87+
{{- with .repo_url }}
88+
repo_url = {{ . | quote }}
89+
{{- end }}
8490
{{- end }}
8591
8692
{{- if or $cookieSecret (gt (len $auth) 0) }}
@@ -129,6 +135,37 @@ data:
129135
{{- end }}
130136
{{- end }}
131137
138+
{{- with $config.alerts }}
139+
140+
[alerts]
141+
{{- if hasKey . "evaluation_window_secs" }}
142+
evaluation_window_secs = {{ .evaluation_window_secs }}
143+
{{- end }}
144+
{{- with .thresholds }}
145+
146+
[alerts.thresholds]
147+
{{- if hasKey . "clients_waiting" }}
148+
clients_waiting = {{ .clients_waiting }}
149+
{{- end }}
150+
{{- if hasKey . "cpu" }}
151+
cpu = {{ .cpu }}
152+
{{- end }}
153+
{{- if hasKey . "memory" }}
154+
memory = {{ .memory }}
155+
{{- end }}
156+
{{- if hasKey . "server_connections" }}
157+
server_connections = {{ .server_connections }}
158+
{{- end }}
159+
{{- end }}
160+
{{- with .incident_io }}
161+
162+
[alerts.incident_io]
163+
{{- if hasKey . "api_key" }}
164+
api_key = {{ .api_key | quote }}
165+
{{- end }}
166+
{{- end }}
167+
{{- end }}
168+
132169
{{- $redis := $config.redis | default dict }}
133170
{{- $redisUrl := $redis.url | default (printf "redis://%s.%s.svc.cluster.local:6379" (include "pgdog-control.redis.fullname" .) .Release.Namespace) }}
134171

values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ control:
8686
# stale_after_secs: 5
8787
# evict_after_secs: 60
8888
# metrics_retention_secs: 300
89+
# query_history_limit: 1000
8990
helm: {}
9091
# chart: pgdog
9192
# repo: pgdogdev
93+
# repo_url: https://helm.pgdog.dev
9294
auth: {}
9395
# cookie_secret: "" # optional; random key generated at boot when absent
9496
# redirect_base_url: "" # e.g. https://control.example.com
@@ -103,6 +105,15 @@ control:
103105
# client_id: ""
104106
# client_secret: ""
105107
# allowed_domains: []
108+
alerts: {}
109+
# evaluation_window_secs: 300
110+
# thresholds:
111+
# clients_waiting: 10
112+
# cpu: 90.0
113+
# memory: 2048
114+
# server_connections: 100
115+
# incident_io:
116+
# api_key: ""
106117
redis: {}
107118
# url: "" # optional; defaults to in-cluster redis
108119
# save_interval_secs: 60

0 commit comments

Comments
 (0)