Logging

Trace with zipkin or jaegger.

class blacksmith.middleware._async.zipkin.AbstractTraceContext(name: str, kind: str = 'SERVER')

Interface of the trace context for the middleware.

See examples with starlette-zipking for an implementation.

abstractmethod classmethod make_headers() dict[str, str]

Build headers for the sub requests.

abstractmethod tag(key: str, value: str) AbstractTraceContext

Tag the span

abstractmethod annotate(value: str | None, ts: float | None = None) AbstractTraceContext

Annotate the span

abstractmethod __enter__() AbstractTraceContext

Make the created trace span of the current context the active span.

abstractmethod __exit__(*exc: Any) None

Ends the created trace span of the context, it parents become the active span.

class blacksmith.middleware._async.zipkin.AsyncZipkinMiddleware(trace: type[AbstractTraceContext])

Zipkin Middleware based on an abstract context manager.

Parameters:

trace – A deferred context manager that manage the trace span stack.

__call__(next: AsyncMiddleware) AsyncMiddleware

Call self as a function.