Files
mtusi2026lab7/infra/prometheus/prometheus.yml
T

47 lines
1.9 KiB
YAML

# Prometheus 3.16 (prom/prometheus:v3.16.0), labs 6-7: the METRICS store.
#
# Application metrics AND the Collector's own metrics are PUSHED by the Collector over OTLP/HTTPS
# (flag --web.enable-otlp-receiver, endpoint /api/v1/otlp/v1/metrics). Prometheus derives
# `job` = service.name and `instance` = service.instance.id from the OTLP resource, and translates
# the OTel names with suffixes: http.server.request.duration (unit s) ->
# http_server_request_duration_seconds_bucket (mapping: docs/OBSERVABILITY.md).
#
# Lab 7: the web listener is HTTPS with a REQUIRED client certificate of the internal CA and a SAN
# allowlist (web-config.yml): only otel-collector (push), grafana (queries) and prometheus itself
# (self-scrape, promtool healthcheck) get in. Scrapes of Loki/Tempo use HTTPS + this server's
# own client certificate (they require one too).
global:
scrape_interval: 15s
evaluation_interval: 15s # alert rules: detection delay = condition + `for` + <= 15 s
otlp:
# deployment.environment.name=lab as a label on every series (low cardinality, one value).
promote_resource_attributes: [deployment.environment.name, service.version]
keep_identifying_resource_attributes: true
storage:
tsdb:
# OTLP pushes from several processes arrive slightly out of order; accept 10 min of it.
out_of_order_time_window: 10m
rule_files:
- /etc/prometheus/rules/*.yml
scrape_configs:
- job_name: prometheus
scheme: https
tls_config: &mtls
ca_file: /run/secrets/internal-ca.crt
cert_file: /run/secrets/prometheus.crt
key_file: /run/secrets/prometheus.key
min_version: TLS12
static_configs: [{targets: ["localhost:9090"]}]
- job_name: loki
scheme: https
tls_config: *mtls
static_configs: [{targets: ["loki:3100"]}]
- job_name: tempo
scheme: https
tls_config: *mtls
static_configs: [{targets: ["tempo:3200"]}]