feat(tracing): add structured tracing instrumentation across workspace - #134
Merged
Conversation
Merged
6 tasks
There was a problem hiding this comment.
Pull request overview
This PR introduces structured tracing instrumentation across the openid4vc Rust workspace to improve observability (spans + contextual fields) and refactors several HTTP client paths to preserve raw response bodies for better diagnostics when requests fail or responses don’t match expected schemas.
Changes:
- Added
tracingas a workspace dependency and enabled it in multiple crates. - Annotated key protocol/validation functions with
#[tracing::instrument(..., err, skip(...))]and added targeted debug/info events. - Refactored
oid4vci::WalletHTTP calls to readresponse.text()first and thenserde_json::from_str, retaining raw bodies in error context.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Cargo.toml |
Adds workspace-level tracing dependency and features. |
oid4vc-core/Cargo.toml |
Enables tracing for oid4vc-core. |
oid4vc-core/src/authorization_request.rs |
Adds debug logging during authorization request parsing. |
oid4vc-core/src/jwt.rs |
Adds instrumentation/logging around JWT header extraction, encode/decode helpers, and improves an error message. |
oid4vc-core/src/utils/did.rs |
Instruments DID KID normalization/extraction with debug context. |
oid4vc-core/src/verifier.rs |
Instruments signature verification and logs selected algorithm. |
oid4vci/Cargo.toml |
Enables tracing for oid4vci. |
oid4vci/src/proof.rs |
Adds debug logging during proof construction. |
oid4vci/src/wallet/mod.rs |
Adds instrumentation/logging and changes HTTP handling to preserve raw bodies on failures and parse errors. |
oid4vc-manager/Cargo.toml |
Enables tracing for oid4vc-manager. |
oid4vc-manager/src/managers/provider.rs |
Adds debug events around ProviderManager operations. |
oid4vc-manager/src/managers/relying_party.rs |
Adds debug events around RelyingPartyManager operations. |
oid4vp/Cargo.toml |
Enables tracing for oid4vp. |
oid4vp/src/dcql/claims.rs |
Adds instrumentation/logging for DCQL claim validation helpers. |
oid4vp/src/dcql/dcql_query.rs |
Instruments DCQL query validation and adds debug context. |
oid4vp/src/dcql_evaluation.rs |
Adds debug logging around DCQL evaluation outcomes. |
oid4vp/src/token/vp_token_builder.rs |
Adds debug/instrumentation for VP token build and submission validation. |
oid4vp/src/token/vp_token_validator.rs |
Instruments VP token validation pipeline and adds step-level logs. |
siopv2/Cargo.toml |
Switches serde_urlencoded to workspace dep and enables tracing. |
siopv2/src/provider.rs |
Instruments Provider flows and improves diagnostics/logging. |
siopv2/src/relying_party.rs |
Instruments relying party encode/validate paths and adds debug context. |
Suppressed comments (2)
oid4vci/src/wallet/mod.rs:525
- This logs the full credential request JSON at INFO level, which includes the
proofs.jwtvalue (a signed JWT) and may contain sensitive identifiers. It also usesunwrap_or_default()which would silently drop serialization errors.
let request_body_json = serde_json::to_string(&credential_request).unwrap_or_default();
tracing::info!(%request_body_json, "Sending credential request body to issuer");
oid4vci/src/wallet/mod.rs:548
- Logging the raw credential response body can leak the issued credential(s) (potentially containing PII) into debug logs. Consider logging only metadata such as status and body length, and keep the raw body only in error context when parsing fails.
tracing::debug!(%status, %text, "Received raw credential response from issuer");
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
daniel-mader
approved these changes
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of change
This PR introduces structured
tracinginstrumentation across the entireopenid4vcworkspace (oid4vc-core,oid4vci,oid4vp,siopv2, andoid4vc-manager) to improve observability and diagnostics.Key Highlights:
tracingIntegration: Addedtracingworkspace dependency withattributes,std, andlogcompatibility features.#[tracing::instrument(err)]: Annotated core protocol functions (e.g., inWallet,VpTokenValidator,Provider,RelyingParty) with#[tracing::instrument]. Theerrattribute automatically captures and logs returned errors with their full context upon span exit, eliminating redundant "log-and-return" boilerplate (tracing::warn!(...); return Err(...)). Sensitive fields (e.g., keys, tokens, signer structs) are explicitly excluded usingskip(...)..text()vs.json()in HTTP Calls: Replaced directresponse.json::<T>()calls inWalletwithresponse.text()followed byserde_json::from_str(&text). This ensures that when an endpoint returns a non-200 HTTP status (e.g.400 Bad Requestor500 Internal Server Error) or an unexpected schema, the full raw server response body is retained in the error context and debug logs instead of failing silently with a generic deserialization error.Links to any relevant issues
N/A
How the change has been tested
cargo fmt --all -- --checkpassed cleanly.cargo clippy --all-targets --all-features -- -D warningspassed with 0 warnings.cargo test --workspace --all-featurespassed all 121 tests (including doc tests).identity-walleton Android (adb logcat) verifying structured log output during issuance and verification flows.Definition of Done checklist