Follow-up to #6227 (ENG-9166), split out of the reflex-otel stack (#6899 β #6900 β #6901) because it depends on the logging pipeline (#6863).
What
When OpenTelemetry tracing is enabled (reflex_base.otel.enabled), every framework log record emitted inside an active span should carry the W3C ids so a log line can be looked up in the tracing UI and vice-versa:
JsonHandler.emit (reflex_base/utils/log.py) adds trace_id (32 hex) and span_id (16 hex) to the payload when trace.get_current_span().get_span_context().is_valid.
- Add
reflex_otel to PACKAGE_LOGGER_NAMES so its records join the reflex logger hierarchy.
- Optional: the same fields on the rich console/file formatter in debug mode.
The helper existed as otel.trace_fields() in an earlier revision of #6900 (removed when decoupling); the JsonHandler hunk is ~6 lines plus a test in tests/units/reflex_base/utils/test_log.py (test_json_mode_adds_trace_ids).
Blocked by
Docs
Add a "Logs" section to docs/api-reference/observability.md: with REFLEX_LOG_JSON=true, records inside a span carry trace_id/span_id; user loggers can use opentelemetry-instrumentation-logging.
Follow-up to #6227 (ENG-9166), split out of the reflex-otel stack (#6899 β #6900 β #6901) because it depends on the logging pipeline (#6863).
What
When OpenTelemetry tracing is enabled (
reflex_base.otel.enabled), every framework log record emitted inside an active span should carry the W3C ids so a log line can be looked up in the tracing UI and vice-versa:JsonHandler.emit(reflex_base/utils/log.py) addstrace_id(32 hex) andspan_id(16 hex) to the payload whentrace.get_current_span().get_span_context().is_valid.reflex_oteltoPACKAGE_LOGGER_NAMESso its records join thereflexlogger hierarchy.The helper existed as
otel.trace_fields()in an earlier revision of #6900 (removed when decoupling); the JsonHandler hunk is ~6 lines plus a test intests/units/reflex_base/utils/test_log.py(test_json_mode_adds_trace_ids).Blocked by
Docs
Add a "Logs" section to
docs/api-reference/observability.md: withREFLEX_LOG_JSON=true, records inside a span carrytrace_id/span_id; user loggers can useopentelemetry-instrumentation-logging.