Files
mtusi2026lab7/infra/prometheus/prometheus.yml
T
2026-11-08 00:33:25 +03:00

55 lines
2.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Prometheus 3.7.3 стенда lab7 — хранилище МЕТРИК.
#
# С lab7 весь HTTP Prometheus — только mTLS с allowlist identity (web.yml): otel-collector, grafana, prometheus.
#
# Метрики приложения приходят push-ом по OTLP от Collector (флаг --web.enable-otlp-receiver
# в compose.yaml). Имена переводятся в стиль Prometheus: точки -> «_», единица -> суффикс
# (http.server.request.duration [s] -> http_server_request_duration_seconds_bucket/_sum/_count),
# service.name -> label job, service.instance.id -> label instance.
# Сам Prometheus опрашивает (scrape) только собственные метрики Collector (:8888) и балансировщик
# (lb:8404/metrics — ответы клиентам, включая 503 самого HAProxy, когда нет готовой реплики).
# Здесь же вычисляются alert rules (rules/alerts.yml): состояние pending/firing/resolved видно
# на http://127.0.0.1:9090/alerts и в Grafana. Отправки наружу (Alertmanager) нет — не требуется.
global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
- /etc/prometheus/rules/*.yml
scrape_configs:
# Собственные счётчики Collector: только чтение, внутренняя сеть telemetry (scrape-канал, см. REPORT.md).
- job_name: otel-collector
static_configs:
- targets: ["otel-collector:8888"]
# Балансировщик: по TLS, сертификат lb проверяется нашим CA и именем lb.
- job_name: haproxy
scheme: https
tls_config:
ca_file: /run/ca/ca.crt
server_name: lb
static_configs:
- targets: ["lb:8404"]
# Сам Prometheus: mTLS своим сертификатом (identity prometheus разрешена в web.yml).
- job_name: prometheus
scheme: https
tls_config:
ca_file: /run/ca/ca.crt
cert_file: /run/tls/tls.crt
key_file: /run/tls/tls.key
server_name: prometheus
static_configs:
- targets: ["127.0.0.1:9090"]
otlp:
# Ресурсные атрибуты, которые станут labels всех метрик (остальные — в серии target_info).
promote_resource_attributes:
- service.version
- deployment.environment.name
storage:
tsdb:
# Пачки OTLP от разных процессов приходят не строго по времени: принимаем опоздания до 30 мин.
out_of_order_time_window: 30m