Skip to content

feat(filter): access log trace ID correlation - #960

Draft
Ladas wants to merge 1 commit into
praxis-proxy:mainfrom
Ladas:issue-317-access-log-trace-id
Draft

feat(filter): access log trace ID correlation#960
Ladas wants to merge 1 commit into
praxis-proxy:mainfrom
Ladas:issue-317-access-log-trace-id

Conversation

@Ladas

@Ladas Ladas commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add trace ID field to access log output for log-trace correlation
  • Enables operators to jump from access log entries to distributed traces

Closes #317

Dependencies

Depends on #908 (root span per request) — first commit is the #301 dependency.

Test plan

  • Verify trace_id appears in access log output
  • Verify correlation works with OTel collector
  • Unit tests for trace ID extraction

@Ladas
Ladas force-pushed the issue-317-access-log-trace-id branch from b22e506 to 848088f Compare August 12, 2026 10:51

@praxis-bot praxis-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of trace ID correlation changes. 3 findings (0 critical, 0 large, 3 medium).

Comment thread protocol/src/http/pingora/handler/request_filter/mod.rs Outdated
Comment thread protocol/src/http/pingora/handler/mod.rs
Comment thread filter/src/builtins/http/observability/access_log.rs Outdated
@Ladas
Ladas force-pushed the issue-317-access-log-trace-id branch 4 times, most recently from 0f29120 to 08dd8e1 Compare August 13, 2026 11:28

@praxis-bot praxis-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review

Access log trace ID correlation: adds trace_id and span_id fields to access log output when the otel feature is enabled and a valid OpenTelemetry context is present.

Severity Count
Critical 0
Large 0
Medium 1

The implementation is sound: extract_otel_ids correctly reads the OTel span context from the current tracing span, validates it with is_valid(), and returns the IDs only when the context is real. Conditional compilation with #[cfg(feature = "otel")] is properly applied to both the code path and the helper function. Feature propagation through server/Cargo.toml (praxis-filter/otel) is correct. The field reordering to alphabetical in the info! macro is a good consistency improvement.

One medium finding on test coverage gap -- see inline comment.

Comment thread filter/src/builtins/http/observability/access_log.rs
Add trace_id and span_id fields to structured JSON access log entries
for log-to-trace correlation. Fields are extracted from the current
tracing span context and omitted when tracing is not active.

Enables searching by trace_id in Loki and jumping to the full trace
in Tempo via cross-signal correlation.

Closes praxis-proxy#317

Signed-off-by: Ladislav Smola <lsmola@redhat.com>
@Ladas
Ladas force-pushed the issue-317-access-log-trace-id branch from 08dd8e1 to 8fcd504 Compare August 13, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Access log trace ID correlation

2 participants