mirror of
https://github.com/simonw/datasette.git
synced 2026-09-03 15:14:08 +02:00
Apply black to the OTLP demo receiver
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F2h9ANGZ7paWSpqs5DUAcG
This commit is contained in:
parent
4a97e577b8
commit
76893cb8d3
1 changed files with 10 additions and 3 deletions
|
|
@ -43,7 +43,9 @@ try:
|
|||
ExportTraceServiceResponse,
|
||||
)
|
||||
except ImportError:
|
||||
sys.exit("This receiver needs the OpenTelemetry protobuf definitions:\n uv run --with opentelemetry-proto python demos/otel/otlp_receiver.py")
|
||||
sys.exit(
|
||||
"This receiver needs the OpenTelemetry protobuf definitions:\n uv run --with opentelemetry-proto python demos/otel/otlp_receiver.py"
|
||||
)
|
||||
|
||||
HOST = "127.0.0.1"
|
||||
PORT = 4318
|
||||
|
|
@ -97,8 +99,13 @@ class OTLPHandler(BaseHTTPRequestHandler):
|
|||
{
|
||||
"name": span.name,
|
||||
"parent_id": span.parent_span_id.hex() or None,
|
||||
"duration_ms": (span.end_time_unix_nano - span.start_time_unix_nano) / 1e6,
|
||||
"attributes": {a.key: attribute_value(a.value) for a in span.attributes},
|
||||
"duration_ms": (
|
||||
span.end_time_unix_nano - span.start_time_unix_nano
|
||||
)
|
||||
/ 1e6,
|
||||
"attributes": {
|
||||
a.key: attribute_value(a.value) for a in span.attributes
|
||||
},
|
||||
}
|
||||
)
|
||||
# flush=True so the live feedback survives being piped or redirected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue