from __future__ import annotations import html import json from typing import Any def _json_script_payload(data: Any) -> str: """Embed JSON in a script tag without breaking JSON.parse.""" return json.dumps(data, ensure_ascii=False).replace("", "<\\/") def render_trace_dashboard( *, service_name: str, stats: dict[str, Any], traces: list[dict[str, Any]], ) -> str: stats_json = _json_script_payload(stats) traces_json = _json_script_payload(traces) title = html.escape(service_name) return f"""
OpenTelemetry traces · in-memory store