Добавить наблюдаемость и проверки отказов для ЛР 6

This commit is contained in:
2026-11-26 18:20:32 +03:00
parent 1d81159dd3
commit 9db37405fb
46 changed files with 7878 additions and 173 deletions
+17 -4
View File
@@ -1,7 +1,20 @@
# Конфигурация наблюдаемости — реализовать
# Диагностика в Grafana
Добавьте `collector.yaml` с OTLP receivers, processors и exporters выбранной версии Collector. Укажите явные bind endpoints, внутренние сети, memory limits/batch и поведение при backpressure по уровню. Сопоставьте все три pipeline с реально развёрнутыми backend.
Откройте [дашборд мессенджера](http://localhost:3000/d/messenger-lab6) за последние 15 минут. Для свежих данных запустите `make test`. Grafana подключает Prometheus, Loki и Tempo через provisioning. Для ручного импорта используйте [JSON дашборда](grafana/dashboards/messenger.json) и [UID источников](grafana/provisioning/datasources/observability.yaml).
Добавьте конфигурации storage, Grafana provisioning/datasources, provisioning/dashboards и импортируемые dashboard JSON. На 4 — alert rules и runbooks. Пустой dashboard или debug exporter, который только печатает данные в stdout, не заменяют хранилища/доказательства из `contracts/observability.md`.
## MessengerQueueLag
Не публикуйте OTLP/metrics/административные ports в общую сеть без необходимости. В lab7 реализуйте TLS/mTLS по trust matrix; экспорт Authorization и message bodies запрещён.
1. Сравните глубину очереди, возраст старейшего задания и занятость worker. Алерт срабатывает, если есть ожидающие задания и возраст старейшего превышает 20 секунд в течение 9 секунд.
2. В Loki найдите `attachment.published` сервиса `messenger-outbox` и скопируйте `trace_id` в Tempo. Если consumer span `attachment.consume` долго отсутствует, проверьте worker командой `docker compose ps worker`.
3. После восстановления проверьте `attachment.ready` в Loki, `db.job.complete` в Tempo и возврат глубины очереди к нулю. В Prometheus правило перейдёт в `inactive`.
## MessengerHighErrorRate
1. Проверьте `messenger:api_errors:ratio1m` и `messenger:api_requests:count1m`. Алерт срабатывает после 12 секунд при доле 5xx выше 5% и как минимум пяти запросах за минуту.
2. Найдите маршрут через `sum by (route) (rate(messenger_http_requests_total{status_class="5xx"}[1m]))`. По `request_id` из `X-Request-Id` найдите лог в Loki. Скопируйте его `trace_id` в Tempo.
3. Сравните `db.pool.acquire` и `db.query`. Долгий `INSERT` при быстром получении соединения указывает на ожидание внутри PostgreSQL. Проверьте панель «Ожидание блокировки сообщений».
4. После восстановления выполните POST сообщения и дождитесь, пока 5xx выйдут из минутного окна. Состояние правила можно прочитать в Prometheus через `/api/v1/rules?type=alert`.
## Отказ Loki
Через Prometheus проверьте `otelcol_exporter_queue_size` и `otelcol_exporter_queue_capacity` для `exporter="otlphttp/loki"`, а также `otelcol_process_memory_rss_bytes`. После восстановления Loki убедитесь, что очередь опустела и новый лог появился. Историю сообщений проверьте через API. Пример измерений и оценка потерь приведены в [отчёте](../../REPORT.md).
+35
View File
@@ -0,0 +1,35 @@
groups:
- name: messenger
rules:
- record: messenger:api_requests:count1m
expr: sum(increase(messenger_http_requests_total{route!="<unmatched>"}[1m]))
- record: messenger:api_errors:ratio1m
expr: |
(sum(increase(messenger_http_requests_total{route!="<unmatched>",status_class="5xx"}[1m]))
or 0 * messenger:api_requests:count1m)
/ (messenger:api_requests:count1m > 0)
- record: messenger:api_availability:ratio30m
expr: |
1 - (
(sum(increase(messenger_http_requests_total{route!="<unmatched>",status_class="5xx"}[30m]))
or 0 * sum(increase(messenger_http_requests_total{route!="<unmatched>"}[30m])))
/ (sum(increase(messenger_http_requests_total{route!="<unmatched>"}[30m])) > 0)
)
- alert: MessengerHighErrorRate
expr: messenger:api_errors:ratio1m > 0.05 and messenger:api_requests:count1m >= 5
for: 12s
labels:
severity: warning
annotations:
summary: "Более 5% бизнес-запросов API вернули 5xx за минуту"
runbook: infra/otel/README.md#messengerhigherrorrate
- alert: MessengerQueueLag
expr: |
max by (queue) (messenger_queue_oldest_age_seconds) > 20
and max by (queue) (messenger_queue_depth) > 0
for: 9s
labels:
severity: warning
annotations:
summary: "В очереди есть задание, которое ждёт более 20 секунд"
runbook: infra/otel/README.md#messengerqueuelag
+70
View File
@@ -0,0 +1,70 @@
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
processors:
memory_limiter:
check_interval: 1s
limit_mib: 160
spike_limit_mib: 32
batch:
timeout: 1s
send_batch_size: 128
send_batch_max_size: 256
exporters:
prometheus:
endpoint: 0.0.0.0:9464
metric_expiration: 25s
enable_open_metrics: true
resource_to_telemetry_conversion:
enabled: true
otlphttp/tempo:
endpoint: http://tempo:4318
timeout: 2s
sending_queue:
enabled: true
num_consumers: 1
queue_size: 8
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 3s
max_elapsed_time: 12s
otlphttp/loki:
endpoint: http://loki:3100/otlp
timeout: 2s
sending_queue:
enabled: true
num_consumers: 1
queue_size: 8
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 3s
max_elapsed_time: 12s
service:
telemetry:
metrics:
readers:
- pull:
exporter:
prometheus:
host: 0.0.0.0
port: 8888
pipelines:
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlphttp/loki]
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlphttp/tempo]
@@ -0,0 +1,890 @@
{
"uid": "messenger-lab6",
"title": "Мессенджер · наблюдаемость",
"description": "Метрики бизнес-API и обработки вложений",
"tags": [
"lab6",
"messenger"
],
"schemaVersion": 40,
"version": 1,
"timezone": "browser",
"editable": true,
"time": {
"from": "now-15m",
"to": "now"
},
"refresh": "5s",
"panels": [
{
"id": 1,
"type": "timeseries",
"title": "Запросы API",
"description": "Бизнес-запросы в секунду. Health и неизвестные маршруты исключены.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 0,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_http_requests_total{route!=\"<unmatched>\"}[$__rate_interval]))",
"legendFormat": "все запросы",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "reqps",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 2,
"type": "timeseries",
"title": "Доля ответов 5xx",
"description": "Доля 5xx от всех бизнес-запросов за 1 минуту. Порог алерта 5%.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 8,
"y": 0,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "messenger:api_errors:ratio1m",
"legendFormat": "5xx / все",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "orange",
"value": 0.05
}
]
},
"custom": {
"thresholdsStyle": {
"mode": "line"
}
}
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 3,
"type": "timeseries",
"title": "Доступность API за 30 минут",
"description": "SLI равен доле ответов без серверной ошибки. Цель 99%.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 16,
"y": 0,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "messenger:api_availability:ratio30m",
"legendFormat": "доступность",
"range": true
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "vector(0.99)",
"legendFormat": "цель",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 4,
"type": "timeseries",
"title": "Длительность запросов API",
"description": "Квантили в секундах по всем API-репликам, включая ошибки.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 8,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_http_request_duration_seconds_bucket{route!=\"<unmatched>\"}[$__rate_interval])))",
"legendFormat": "p50",
"range": true
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_http_request_duration_seconds_bucket{route!=\"<unmatched>\"}[$__rate_interval])))",
"legendFormat": "p95",
"range": true
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_http_request_duration_seconds_bucket{route!=\"<unmatched>\"}[$__rate_interval])))",
"legendFormat": "p99",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 5,
"type": "timeseries",
"title": "Попытки обработки",
"description": "Успешные и ошибочные попытки в секунду. Повтор после сбоя считается новой попыткой.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 8,
"y": 8,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (outcome) (rate(messenger_job_attempts_total[$__rate_interval]))",
"legendFormat": "{{outcome}}",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "suffix: попыток/с",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 6,
"type": "timeseries",
"title": "Длительность обработки",
"description": "Квантили длительности успешных попыток. Ошибочные попытки показаны отдельным p95.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 16,
"y": 8,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket{outcome=\"success\"}[$__rate_interval])))",
"legendFormat": "p50",
"range": true
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket{outcome=\"success\"}[$__rate_interval])))",
"legendFormat": "p95",
"range": true
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket{outcome=\"success\"}[$__rate_interval])))",
"legendFormat": "p99",
"range": true
},
{
"refId": "D",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_job_processing_duration_seconds_bucket{outcome=\"error\"}[$__rate_interval])))",
"legendFormat": "p95 ошибок",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 7,
"type": "timeseries",
"title": "Глубина очереди",
"description": "Количество заданий в состоянии queued, включая запланированные повторы.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 16,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (queue) (messenger_queue_depth)",
"legendFormat": "{{queue}}",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 8,
"type": "timeseries",
"title": "Возраст старейшего задания",
"description": "Секунды с принятия старейшего queued-задания. Порог алерта 20 с.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 8,
"y": 16,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max by (queue) (messenger_queue_oldest_age_seconds)",
"legendFormat": "{{queue}}",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s",
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "orange",
"value": 20
}
]
},
"custom": {
"thresholdsStyle": {
"mode": "line"
}
}
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 9,
"type": "timeseries",
"title": "От принятия до ready",
"description": "Очередь, ожидание повтора и обработка до коммита результата в БД.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 16,
"y": 16,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.5, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[$__rate_interval])))",
"legendFormat": "p50",
"range": true
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.95, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[$__rate_interval])))",
"legendFormat": "p95",
"range": true
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "histogram_quantile(0.99, sum by (le) (rate(messenger_attachment_time_to_ready_seconds_bucket[$__rate_interval])))",
"legendFormat": "p99",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 10,
"type": "timeseries",
"title": "Пулы PostgreSQL",
"description": "Занятые соединения, лимит пула и незавершённые вызовы Acquire.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 24,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "messenger_db_pool_used",
"legendFormat": "занято · {{service_name}} {{service_instance_id}}",
"range": true
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "messenger_db_pool_waiting",
"legendFormat": "запросы к пулу · {{service_name}} {{service_instance_id}}",
"range": true
},
{
"refId": "C",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "messenger_db_pool_capacity",
"legendFormat": "ёмкость · {{service_name}} {{service_instance_id}}",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 11,
"type": "timeseries",
"title": "Загрузка слотов worker",
"description": "Отношение выполняемых задач к числу слотов. Снимок каждые 2 с.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 8,
"y": 24,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(messenger_worker_busy) / sum(messenger_worker_capacity)",
"legendFormat": "занято / всего",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 12,
"type": "timeseries",
"title": "Ожидание блокировки сообщений",
"description": "Число ожидающих блокировку таблицы messages по данным PostgreSQL.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 16,
"y": 24,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "max(messenger_db_messages_lock_waiters)",
"legendFormat": "ожидают",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 13,
"type": "timeseries",
"title": "CPU процессов",
"description": "Потребление CPU API, relay и worker в эквиваленте ядер.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 32,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "rate(messenger_process_cpu_time_seconds_total[$__rate_interval])",
"legendFormat": "{{service_name}} {{service_instance_id}}",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "suffix: ядра",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 14,
"type": "timeseries",
"title": "Память процессов",
"description": "Текущий RSS процессов приложения и Collector, в байтах.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 8,
"y": 32,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "messenger_process_memory_rss_bytes",
"legendFormat": "{{service_name}} {{service_instance_id}}",
"range": true
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "otelcol_process_memory_rss_bytes{job=\"otel-collector\"}",
"legendFormat": "Collector",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "bytes",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 15,
"type": "timeseries",
"title": "Алерты Prometheus",
"description": "В активные периоды значение 1. Статус inactive после восстановления виден в /api/v1/rules.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 16,
"y": 32,
"w": 8,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "ALERTS{alertname=~\"MessengerHighErrorRate|MessengerQueueLag\"}",
"legendFormat": "{{alertname}} · {{alertstate}}",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"min": 0
},
"overrides": []
},
"options": {
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"id": 16,
"type": "logs",
"title": "События API, outbox и worker",
"datasource": {
"type": "loki",
"uid": "loki"
},
"gridPos": {
"x": 0,
"y": 40,
"w": 24,
"h": 9
},
"options": {
"showLabels": false,
"showTime": true,
"enableLogDetails": true,
"dedupStrategy": "none",
"sortOrder": "Descending"
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "loki",
"uid": "loki"
},
"expr": "{service_name=~\"messenger-(api|outbox|worker)\"}",
"queryType": "range",
"maxLines": 100
}
]
}
]
}
@@ -0,0 +1,10 @@
apiVersion: 1
providers:
- name: lab6
orgId: 1
folder: Мессенджер
type: file
updateIntervalSeconds: 10
options:
path: /etc/grafana/dashboards
@@ -0,0 +1,41 @@
apiVersion: 1
datasources:
- name: Prometheus
uid: prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
jsonData:
timeInterval: 3s
- name: Loki
uid: loki
type: loki
access: proxy
url: http://loki:3100
jsonData:
derivedFields:
- name: Trace
matcherType: label
matcherRegex: "^trace_id$"
datasourceUid: tempo
url: '$${__value.raw}'
urlDisplayLabel: "Открыть трассу"
- name: Tempo
uid: tempo
type: tempo
access: proxy
url: http://tempo:3200
jsonData:
tracesToLogsV2:
datasourceUid: loki
spanStartTimeShift: '-1m'
spanEndTimeShift: '1m'
tags:
- key: service.name
value: service_name
customQuery: true
query: '{$$__tags} | trace_id="$${__span.traceId}"'
nodeGraph:
enabled: true
+48
View File
@@ -0,0 +1,48 @@
auth_enabled: false
server:
http_listen_port: 3100
analytics:
reporting_enabled: false
common:
path_prefix: /loki
instance_addr: 127.0.0.1
replication_factor: 1
ring:
kvstore:
store: inmemory
storage:
filesystem:
chunks_directory: /loki/chunks
rules_directory: /loki/rules
schema_config:
configs:
- from: 2024-01-01
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
limits_config:
allow_structured_metadata: true
discover_log_levels: true
retention_period: 168h
distributor:
otlp_config:
default_resource_attributes_as_index_labels: [service.name]
compactor:
working_directory: /loki/compactor
retention_enabled: true
delete_request_store: filesystem
ingester:
wal:
dir: /loki/wal
flush_on_shutdown: true
+15
View File
@@ -0,0 +1,15 @@
global:
scrape_interval: 3s
scrape_timeout: 2s
evaluation_interval: 3s
rule_files: [/etc/prometheus/alerts.yaml]
scrape_configs:
- job_name: messenger
honor_labels: true
static_configs:
- targets: [otel-collector:9464]
- job_name: otel-collector
static_configs:
- targets: [otel-collector:8888]
+26
View File
@@ -0,0 +1,26 @@
server:
http_listen_port: 3200
distributor:
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
ingester:
trace_idle_period: 5s
max_block_duration: 1m
flush_all_on_shutdown: true
compactor:
compaction:
block_retention: 168h
storage:
trace:
backend: local
wal:
path: /var/tempo/wal
local:
path: /var/tempo/blocks