# OTel Collector, Prometheus Remote-Write, Loki/Tempo Dashboards **Date:** 2026-06-16 **Branch:** `main` **Author:** Kimi Code **Status:** DEPLOYED — collector running, metrics flowing, dashboards imported --- ## What was done 1. **Enabled Prometheus remote-write receiver** on the FetcherPay Prometheus Deployment in namespace `fetcherpay`. 2. **Finalized the OpenTelemetry Collector** manifest in namespace `observability`: - Receivers: OTLP (gRPC/HTTP), Jaeger, Zipkin, Prometheus self-scrape - Processors: batch, resource tag `cluster=art0` - Exporters: - `otlp_grpc/tempo` → Tempo - `otlp_http/loki` → Loki - `prometheus_remote_write` → FetcherPay Prometheus 3. **Imported Grafana dashboards** from grafana.com and renamed them: - Loki Operational (`/d/MQHVDmtWk/loki-operational`) - Tempo Operational (`/d/5BcHdkRgz/tempo-operational`) 4. **Added Redis monitoring** — deployed `redis-exporter` and added a scrape job to FetcherPay Prometheus. 5. **Recovered Grafana** after it got stuck in `ContainerCreating` with repeated `SandboxChanged` events — force-deleted the pod and the Deployment recreated it. --- ## Files changed / created ### New - `monitoring/opentelemetry-collector.yaml` — full collector Deployment + ConfigMap + Service - `monitoring/prometheus-deployment.yaml` — FetcherPay Prometheus Deployment with `--web.enable-remote-write-receiver` ### Existing (deployed earlier, not modified in this session) - `monitoring/prometheus-config.yaml` — scrape configs - `monitoring/blackbox-exporter.yaml` - `monitoring/mysql-exporter.yaml` - `monitoring/redis-exporter.yaml` — Redis exporter + Service - `monitoring/grafana-deployment.yaml` - `monitoring/alertmanager-config.yaml` --- ## Deploy commands ```bash # Apply the collector and Prometheus manifests microk8s kubectl apply -f monitoring/opentelemetry-collector.yaml microk8s kubectl apply -f monitoring/prometheus-deployment.yaml # Restart collector to pick up config changes microk8s kubectl rollout restart deployment/otel-collector -n observability microk8s kubectl rollout status deployment/otel-collector -n observability --timeout=120s # Verify Prometheus rolled out with the new flag microk8s kubectl get deployment prometheus -n fetcherpay -o jsonpath='{.spec.template.spec.containers[0].args}' # Expected: includes "--web.enable-remote-write-receiver" ``` --- ## Verification ### Collector is running ```bash microk8s kubectl get pods -n observability -l app=otel-collector # Expected: 1/1 Running ``` ### Metrics are arriving in FetcherPay Prometheus ```bash # OTel collector metrics curl -u admin:admin_secure_2024 \ 'https://dashboard.fetcherpay.com/api/datasources/proxy/uid/ffpaxh13af2f4e/api/v1/query?query=otelcol_process_uptime_total' # Expected: non-empty result set with job="otelcol-contrib" # Redis metrics curl -u admin:admin_secure_2024 \ 'https://dashboard.fetcherpay.com/api/datasources/proxy/uid/ffpaxh13af2f4e/api/v1/query?query=redis_up' # Expected: 1 result with instance="redis-fetcherpay" ``` ### Health overview dashboard A comprehensive Grafana dashboard was created: **URL:** https://dashboard.fetcherpay.com/d/fetcherpay-health-overview/fetcherpay-squaremcp-e28094-health-overview It includes sections for: - **Websites** — all 18 HTTPS endpoints, healthy %, response time, SSL expiry days - **Kubernetes** — pod running ratio, pod status by namespace, node CPU/memory/disk, container restarts, ingress controller restarts - **Databases & caches** — MySQL and Redis up/connections/memory/slow queries/hit ratio - **Infrastructure & observability** — Prometheus, OTel collector, Blackbox exporter, node network, OTel throughput ### All-servers dashboard query Use this PromQL in a Grafana **Table** panel to see every monitored service/endpoint and its up/down state: ```promql # Infrastructure services (1 = up, 0 = down) up{job=~"mysql|redis|node-exporter|kube-state-metrics|prometheus|otel-collector"} ``` And a second query for HTTPS endpoints: ```promql # HTTPS endpoints (1 = reachable 2xx, 0 = failing) probe_success{job="blackbox-http"} ``` For a single merged table, use: ```promql label_replace( up{job=~"mysql|redis|node-exporter|kube-state-metrics|prometheus|otel-collector"}, "server", "$1", "instance", "(.+)" ) or label_replace( probe_success{job="blackbox-http"}, "server", "$1", "instance", "(.+)" ) ``` Observed at commit time: - `otelcol_process_uptime_total` count: **2** - `/api/v1/write` HTTP codes: `200`, `400` (one corrupt probe), `204` (successful remote writes) ### Dashboards are accessible - **Loki Operational:** https://dashboard.fetcherpay.com/d/MQHVDmtWk/loki-operational - **Tempo Operational:** https://dashboard.fetcherpay.com/d/5BcHdkRgz/tempo-operational --- ## Component endpoints | Component | Namespace | Endpoint | |-----------|-----------|----------| | OTel Collector OTLP gRPC | `observability` | `otel-collector.observability:4317` | | OTel Collector OTLP HTTP | `observability` | `otel-collector.observability:4318` | | OTel Collector Jaeger gRPC | `observability` | `otel-collector.observability:14250` | | OTel Collector Jaeger HTTP | `observability` | `otel-collector.observability:14268` | | OTel Collector Zipkin | `observability` | `otel-collector.observability:9411` | | OTel Collector metrics | `observability` | `otel-collector.observability:8888` | | FetcherPay Prometheus | `fetcherpay` | `prometheus.fetcherpay:9090` | | Redis | `fetcherpay` | `redis.fetcherpay:6379` | | Redis Exporter | `fetcherpay` | `redis-exporter.fetcherpay:9121` | | Tempo | `observability` | `tempo.observability:4317` | | Loki | `observability` | `loki.observability:3100` | --- ## Notes / caveats - The collector image is pinned to `otel/opentelemetry-collector-contrib:latest`. For reproducibility, consider pinning to a specific version tag. - Direct `kubectl exec`, `port-forward`, and `logs` sometimes fail with a kubelet TLS certificate error (`x509: certificate valid for ... not 104.190.60.129`). Workarounds used during this session: - `kubectl logs --insecure-skip-tls-verify-backend=true` - `kubectl proxy` + service proxy URLs for HTTP health checks - Grafana recovered from a `SandboxChanged` loop by force-deleting the stuck pod. If this recurs, investigate node-level sandbox/CRI-o stability. --- ## Open items (not addressed in this session) 1. **nginx-ingress-controller** has ~309 restarts over 269 days and recently triggered `SandboxChanged` transient outage. 2. **`hermes.fetcherpay.com`** and **`ollama.fetcherpay.com`** are not configured in ingress/Traefik. 3. **`hermes.squaremcp.com` root path** returns 404 — API routes work, but there is no root handler. --- ## Related vault docs - Phase 1 Communications deploy handoff: `SquareMCP/deployments/2026-06-15-phase1-communications-deploy-handoff.md` - Architecture: `hermes-mcp/ARCHITECTURE.md` --- ## Changelog | Date | Author | Note | |------|--------|------| | 2026-06-16 | Kimi Code | Initial handoff — OTel collector remote-write fixed, Loki/Tempo dashboards imported | --- ## Why some services show unhealthy ### `fetcherpay-leads-api` and `fetcherpay-leads-worker` — `ImagePullBackOff` **Root cause:** stale image references, not deployment activity. - `leads-api` tries to pull `23.120.207.35:32000/fetcherpay/leads-api:latest` - `leads-worker` tries to pull `23.120.207.35:32000/fetcherpay/leads-api:v16-import-fix` The old registry IP `23.120.207.35:32000` no longer responds (i/o timeout). The current MicroK8s registry is `localhost:32000`, and `fetcherpay/leads-api:latest` exists there, but `v16-import-fix` does not. **Expectation:** these pods will stay broken forever with no new deployments. They require either: 1. Update image references to `localhost:32000/fetcherpay/leads-api:latest` (and pick a valid tag for the worker), or 2. Delete the Deployments if the leads feature is no longer used. ### `nginx-ingress-microk8s-controller` — 314 restarts **Root cause:** chronic instability, most likely resource pressure / OOM / node-level sandbox issues. - 314 restarts over ~269 days ≈ 1.17 restarts/day - Pod is currently Running/Ready; no recent exit state stored - Liveness/readiness probes are on `:10254/healthz` This is not caused by application deployments. The ingress controller runs in `hostNetwork` mode and restarts independently of app deploys. Likely contributors on this single-node MicroK8s setup: - Memory limits / OOMKilled during traffic spikes - containerd/CRI-o sandbox churn (the same `SandboxChanged` pattern seen with Grafana) - Calico/network hiccups **Expectation:** restarts will likely continue slowly even with zero deployments. To reduce them, investigate node resources and consider giving the ingress controller a memory limit/request and checking `dmesg`/kernel OOM logs. ### Bottom line Deployments are not making these unhealthy. The dashboard is correctly surfacing two long-standing issues: - Abandoned image references (`fetcherpay-leads-*`) - Chronic ingress-controller instability on the single-node cluster --- ## Runbooks Detailed operational documentation for the observability stack has been added to: `SquareMCP/runbooks/observability/` | File | What it covers | |------|----------------| | `00-index.md` | Overview, quick links, datasource UIDs, status commands | | `01-monitoring-architecture.md` | What monitors what, namespaces, manifests, data flow | | `02-dashboards-and-queries.md` | Dashboard list + reusable PromQL queries | | `03-api-reference.md` | Prometheus/Loki/Tempo/Grafana/Alertmanager API examples | | `04-alerts-and-response.md` | Alert routes, response steps, decision tree | | `05-ai-agent-guide.md` | How AI agents should use and update the stack | | `06-human-guide.md` | Day-to-day Grafana usage for humans | | `07-known-issues.md` | Pre-existing issues (leads ImagePullBackOff, nginx restarts, MT5 ports) | These runbooks include everything needed for targeted searches by humans and AI agents.