Bound Tempo blocks and complete telemetry diagnostics
This commit is contained in:
@@ -34,6 +34,7 @@ services:
|
|||||||
|
|
||||||
tempo:
|
tempo:
|
||||||
image: grafana/tempo:2.9.5
|
image: grafana/tempo:2.9.5
|
||||||
|
mem_limit: 768m
|
||||||
command: ["-config.file=/etc/tempo/config.yaml"]
|
command: ["-config.file=/etc/tempo/config.yaml"]
|
||||||
volumes:
|
volumes:
|
||||||
- ./infra/tempo/config.yaml:/etc/tempo/config.yaml:ro
|
- ./infra/tempo/config.yaml:/etc/tempo/config.yaml:ro
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
"expr": "sum(rate(messenger_http_requests_total{status_class=\"5xx\",route!~\"/health/.*\"}[1m])) / clamp_min(sum(rate(messenger_http_requests_total{route!~\"/health/.*\"}[1m])),0.001)",
|
"expr": "(sum(rate(messenger_http_requests_total{status_class=\"5xx\",route!~\"/health/.*\"}[1m])) or vector(0)) / clamp_min(sum(rate(messenger_http_requests_total{route!~\"/health/.*\"}[1m])),0.001)",
|
||||||
"legendFormat": "series 1"
|
"legendFormat": "series 1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -519,17 +519,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"refId": "B",
|
"refId": "B",
|
||||||
"expr": "sum(rate(otelcol_exporter_send_failed_metric_points_total[1m]))",
|
"expr": "sum(rate(otelcol_exporter_send_failed_metric_points[1m]))",
|
||||||
"legendFormat": "series 2"
|
"legendFormat": "series 2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"refId": "C",
|
"refId": "C",
|
||||||
"expr": "sum(rate(otelcol_exporter_send_failed_log_records_total[1m]))",
|
"expr": "sum(rate(otelcol_exporter_send_failed_log_records[1m]))",
|
||||||
"legendFormat": "series 3"
|
"legendFormat": "series 3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"refId": "D",
|
"refId": "D",
|
||||||
"expr": "sum(rate(otelcol_exporter_send_failed_spans_total[1m]))",
|
"expr": "sum(rate(otelcol_exporter_send_failed_spans[1m]))",
|
||||||
"legendFormat": "series 4"
|
"legendFormat": "series 4"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -587,6 +587,20 @@
|
|||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 56
|
"y": 56
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 16,
|
||||||
|
"type": "timeseries",
|
||||||
|
"title": "HTTP 4xx RPS (client responses)",
|
||||||
|
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
||||||
|
"targets": [{
|
||||||
|
"refId": "A",
|
||||||
|
"expr": "sum(rate(messenger_http_requests_total{status_class=\"4xx\",route!~\"/health/.*\"}[1m])) or vector(0)",
|
||||||
|
"legendFormat": "4xx"
|
||||||
|
}],
|
||||||
|
"fieldConfig": {"defaults": {"unit": "reqps", "min": 0}, "overrides": []},
|
||||||
|
"options": {"legend": {"displayMode": "list", "placement": "bottom"}},
|
||||||
|
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 56}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ distributor:
|
|||||||
grpc:
|
grpc:
|
||||||
endpoint: 0.0.0.0:4317
|
endpoint: 0.0.0.0:4317
|
||||||
|
|
||||||
|
ingester:
|
||||||
|
max_block_bytes: 5000000
|
||||||
|
max_block_duration: 1m
|
||||||
|
concurrent_flushes: 1
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
trace:
|
trace:
|
||||||
backend: local
|
backend: local
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ QUERIES = {
|
|||||||
"http_5xx_ratio_30s": 'sum(rate(messenger_http_requests_total{status_class="5xx",route!~"/health/.*"}[30s])) / clamp_min(sum(rate(messenger_http_requests_total{route!~"/health/.*"}[30s])),0.001)',
|
"http_5xx_ratio_30s": 'sum(rate(messenger_http_requests_total{status_class="5xx",route!~"/health/.*"}[30s])) / clamp_min(sum(rate(messenger_http_requests_total{route!~"/health/.*"}[30s])),0.001)',
|
||||||
"queue_oldest_seconds": 'max(messenger_queue_oldest_age_seconds{queue_name="attachments.process"})',
|
"queue_oldest_seconds": 'max(messenger_queue_oldest_age_seconds{queue_name="attachments.process"})',
|
||||||
"ready_slow_ratio_30s": '(sum(rate(messenger_attachments_ready_duration_seconds_count[30s])) - sum(rate(messenger_attachments_ready_duration_seconds_bucket{le="5"}[30s]))) / clamp_min(sum(rate(messenger_attachments_ready_duration_seconds_count[30s])),0.001)',
|
"ready_slow_ratio_30s": '(sum(rate(messenger_attachments_ready_duration_seconds_count[30s])) - sum(rate(messenger_attachments_ready_duration_seconds_bucket{le="5"}[30s]))) / clamp_min(sum(rate(messenger_attachments_ready_duration_seconds_count[30s])),0.001)',
|
||||||
"collector_failed_spans": 'sum(otelcol_exporter_send_failed_spans_total)',
|
"collector_failed_spans": 'sum(otelcol_exporter_send_failed_spans)',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+11
-5
@@ -14,6 +14,8 @@ import psycopg
|
|||||||
from argon2 import PasswordHasher
|
from argon2 import PasswordHasher
|
||||||
from argon2.exceptions import InvalidHashError, VerificationError
|
from argon2.exceptions import InvalidHashError, VerificationError
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
|
from opentelemetry import trace
|
||||||
|
from opentelemetry.trace import Status, StatusCode
|
||||||
from psycopg.errors import UniqueViolation
|
from psycopg.errors import UniqueViolation
|
||||||
from psycopg_pool import PoolTimeout
|
from psycopg_pool import PoolTimeout
|
||||||
|
|
||||||
@@ -21,6 +23,7 @@ from . import db
|
|||||||
from .auth import BASIC_CHALLENGE, BEARER_CHALLENGE, token_hash, unauthorized
|
from .auth import BASIC_CHALLENGE, BEARER_CHALLENGE, token_hash, unauthorized
|
||||||
|
|
||||||
password_hasher = PasswordHasher()
|
password_hasher = PasswordHasher()
|
||||||
|
tracer = trace.get_tracer(__name__)
|
||||||
|
|
||||||
|
|
||||||
def timestamp(value: datetime) -> str:
|
def timestamp(value: datetime) -> str:
|
||||||
@@ -53,11 +56,14 @@ def decode_cursor(cursor: str | None, resource: str) -> tuple[datetime, UUID] |
|
|||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def connection():
|
def connection():
|
||||||
try:
|
with tracer.start_as_current_span("db.store", record_exception=False, set_status_on_exception=False) as span:
|
||||||
with db.pool().connection() as conn:
|
span.set_attribute("db.system.name", "postgresql")
|
||||||
yield conn
|
try:
|
||||||
except (psycopg.Error, PoolTimeout, OSError):
|
with db.pool().connection() as conn:
|
||||||
raise HTTPException(503) from None
|
yield conn
|
||||||
|
except (psycopg.Error, PoolTimeout, OSError):
|
||||||
|
span.set_status(Status(StatusCode.ERROR))
|
||||||
|
raise HTTPException(503) from None
|
||||||
|
|
||||||
|
|
||||||
def user_view(row: dict) -> dict:
|
def user_view(row: dict) -> dict:
|
||||||
|
|||||||
Reference in New Issue
Block a user