- Add ServiceMonitors for Traefik, ArgoCD, and Longhorn - Enable cert-manager ServiceMonitor via helm values - Deploy Grafana Tempo for distributed tracing (single-binary, Longhorn PVC) - Add Tempo datasource with trace-to-logs and trace-to-metrics correlation - Instrument API with OpenTelemetry SDK (Prometheus metrics + OTLP traces) - Replace console.log with pino structured logging + pino-http middleware - Add Grafana dashboards for Traefik, API overview, and PostgreSQL (CNPG)
82 lines
2.2 KiB
YAML
82 lines
2.2 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: postgres-dashboard
|
|
namespace: observability
|
|
labels:
|
|
grafana_dashboard: "1"
|
|
data:
|
|
postgres.json: |
|
|
{
|
|
"annotations": { "list": [] },
|
|
"editable": true,
|
|
"graphTooltip": 1,
|
|
"id": null,
|
|
"links": [],
|
|
"panels": [
|
|
{
|
|
"title": "Active Connections",
|
|
"type": "timeseries",
|
|
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 },
|
|
"targets": [
|
|
{
|
|
"expr": "cnpg_backends_total",
|
|
"legendFormat": "{{ pod }}"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"title": "Transactions per Second",
|
|
"type": "timeseries",
|
|
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 0 },
|
|
"targets": [
|
|
{
|
|
"expr": "rate(cnpg_pg_stat_database_xact_commit{datname=\"homelab\"}[5m])",
|
|
"legendFormat": "commits {{ pod }}"
|
|
},
|
|
{
|
|
"expr": "rate(cnpg_pg_stat_database_xact_rollback{datname=\"homelab\"}[5m])",
|
|
"legendFormat": "rollbacks {{ pod }}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": { "unit": "ops" }
|
|
}
|
|
},
|
|
{
|
|
"title": "Replication Lag (bytes)",
|
|
"type": "timeseries",
|
|
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 },
|
|
"targets": [
|
|
{
|
|
"expr": "cnpg_pg_replication_lag",
|
|
"legendFormat": "{{ pod }}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": { "unit": "bytes" }
|
|
}
|
|
},
|
|
{
|
|
"title": "Database Size",
|
|
"type": "stat",
|
|
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 },
|
|
"targets": [
|
|
{
|
|
"expr": "cnpg_pg_database_size_bytes{datname=\"homelab\"}",
|
|
"legendFormat": "{{ pod }}"
|
|
}
|
|
],
|
|
"fieldConfig": {
|
|
"defaults": { "unit": "bytes" }
|
|
}
|
|
}
|
|
],
|
|
"schemaVersion": 39,
|
|
"tags": ["homelab", "postgres", "cnpg"],
|
|
"templating": { "list": [] },
|
|
"time": { "from": "now-6h", "to": "now" },
|
|
"title": "PostgreSQL (CloudNativePG)",
|
|
"uid": "postgres-cnpg"
|
|
}
|