perf: LoggerProvider bridge — inject trace_id into stdlib logging #206
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement
src/perf/_logs.pyfor correlated logs.Tasks
logging.Filterthat injectstrace_idandspan_idfrom current OTel context into log recordsattach_trace_filter()utility to wire into existing loggerstrace_idfrom log linesComplete. Created
src/perf/_logs.pywith:TraceContextFilter— injects trace_id + span_id into stdlib log recordsTraceContextFormatter— includes trace context in formatted outputattach_trace_filter()/detach_trace_filter()— idempotent attach/detach6 tests in
test_logs.py:Promtail can parse trace_id from log lines for Loki correlation.
✅ 6/6 passed, lint clean.