feat: structured logging with request correlation for verifier (#1058) - #1073
feat: structured logging with request correlation for verifier (#1058)#1073abdoolyaro wants to merge 3 commits into
Conversation
…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
|
@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. |
|
@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! 🚀 |
|
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
left a comment
There was a problem hiding this comment.
Great observability improvement! Structured logging with request correlation enables better debugging and monitoring. Essential for production systems.
mftee
left a comment
There was a problem hiding this comment.
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!
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.
Closes #1058