2 · 收集 — Grafana Alloy
k8s 上 DaemonSet · VM 上 systemd unit
multi-tenancy:Alloy 在所有推送蓋上 X-Scope-OrgID: <tenant> — 每個團隊/環境一個 tenant
| 後端 | 端點 |
|---|---|
| Mimir | remote_write :8080 /api/v1/push |
| Tempo | OTLP gRPC :4317 |
| Loki | HTTP :3100 /loki/api/v1/push |
Pipelines
Alloy · metrics pipeline
抓取 Prometheus 目標、套用 relabel,再以 remote_write 送到 Mimir distributors。也接受 OTLP metrics。
- prometheus.scrape 搭配 k8s 服務探索
- prometheus.relabel 在花錢之前先丟掉高基數雜訊
- WAL 保護的 remote_write:重試 + 背壓,重啟不丟資料
| protocol | out: remote_write → mimir distributor :8080 /api/v1/push |
| tenancy | 每條 pipeline 設定 X-Scope-OrgID 標頭 |
Alloy · traces pipeline
接收應用程式 SDK 的 OTLP spans、批次、可選 tail-sampling,再匯出到 Tempo distributors。
- otelcol.receiver.otlp 監聽 :4317(gRPC)/ :4318(HTTP)
- otelcol.processor.batch + 可選 tail_sampling
- otelcol.exporter.otlp → Tempo
| protocol | in: OTLP :4317/:4318 · out: OTLP gRPC → tempo distributor |
| tenancy | 每條 pipeline 設定 X-Scope-OrgID 標頭 |
Alloy · logs pipeline
Tail 容器檔案與 journald、解析/relabel,再推送到 Loki distributors。
- loki.source.kubernetes / .file / .journal
- loki.process:解析、少量加 labels(維持低基數)
- loki.write 帶批次與重試
| protocol | out: HTTP :3100 /loki/api/v1/push (snappy protobuf) |
| tenancy | 每條 pipeline 設定 X-Scope-OrgID 標頭 |