@zigordev/stack 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/compose.yaml +19 -1
- package/observability/alert-kafka-broker-is-down.json +60 -0
- package/observability/alert-message-reached-dead-letter-topic.json +60 -0
- package/observability/alert-messages-are-stuck.json +60 -0
- package/observability/dashboard-app.json +99 -0
- package/observability/dashboard-platform.json +56 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,18 +85,21 @@ The agent reads the log lines of every container on the two networks, through th
|
|
|
85
85
|
| ---------------------------------------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
86
86
|
| Its own heartbeat, under the name `alloy` | Itself | One series. An alert fires when it has been missing for 10 minutes |
|
|
87
87
|
| The machine's processor, memory and disks, under the name `host` | Three read-only mounts of the machine: `/proc`, `/sys` and `/` | Only the series that a dashboard or an alert uses, and only real disks |
|
|
88
|
+
| Whether the Kafka broker answers, under the name `kafka` | A connection to `kafka:9092` once a minute, with no sign-in | One series. An alert fires when it has failed for 5 minutes |
|
|
88
89
|
|
|
89
90
|
The three mounts let the agent read the machine's numbers. It runs as a user that is not root, so it reads only what every user of the machine may read. On the laptop "the machine" is the small Linux machine inside Docker Desktop.
|
|
90
91
|
|
|
92
|
+
The check of the broker only opens a connection. Alloy's own Kafka exporter would sign in at the agent's start, and on 2026-11-25 it stopped the whole agent whenever Kafka was down then, so it is not used. How far behind a consumer is, and the messages it set aside, come from each app's own numbers instead, which `@zigordev/events` reports.
|
|
93
|
+
|
|
91
94
|
### Dashboards and alert rules
|
|
92
95
|
|
|
93
|
-
`zigordev-stack up` ends by pushing
|
|
96
|
+
`zigordev-stack up` ends by pushing twelve files to the local Grafana, with gcx: one folder, two dashboards and nine alert rules. A second push changes nothing.
|
|
94
97
|
|
|
95
|
-
| In Grafana | What it shows
|
|
96
|
-
| --------------------------------------- |
|
|
97
|
-
| Dashboards, folder `zigordev`, App | One app, picked from a list: whether it reports, its version, its requests, the share that fail, its response times, its events and its
|
|
98
|
-
| Dashboards, folder `zigordev`, Platform | The machine's processor, memory and disks, the requests at the ingress, who is reporting,
|
|
99
|
-
| Alerting,
|
|
98
|
+
| In Grafana | What it shows |
|
|
99
|
+
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| Dashboards, folder `zigordev`, App | One app, picked from a list: whether it reports, its version, its requests, the share that fail, its response times, its events, its errors, and its messages waiting and set aside |
|
|
101
|
+
| Dashboards, folder `zigordev`, Platform | The machine's processor, memory and disks, the requests at the ingress, who is reporting, how old each product's newest dump and last good restore test are, and whether the Kafka broker answers |
|
|
102
|
+
| Alerting, nine rules | [The runbooks](../docs/runbooks/README.md) list them. On the laptop they show in Grafana and notify nobody |
|
|
100
103
|
|
|
101
104
|
A new app needs no entry anywhere. It appears in the list of the App dashboard with its first request, and every rule covers it.
|
|
102
105
|
|
|
@@ -264,7 +267,7 @@ Every product starts the same project, named `platform`. Two products that hold
|
|
|
264
267
|
| `pnpm local:up` | It prints "kafka-setup: done", and ends with "The shared services are up:" and the four addresses |
|
|
265
268
|
| `pnpm local:up` a second time | The same, within seconds, and no service is recreated |
|
|
266
269
|
| Open `http://grafana.localhost`, then Dashboards, then the folder `zigordev` | The dashboards App and Platform are there, and Platform shows the machine's numbers |
|
|
267
|
-
| In Grafana, open Alerting, then Alert rules |
|
|
270
|
+
| In Grafana, open Alerting, then Alert rules | Nine rules are listed in the folder `zigordev`, each one "Normal" |
|
|
268
271
|
| Open `http://grafana.localhost` and `http://mail.localhost` | Both pages open, with no sign-in |
|
|
269
272
|
| In Grafana's Explore, pick Loki and run `{service_name="traefik"}` | Traefik's own log lines show |
|
|
270
273
|
| Open `http://nothing.localhost` | Traefik answers 404, because no container asked for that address |
|
package/compose.yaml
CHANGED
|
@@ -200,10 +200,21 @@ services:
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
prometheus.exporter.blackbox "kafka" {
|
|
204
|
+
config = "{ modules: { tcp: { prober: tcp, timeout: 5s } } }"
|
|
205
|
+
|
|
206
|
+
target {
|
|
207
|
+
name = "kafka"
|
|
208
|
+
address = "kafka:9092"
|
|
209
|
+
module = "tcp"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
203
213
|
prometheus.scrape "machine" {
|
|
204
214
|
targets = array.concat(
|
|
205
215
|
prometheus.exporter.self.alloy.targets,
|
|
206
216
|
prometheus.exporter.unix.host.targets,
|
|
217
|
+
prometheus.exporter.blackbox.kafka.targets,
|
|
207
218
|
)
|
|
208
219
|
scrape_interval = "60s"
|
|
209
220
|
forward_to = [prometheus.relabel.machine.receiver]
|
|
@@ -214,7 +225,7 @@ services:
|
|
|
214
225
|
|
|
215
226
|
rule {
|
|
216
227
|
source_labels = ["__name__", "mode", "fstype"]
|
|
217
|
-
regex = "alloy_build_info;;|node_cpu_seconds_total;idle;|node_memory_(MemTotal|MemAvailable)_bytes;;|node_filesystem_(size|avail)_bytes;;(ext4|xfs)|container_(memory_working_set|spec_memory_limit)_bytes;;|platform_backup_(last_success_timestamp_seconds|size_bytes);;|platform_restore_test_(last_success_timestamp_seconds|tables);;"
|
|
228
|
+
regex = "alloy_build_info;;|node_cpu_seconds_total;idle;|node_memory_(MemTotal|MemAvailable)_bytes;;|node_filesystem_(size|avail)_bytes;;(ext4|xfs)|container_(memory_working_set|spec_memory_limit)_bytes;;|platform_backup_(last_success_timestamp_seconds|size_bytes);;|platform_restore_test_(last_success_timestamp_seconds|tables);;|probe_success;;"
|
|
218
229
|
action = "keep"
|
|
219
230
|
}
|
|
220
231
|
|
|
@@ -231,6 +242,13 @@ services:
|
|
|
231
242
|
target_label = "job"
|
|
232
243
|
replacement = "host"
|
|
233
244
|
}
|
|
245
|
+
|
|
246
|
+
rule {
|
|
247
|
+
source_labels = ["job"]
|
|
248
|
+
regex = "integrations/blackbox/kafka"
|
|
249
|
+
target_label = "job"
|
|
250
|
+
replacement = "kafka"
|
|
251
|
+
}
|
|
234
252
|
}
|
|
235
253
|
|
|
236
254
|
otelcol.receiver.prometheus "machine" {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiVersion": "rules.alerting.grafana.app/v1beta1",
|
|
3
|
+
"kind": "AlertRule",
|
|
4
|
+
"metadata": {
|
|
5
|
+
"name": "kafka-broker-is-down",
|
|
6
|
+
"annotations": {
|
|
7
|
+
"grafana.app/folder": "zigordev"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"spec": {
|
|
11
|
+
"title": "The Kafka broker is down",
|
|
12
|
+
"trigger": {
|
|
13
|
+
"interval": "1m"
|
|
14
|
+
},
|
|
15
|
+
"for": "5m",
|
|
16
|
+
"noDataState": "Ok",
|
|
17
|
+
"execErrState": "Error",
|
|
18
|
+
"labels": {
|
|
19
|
+
"severity": "phone"
|
|
20
|
+
},
|
|
21
|
+
"annotations": {
|
|
22
|
+
"summary": "The Kafka broker has not answered on its port for 5 minutes, so no app can send or read events",
|
|
23
|
+
"runbook_url": "https://github.com/zigordev/platform/blob/main/docs/runbooks/kafka-broker-is-down.md",
|
|
24
|
+
"__dashboardUid__": "platform",
|
|
25
|
+
"__panelId__": "14"
|
|
26
|
+
},
|
|
27
|
+
"expressions": {
|
|
28
|
+
"A": {
|
|
29
|
+
"datasourceUID": "prometheus",
|
|
30
|
+
"relativeTimeRange": {
|
|
31
|
+
"from": "10m",
|
|
32
|
+
"to": "0s"
|
|
33
|
+
},
|
|
34
|
+
"model": {
|
|
35
|
+
"refId": "A",
|
|
36
|
+
"expr": "(max(probe_success{job=\"kafka\"})) < 1",
|
|
37
|
+
"instant": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"B": {
|
|
41
|
+
"source": true,
|
|
42
|
+
"model": {
|
|
43
|
+
"refId": "B",
|
|
44
|
+
"type": "threshold",
|
|
45
|
+
"expression": "A",
|
|
46
|
+
"conditions": [
|
|
47
|
+
{
|
|
48
|
+
"evaluator": {
|
|
49
|
+
"type": "gt",
|
|
50
|
+
"params": [
|
|
51
|
+
0
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiVersion": "rules.alerting.grafana.app/v1beta1",
|
|
3
|
+
"kind": "AlertRule",
|
|
4
|
+
"metadata": {
|
|
5
|
+
"name": "message-reached-dead-letter-topic",
|
|
6
|
+
"annotations": {
|
|
7
|
+
"grafana.app/folder": "zigordev"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"spec": {
|
|
11
|
+
"title": "A message reached a dead-letter topic",
|
|
12
|
+
"trigger": {
|
|
13
|
+
"interval": "1m"
|
|
14
|
+
},
|
|
15
|
+
"for": "0s",
|
|
16
|
+
"noDataState": "Ok",
|
|
17
|
+
"execErrState": "Error",
|
|
18
|
+
"labels": {
|
|
19
|
+
"severity": "email"
|
|
20
|
+
},
|
|
21
|
+
"annotations": {
|
|
22
|
+
"summary": "{{ $labels.service_name }} set a message from {{ $labels.messaging_destination_name }} aside on its dead-letter topic, with the reason {{ $labels.zigordev_events_reason }}",
|
|
23
|
+
"runbook_url": "https://github.com/zigordev/platform/blob/main/docs/runbooks/message-reached-dead-letter-topic.md",
|
|
24
|
+
"__dashboardUid__": "app",
|
|
25
|
+
"__panelId__": "14"
|
|
26
|
+
},
|
|
27
|
+
"expressions": {
|
|
28
|
+
"A": {
|
|
29
|
+
"datasourceUID": "prometheus",
|
|
30
|
+
"relativeTimeRange": {
|
|
31
|
+
"from": "10m",
|
|
32
|
+
"to": "0s"
|
|
33
|
+
},
|
|
34
|
+
"model": {
|
|
35
|
+
"refId": "A",
|
|
36
|
+
"expr": "sum by (service_name, messaging_destination_name, zigordev_events_reason) (increase(zigordev_events_dead_letters_total[10m])) > 0",
|
|
37
|
+
"instant": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"B": {
|
|
41
|
+
"source": true,
|
|
42
|
+
"model": {
|
|
43
|
+
"refId": "B",
|
|
44
|
+
"type": "threshold",
|
|
45
|
+
"expression": "A",
|
|
46
|
+
"conditions": [
|
|
47
|
+
{
|
|
48
|
+
"evaluator": {
|
|
49
|
+
"type": "gt",
|
|
50
|
+
"params": [
|
|
51
|
+
0
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiVersion": "rules.alerting.grafana.app/v1beta1",
|
|
3
|
+
"kind": "AlertRule",
|
|
4
|
+
"metadata": {
|
|
5
|
+
"name": "messages-are-stuck",
|
|
6
|
+
"annotations": {
|
|
7
|
+
"grafana.app/folder": "zigordev"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"spec": {
|
|
11
|
+
"title": "Messages are stuck",
|
|
12
|
+
"trigger": {
|
|
13
|
+
"interval": "1m"
|
|
14
|
+
},
|
|
15
|
+
"for": "5m",
|
|
16
|
+
"noDataState": "Ok",
|
|
17
|
+
"execErrState": "Error",
|
|
18
|
+
"labels": {
|
|
19
|
+
"severity": "phone"
|
|
20
|
+
},
|
|
21
|
+
"annotations": {
|
|
22
|
+
"summary": "{{ $labels.service_name }} has had messages waiting on {{ $labels.messaging_destination_name }} for 15 minutes, and has handled none of them",
|
|
23
|
+
"runbook_url": "https://github.com/zigordev/platform/blob/main/docs/runbooks/messages-are-stuck.md",
|
|
24
|
+
"__dashboardUid__": "app",
|
|
25
|
+
"__panelId__": "13"
|
|
26
|
+
},
|
|
27
|
+
"expressions": {
|
|
28
|
+
"A": {
|
|
29
|
+
"datasourceUID": "prometheus",
|
|
30
|
+
"relativeTimeRange": {
|
|
31
|
+
"from": "10m",
|
|
32
|
+
"to": "0s"
|
|
33
|
+
},
|
|
34
|
+
"model": {
|
|
35
|
+
"refId": "A",
|
|
36
|
+
"expr": "(max by (service_name, messaging_destination_name, messaging_consumer_group_name) (zigordev_events_consumer_lag) > 0) unless on (service_name, messaging_destination_name, messaging_consumer_group_name) (sum by (service_name, messaging_destination_name, messaging_consumer_group_name) (increase(messaging_client_consumed_messages_total[10m])) > 0)",
|
|
37
|
+
"instant": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"B": {
|
|
41
|
+
"source": true,
|
|
42
|
+
"model": {
|
|
43
|
+
"refId": "B",
|
|
44
|
+
"type": "threshold",
|
|
45
|
+
"expression": "A",
|
|
46
|
+
"conditions": [
|
|
47
|
+
{
|
|
48
|
+
"evaluator": {
|
|
49
|
+
"type": "gt",
|
|
50
|
+
"params": [
|
|
51
|
+
0
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -617,6 +617,105 @@
|
|
|
617
617
|
"refId": "A"
|
|
618
618
|
}
|
|
619
619
|
]
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"type": "row",
|
|
623
|
+
"collapsed": false,
|
|
624
|
+
"id": 0,
|
|
625
|
+
"panels": [],
|
|
626
|
+
"title": "Messages",
|
|
627
|
+
"gridPos": {
|
|
628
|
+
"x": 0,
|
|
629
|
+
"y": 46,
|
|
630
|
+
"h": 1,
|
|
631
|
+
"w": 24
|
|
632
|
+
}
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
"type": "timeseries",
|
|
636
|
+
"transparent": false,
|
|
637
|
+
"repeatDirection": "h",
|
|
638
|
+
"options": {
|
|
639
|
+
"legend": {
|
|
640
|
+
"displayMode": "list",
|
|
641
|
+
"placement": "bottom",
|
|
642
|
+
"showLegend": false,
|
|
643
|
+
"calcs": []
|
|
644
|
+
},
|
|
645
|
+
"tooltip": {
|
|
646
|
+
"mode": "single",
|
|
647
|
+
"sort": "asc"
|
|
648
|
+
}
|
|
649
|
+
},
|
|
650
|
+
"fieldConfig": {
|
|
651
|
+
"defaults": {
|
|
652
|
+
"custom": {},
|
|
653
|
+
"unit": "short"
|
|
654
|
+
},
|
|
655
|
+
"overrides": []
|
|
656
|
+
},
|
|
657
|
+
"id": 13,
|
|
658
|
+
"title": "Messages waiting, by topic",
|
|
659
|
+
"datasource": {
|
|
660
|
+
"type": "prometheus",
|
|
661
|
+
"uid": "prometheus"
|
|
662
|
+
},
|
|
663
|
+
"gridPos": {
|
|
664
|
+
"h": 8,
|
|
665
|
+
"w": 12,
|
|
666
|
+
"x": 0,
|
|
667
|
+
"y": 47
|
|
668
|
+
},
|
|
669
|
+
"targets": [
|
|
670
|
+
{
|
|
671
|
+
"expr": "max by (messaging_destination_name, messaging_consumer_group_name) (zigordev_events_consumer_lag{service_name=\"$app\"})",
|
|
672
|
+
"legendFormat": "{{messaging_destination_name}}",
|
|
673
|
+
"refId": "A"
|
|
674
|
+
}
|
|
675
|
+
]
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
"type": "timeseries",
|
|
679
|
+
"transparent": false,
|
|
680
|
+
"repeatDirection": "h",
|
|
681
|
+
"options": {
|
|
682
|
+
"legend": {
|
|
683
|
+
"displayMode": "list",
|
|
684
|
+
"placement": "bottom",
|
|
685
|
+
"showLegend": false,
|
|
686
|
+
"calcs": []
|
|
687
|
+
},
|
|
688
|
+
"tooltip": {
|
|
689
|
+
"mode": "single",
|
|
690
|
+
"sort": "asc"
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
"fieldConfig": {
|
|
694
|
+
"defaults": {
|
|
695
|
+
"custom": {},
|
|
696
|
+
"unit": "short"
|
|
697
|
+
},
|
|
698
|
+
"overrides": []
|
|
699
|
+
},
|
|
700
|
+
"id": 14,
|
|
701
|
+
"title": "Messages set aside, by topic",
|
|
702
|
+
"datasource": {
|
|
703
|
+
"type": "prometheus",
|
|
704
|
+
"uid": "prometheus"
|
|
705
|
+
},
|
|
706
|
+
"gridPos": {
|
|
707
|
+
"h": 8,
|
|
708
|
+
"w": 12,
|
|
709
|
+
"x": 12,
|
|
710
|
+
"y": 47
|
|
711
|
+
},
|
|
712
|
+
"targets": [
|
|
713
|
+
{
|
|
714
|
+
"expr": "sum by (messaging_destination_name, zigordev_events_reason) (increase(zigordev_events_dead_letters_total{service_name=\"$app\"}[$__rate_interval]))",
|
|
715
|
+
"legendFormat": "{{messaging_destination_name}}, {{zigordev_events_reason}}",
|
|
716
|
+
"refId": "A"
|
|
717
|
+
}
|
|
718
|
+
]
|
|
620
719
|
}
|
|
621
720
|
]
|
|
622
721
|
}
|
|
@@ -645,6 +645,62 @@
|
|
|
645
645
|
"refId": "A"
|
|
646
646
|
}
|
|
647
647
|
]
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
"type": "row",
|
|
651
|
+
"collapsed": false,
|
|
652
|
+
"id": 0,
|
|
653
|
+
"panels": [],
|
|
654
|
+
"title": "Kafka",
|
|
655
|
+
"gridPos": {
|
|
656
|
+
"x": 0,
|
|
657
|
+
"y": 48,
|
|
658
|
+
"h": 1,
|
|
659
|
+
"w": 24
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"type": "timeseries",
|
|
664
|
+
"transparent": false,
|
|
665
|
+
"repeatDirection": "h",
|
|
666
|
+
"options": {
|
|
667
|
+
"legend": {
|
|
668
|
+
"displayMode": "list",
|
|
669
|
+
"placement": "bottom",
|
|
670
|
+
"showLegend": false,
|
|
671
|
+
"calcs": []
|
|
672
|
+
},
|
|
673
|
+
"tooltip": {
|
|
674
|
+
"mode": "single",
|
|
675
|
+
"sort": "asc"
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
"fieldConfig": {
|
|
679
|
+
"defaults": {
|
|
680
|
+
"custom": {},
|
|
681
|
+
"unit": "short"
|
|
682
|
+
},
|
|
683
|
+
"overrides": []
|
|
684
|
+
},
|
|
685
|
+
"id": 14,
|
|
686
|
+
"title": "The broker answers on its port",
|
|
687
|
+
"datasource": {
|
|
688
|
+
"type": "prometheus",
|
|
689
|
+
"uid": "prometheus"
|
|
690
|
+
},
|
|
691
|
+
"gridPos": {
|
|
692
|
+
"h": 8,
|
|
693
|
+
"w": 12,
|
|
694
|
+
"x": 0,
|
|
695
|
+
"y": 49
|
|
696
|
+
},
|
|
697
|
+
"targets": [
|
|
698
|
+
{
|
|
699
|
+
"expr": "max(probe_success{job=\"kafka\"})",
|
|
700
|
+
"legendFormat": "kafka",
|
|
701
|
+
"refId": "A"
|
|
702
|
+
}
|
|
703
|
+
]
|
|
648
704
|
}
|
|
649
705
|
]
|
|
650
706
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zigordev/stack",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "The shared services of the zigordev platform for a laptop: the ingress, the telemetry agent, a local Grafana and a mail catcher, as compose files with one command that starts them",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|