Files
mtusi2026lab6/infra/prometheus/prometheus.yml
T

43 lines
2.0 KiB
YAML

# Prometheus 3.15.1 — хранилище МЕТРИК. Принимает метрики приложения push-ом по OTLP от Collector
# (флаг --web.enable-otlp-receiver, путь /api/v1/otlp/v1/metrics) и сам забирает (pull) служебные
# метрики Collector, Loki и Tempo. Вычисляет recording rules (SLI) и alert rules; состояние алертов
# (pending/firing/resolved) видно на /alerts и через /api/v1/alerts — внешняя доставка не нужна.
# Проверка: promtool check config prometheus.yml
global:
scrape_interval: 15s
scrape_timeout: 5s
evaluation_interval: 15s
# Как имена OTLP переводятся в имена Prometheus (фиксируем явно, чтобы dashboard не сломался при
# смене значения по умолчанию): точки -> подчёркивания, суффиксы единиц и _total.
# http.server.request.duration (s, histogram) -> http_server_request_duration_seconds_{bucket,sum,count}
# атрибут http.route -> метка http_route; service.name -> job; service.instance.id -> instance.
otlp:
translation_strategy: UnderscoreEscapingWithSuffixes
storage:
tsdb:
# Collector после недоступности Prometheus дошлёт пакеты из очереди с прошлыми временными метками.
out_of_order_time_window: 10m
rule_files:
- /etc/prometheus/rules/*.yml
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ["localhost:9090"]
# Собственные метрики Collector: принято/отправлено/отброшено по сигналам, очереди, RSS.
- job_name: otel-collector
static_configs:
- targets: ["otel-collector:8888"]
- job_name: loki
static_configs:
- targets: ["loki:3100"]
- job_name: tempo
static_configs:
- targets: ["tempo:3200"]