feat(observability): add product metrics for API, outbox and delivery

This commit is contained in:
shira committed 2026-10-06 19:48:15 +03:00
1 parent 560724e2aa
commit 94488e2b57
51 files changed
+3655 -68

No files matched your search

+6 -2
View File
@@ -7,7 +7,7 @@ PROMETHEUS_IMAGE := prom/prometheus:latest
LOKI_IMAGE := grafana/loki:latest
ALLOY_FILE := $(ROOT)/observability/alloy/app.alloy
.PHONY: help fmt fmt-check check
.PHONY: help fmt fmt-check check verify-product-metrics
help: ## Show observability commands
@awk 'BEGIN {FS = ":.*## "} /^[a-zA-Z0-9_-]+:.*## / {printf "%-18s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@@ -22,8 +22,12 @@ fmt-check: ## Check Alloy formatting and dashboard JSON formatting
diff -u "$(ALLOY_FILE)" "$$tmp"
@python3 -c 'import json, pathlib, sys; bad=[]; root=pathlib.Path("$(ROOT)/observability/grafana/dashboards"); paths=sorted(root.glob("*.json")); [(bad.append(str(p)) if p.read_text() != json.dumps(json.loads(p.read_text()), indent=2) + "\n" else None) for p in paths]; print("dashboard formatting is clean" if not bad else "dashboard JSON formatting differs: " + ", ".join(bad)); sys.exit(bool(bad))'
check: fmt-check ## Validate Prometheus, Loki, Alloy, and dashboard files
check: fmt-check ## Validate Prometheus config and alert rules, Loki, Alloy, and dashboard files
$(DOCKER) run --rm --entrypoint /bin/promtool -v "$(ROOT)/observability/prometheus:/etc/prometheus:ro" "$(PROMETHEUS_IMAGE)" check config /etc/prometheus/prometheus.yml
$(DOCKER) run --rm --entrypoint /bin/promtool -v "$(ROOT)/observability/prometheus:/etc/prometheus:ro" "$(PROMETHEUS_IMAGE)" test rules /etc/prometheus/tests/lincodex_rules_test.yml
$(DOCKER) run --rm -v "$(ROOT)/observability/loki:/etc/loki:ro" "$(LOKI_IMAGE)" -config.file=/etc/loki/loki.yml -verify-config
$(DOCKER) run --rm -v "$(ROOT)/observability/alloy:/etc/alloy:ro" "$(ALLOY_IMAGE)" validate /etc/alloy/app.alloy
@python3 -c 'import json, pathlib; files=sorted(pathlib.Path("$(ROOT)/observability/grafana/dashboards").glob("*.json")); [json.loads(path.read_text()) for path in files]; assert files, "no Grafana dashboards found"; print(f"validated {len(files)} dashboard JSON file(s)")'
verify-product-metrics: ## Start isolated core and monitoring stacks, check the product metrics, dashboard, and log privacy, then remove them
@bash "$(ROOT)/observability/scripts/verify-product-metrics.sh"