Skip to content

feat: structured logging with request correlation for verifier (#1058) - #1073

Open
abdoolyaro wants to merge 3 commits into
CodeGirlsInc:mainfrom
abdoolyaro:feat/1058-structured-logging-request-correlation
Open

feat: structured logging with request correlation for verifier (#1058)#1073
abdoolyaro wants to merge 3 commits into
CodeGirlsInc:mainfrom
abdoolyaro:feat/1058-structured-logging-request-correlation

Conversation

@abdoolyaro

Copy link
Copy Markdown
Contributor
  • Apply TraceLayer to the router with a per-request span that carries the request ID as a field, so every log line for a request is correlated
  • Honour an inbound X-Request-Id header (propagated from the NestJS backend per BE-136); generate a UUID only when absent, and echo it back on the response via PropagateRequestIdLayer
  • Emit JSON logs in production and human-readable logs in development, controlled by a new APP_ENV config value (defaults to development)
  • Instrument Stellar and cache module methods with #[instrument] spans and enable span-close timing events, so their latency is attributable per request
  • Skip secret keys and full document hashes from span fields; only a truncated hash prefix is recorded, matching the existing log convention in stellar.rs

Closes #1058

…irlsInc#1058)

- Apply TraceLayer to the router with a per-request span that carries
  the request ID as a field, so every log line for a request is
  correlated
- Honour an inbound X-Request-Id header (propagated from the NestJS
  backend per BE-136); generate a UUID only when absent, and echo it
  back on the response via PropagateRequestIdLayer
- Emit JSON logs in production and human-readable logs in development,
  controlled by a new APP_ENV config value (defaults to development)
- Instrument Stellar and cache module methods with #[instrument] spans
  and enable span-close timing events, so their latency is attributable
  per request
- Skip secret keys and full document hashes from span fields; only a
  truncated hash prefix is recorded, matching the existing log
  convention in stellar.rs

Closes CodeGirlsInc#1058
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@abdoolyaro is attempting to deploy a commit to the Mftee's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@abdoolyaro Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@abdoolyaro

Copy link
Copy Markdown
Contributor Author

Frontend (Next.js) CI check is failing due to a pre-existing lockfile desync unrelated to this change (missing @swc/helpers@0.5.23 in package-lock.json), this PR only touches contract/.

@mftee mftee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great observability improvement! Structured logging with request correlation enables better debugging and monitoring. Essential for production systems.

@mftee mftee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @abdoolyaro, 👋

This PR has merge conflicts that need to be resolved before it can be merged. The following files have conflicts:

contract/src/cache.rs
contract/src/lib.rs
contract/src/main.rs

Please resolve these conflicts in your branch and push the updates. Once resolved, the PR can be merged successfully.

Thank you!

abdoolyaro and others added 2 commits July 28, 2026 07:39
main was broken at HEAD (introduced by the lib-split refactor,
d0eae81) with three compile errors unrelated to CT-59:

- handlers/submit.rs called a nonexistent
  map_validation_error_inline; fixed to use the real
  map_validation_error from crate::types
- CacheBackend and MetricsRegistry were used behind #[derive(Clone)]
  on AppState but didn't implement Clone themselves (nor did their
  inner RedisCache/InMemoryCache variants)
- CacheBackend was missing a public close() dispatcher that main.rs's
  graceful-shutdown path already called

Also derives Clone on RedisCache/InMemoryCache, adds the missing
CacheBackend::close() dispatcher matching the existing
check_connection() pattern, removes now-unused imports flagged
by the compiler, and applies cargo fmt to a few files that were
already out of sync with rustfmt.

Note: cargo test --all still fails on main independent of this
fix, in files unrelated to CT-59 (metrics.rs test assertions call
methods on impl IntoResponse before extracting the body;
handler_integration_tests.rs is missing a tower::util::ServiceExt
import for .oneshot()). Not fixed here as it's outside this issue's
scope -- flagging separately.
@abdoolyaro
abdoolyaro requested a review from mftee July 28, 2026 08:09
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.

[CT-59] Add structured logging with request correlation to the Rust verifier

2 participants