Собрать наблюдаемый стенд, чтобы причину деградации API и worker было видно по метрикам, логам и трассам.

This commit is contained in:
2026-11-07 01:36:19 +03:00
parent 470d9d6f1e
commit 7d4e1237a3
56 changed files with 4419 additions and 53 deletions
+31
View File
@@ -0,0 +1,31 @@
"""Summarize one Tempo trace by id. Prints span names and parent links only."""
import json
import sys
import urllib.request
trace_id = sys.argv[1]
payload = json.load(urllib.request.urlopen(f"http://127.0.0.1:3200/api/traces/{trace_id}", timeout=10))
batches = payload.get("batches") or payload.get("resourceSpans") or []
# Tempo may return OTLP JSON under batches or the classic trace format.
if "trace" in payload:
spans = payload["trace"].get("spans") or []
for span in spans:
print(span.get("name") or span.get("operationName"), span.get("spanID"), span.get("parentSpanID"))
raise SystemExit
def walk(node):
if isinstance(node, dict):
if "name" in node and ("spanId" in node or "span_id" in node):
print(
node.get("name"),
"id=" + str(node.get("spanId") or node.get("span_id")),
"parent=" + str(node.get("parentSpanId") or node.get("parent_span_id") or "-"),
)
for value in node.values():
walk(value)
elif isinstance(node, list):
for item in node:
walk(item)
walk(payload)