OpenTelemetry: datasette.client 请求开始一个新的追踪,而不是嵌套在调用者的 Span 中
作者: asg017创建于 2026年9月28日更新于 2026年9月28日
datasette/telemetry.py:252, in TelemetryMiddleware.__call__:
context = extract(headers, getter=_HEADERS_GETTER)
with tracer.start_as_current_span(method, context=context, kind=SpanKind.SERVER):- When
extract()gets nocontext=, it starts from an emptyContext(). With notraceparentheader, which is always the case fordatasette.clientcalls, it returns that empty context. - Passing that context explicitly to
start_as_current_spanmakes the span a new root. - The caller's span is still current in contextvars at this point. The
_in_datasette_clientflag read a
内容来源: simonw/datasette