Skip to content

feat(logging): add tracing instrumentation and refine log messages - #754

Merged
nanderstabel merged 3 commits into
devfrom
feat/tracing
Aug 21, 2026
Merged

nanderstabel merged 3 commits into
devfrom
feat/tracing

Conversation

@nanderstabel

Copy link
Copy Markdown
Contributor

Description of change

This PR improves the logging and observability strategy across identity-wallet:

  1. tracing::instrument Annotations: Added #[tracing::instrument(skip_all, err)] across all reducer and key I/O helper functions. This automatically captures spans and emits errors at ERROR level via tracing's default log bridge when operations fail.
  2. info! to debug! Demotions:
    • Verbose data structures (e.g. decoded documents, issuer metadata, token requests/responses) and internal debugging values were demoted from info! to debug! to prevent log flooding in logcat/console and avoid logging potentially sensitive payload fields at standard levels.
    • info! is reserved for high-level lifecycle milestones (e.g. initiating flows, successful status checks, profile resets), maintaining a high signal-to-noise ratio.
  3. Intent-focused Logs: Replaced bare function-name logs (e.g. info!("send_token_request")) with contextual logs capturing key parameters and intent.
  4. Updated openid4vc dependency: Updated oid4vc git rev to incorporate latest tracing and log improvements from openid4vc#134.

Example of improved log messages:

Old:

Error: Failed to get credential for configuration id OpenBadgeCredential: error decoding response body: data did not match any variant of untagged enum CredentialResponseType at line 1 column 77
[2026-08-20][10:27:16][ERROR][identity_wallet::command] state update failed: Error: Failed to get credential for configuration id OpenBadgeCredential: error decoding response body: data did not match any variant of untagged enum CredentialResponseType at line 1 column 77
[2026-08-20][10:27:16][ERROR][webview:runCallback@user-script:5:284:15] Error: Error: Failed to get credential for configuration id OpenBadgeCredential: error decoding response body: data did not match any variant of untagged enum CredentialResponseType at line 1 column 77

New:

[2026-08-20][10:21:09][DEBUG][oid4vc_core::jwt] Encoding and signing JWT algorithm=EdDSA kid=did:jwk:eyJhbGciOiJFZERTQSIsImNydiI6IkVkMjU1MTkiLCJraWQiOiJfVTZ6QWtCc3dvaVFSMTBRYzBZUUIwb1VfZENXNWR5S3l1eU1Cc0tMZF9ZIiwia3R5IjoiT0tQIiwieCI6IkEwa0xKdVh3YUV4QnUxcFE1Tzl4QWI0WGJzYzFWM1V3dnZxSmR3RG5obFkifQ#0 subject_syntax_type=did:jwk
[2026-08-20][10:21:09][INFO][oid4vci::wallet] Sending credential request body to issuer request_body_json={"credential_configuration_id":"OpenBadgeCredential","proofs":{"jwt":["eyJ0eXAiOiJvcGVuaWQ0dmNpLXByb29mK2p3dCIsImFsZyI6IkVkRFNBIiwia2lkIjoiZGlkOmp3azpleUpoYkdjaU9pSkZaRVJUUVNJc0ltTnlkaUk2SWtWa01qVTFNVGtpTENKcmFXUWlPaUpmVlRaNlFXdENjM2R2YVZGU01UQlJZekJaVVVJd2IxVmZaRU5YTldSNVMzbDFlVTFDYzB0TVpGOVpJaXdpYTNSNUlqb2lUMHRRSWl3aWVDSTZJa0V3YTB4S2RWaDNZVVY0UW5VeGNGRTFUemw0UVdJMFdHSnpZekZXTTFWM2RuWnhTbVIzUkc1b2JGa2lmUSMwIn0.eyJpc3MiOiJkaWQ6andrOmV5SmhiR2NpT2lKRlpFUlRRU0lzSW1OeWRpSTZJa1ZrTWpVMU1Ua2lMQ0pyYVdRaU9pSmZWVFo2UVd0Q2MzZHZhVkZTTVRCUll6QlpVVUl3YjFWZlpFTlhOV1I1UzNsMWVVMUNjMHRNWkY5Wklpd2lhM1I1SWpvaVQwdFFJaXdpZUNJNklrRXdhMHhLZFZoM1lVVjRRblV4Y0ZFMVR6bDRRV0kwV0dKell6RldNMVYzZG5aeFNtUjNSRzVvYkZraWZRIiwiYXVkIjoiaHR0cHM6Ly9pc3N1ZXIucGlsb3RzLmVkdWJhZGdlcy5ubC9lZHViYWRnZXMiLCJpYXQiOjE3ODcyMjEyNjksIm5vbmNlIjoiMDAyNzUxNTc4ZDk5NGVhNGE0N2RhZjM1MmI2NjMyZjAifQ.JP4zxlcM7yy6BHjulb06iZtA-Yr0KBVZC3W0SKOVcyTUNGuIOyq2PxWGPF2to1Fp8mqWhxIPP9TTgWgUFrZsDg"]}}
[2026-08-20][10:21:09][INFO][oid4vci::wallet] Proof JWT header parameters kid=did:jwk:eyJhbGciOiJFZERTQSIsImNydiI6IkVkMjU1MTkiLCJraWQiOiJfVTZ6QWtCc3dvaVFSMTBRYzBZUUIwb1VfZENXNWR5S3l1eU1Cc0tMZF9ZIiwia3R5IjoiT0tQIiwieCI6IkEwa0xKdVh3YUV4QnUxcFE1Tzl4QWI0WGJzYzFWM1V3dnZxSmR3RG5obFkifQ#0 alg=EdDSA
[2026-08-20][10:21:10][ERROR][oid4vci::wallet] error=Credential issuance failed (HTTP 400 Bad Request): {"error":"credential_request_denied","error_description":"Credential denied"}
[2026-08-20][10:21:10][DEBUG][identity_wallet::command] emitted error event `error` with payload:
Error: Failed to get credential for configuration id OpenBadgeCredential: Credential issuance failed (HTTP 400 Bad Request): {"error":"credential_request_denied","error_description":"Credential denied"}
[2026-08-20][10:21:10][ERROR][identity_wallet::command] State update failed after 904.164071ms: Error: Failed to get credential for configuration id OpenBadgeCredential: Credential issuance failed (HTTP 400 Bad Request): {"error":"credential_request_denied","error_description":"Credential denied"}
[2026-08-20][10:21:10][ERROR][webview:runCallback@user-script:5:284:15] Error: Error: Failed to get credential for configuration id OpenBadgeCredential: Credential issuance failed (HTTP 400 Bad Request): {"error":"credential_request_denied","error_description":"Credential denied"}

Links to any relevant issues

How the change has been tested

  • Ran cargo fmt --all -- --check
  • Ran cargo clippy --all-targets --all-features -- -D warnings
  • Ran full test suite via cargo test --workspace (116 unit tests, 29 integration tests, 1 doc test passing)
  • Verified log output and levels via tauri-plugin-log with Android adb logcat and desktop targets

Definition of Done checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@nanderstabel nanderstabel self-assigned this Aug 20, 2026
@nanderstabel nanderstabel added Added A new feature that requires a minor release. Backend This issue pertains to the UniMe backend. labels Aug 20, 2026
@nanderstabel
nanderstabel requested a lite review from Copilot August 20, 2026 12:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates identity-wallet’s observability by adding tracing::instrument spans to many async reducers/helpers and refining log messages/levels to reduce noise and avoid logging verbose payloads at info.

Changes:

  • Add #[tracing::instrument(skip_all, err)] to reducers and several helper functions.
  • Demote verbose/value-heavy info! logs to debug! and replace “function name” logs with intent/parameter-focused messages.
  • Update the oid4vc git revision and expand Tauri log filtering to include oid4vc* crates.

Reviewed changes

Copilot reviewed 53 out of 54 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
unime/src-tauri/src/lib.rs Adds debug log filters for oid4vc* crates in Tauri logging.
identity-wallet/src/subject.rs Demotes resolver init logs to debug.
identity-wallet/src/stronghold.rs Demotes key-generation / snapshot logs to debug.
identity-wallet/src/state/verified_data/reducers/mod.rs Adds tracing + refines email verification flow logs.
identity-wallet/src/state/user_journey/reducers/cancel_user_journey.rs Adds tracing and debug log for cancellation.
identity-wallet/src/state/trust_list/reducers/toggle_entry.rs Adds tracing instrumentation.
identity-wallet/src/state/trust_list/reducers/edit_trust_list.rs Adds tracing instrumentation.
identity-wallet/src/state/trust_list/reducers/edit_entry.rs Adds tracing instrumentation.
identity-wallet/src/state/trust_list/reducers/delete_trust_list.rs Adds tracing instrumentation.
identity-wallet/src/state/trust_list/reducers/delete_entry.rs Adds tracing instrumentation.
identity-wallet/src/state/trust_list/reducers/add_trust_list.rs Adds tracing instrumentation.
identity-wallet/src/state/trust_list/reducers/add_entry.rs Adds tracing instrumentation.
identity-wallet/src/state/search/reducers/search_query.rs Adds tracing + debug summary of match counts.
identity-wallet/src/state/search/reducers/delete_recent_search.rs Adds tracing + debug log for deletion.
identity-wallet/src/state/search/reducers/add_recent_search.rs Adds tracing + debug log for insertion.
identity-wallet/src/state/qr_code/reducers/read_credential_offer.rs Adds tracing + shifts verbose offer/metadata logs to debug.
identity-wallet/src/state/qr_code/reducers/read_authorization_request.rs Adds tracing + refines request metadata logs and reduces verbosity.
identity-wallet/src/state/profile_settings/reducers/update_sorting_preference.rs Adds tracing instrumentation to sorting reducers.
identity-wallet/src/state/profile_settings/reducers/update_profile_settings.rs Adds tracing + debug log for profile settings updates.
identity-wallet/src/state/profile_settings/reducers/set_locale.rs Adds tracing instrumentation to locale reducer.
identity-wallet/src/state/profile_settings/reducers/enable_biometrics.rs Adds tracing instrumentation to biometrics reducer.
identity-wallet/src/state/profile_settings/reducers/create_new.rs Adds tracing + refines create-identity lifecycle logging.
identity-wallet/src/state/did/validate_linked_verifiable_presentations.rs Demotes high-volume DID/presentation logs to debug.
identity-wallet/src/state/did/validate_domain_linkage.rs Demotes domain linkage logs to debug.
identity-wallet/src/state/did/reducers/preferred_method.rs Adds tracing instrumentation.
identity-wallet/src/state/did/reducers/preferred_keytype.rs Adds tracing instrumentation.
identity-wallet/src/state/dev_mode/reducers/toggle_dev_mode.rs Adds tracing instrumentation.
identity-wallet/src/state/dev_mode/reducers/show_setting.rs Adds tracing instrumentation.
identity-wallet/src/state/dev_mode/reducers/reducers.rs Adds tracing instrumentation to unlock reducer.
identity-wallet/src/state/dev_mode/reducers/load_dev_profile.rs Adds tracing + improves dev-profile log context.
identity-wallet/src/state/dev_mode/reducers/ferris_static_profile.rs Adds tracing instrumentation.
identity-wallet/src/state/dev_mode/reducers/dragon_dynamic_profile.rs Adds tracing instrumentation.
identity-wallet/src/state/dev_mode/reducers/clear_debug_log.rs Adds tracing instrumentation.
identity-wallet/src/state/credentials/reducers/update_credential_metadata.rs Adds tracing + demotes before/after metadata logs to debug.
identity-wallet/src/state/credentials/reducers/share_to_linkedin.rs Adds tracing + info log for share intent.
identity-wallet/src/state/credentials/reducers/send_token_request.rs Adds tracing + refines token-request intent logging; demotes verbose logs.
identity-wallet/src/state/credentials/reducers/send_interactive_authorization_request_follow_up.rs Adds tracing + intent log with credential count.
identity-wallet/src/state/credentials/reducers/send_credential_request.rs Adds tracing + refines offer-handling logs; reduces verbosity.
identity-wallet/src/state/credentials/reducers/self_issue_credential.rs Adds tracing + intent logs for self-issuance.
identity-wallet/src/state/credentials/reducers/refresh_credential_status.rs Adds tracing instrumentation to status refresh helpers.
identity-wallet/src/state/credentials/reducers/refresh_all_credential_statuses.rs Adds tracing instrumentation.
identity-wallet/src/state/credentials/reducers/handle_oid4vp_authorization_request.rs Adds tracing + improves error context/verbosity in OID4VP flow.
identity-wallet/src/state/credentials/reducers/delete_credential.rs Adds tracing instrumentation.
identity-wallet/src/state/connections/reducers/handle_siopv2_authorization_request.rs Adds tracing + refines SIOPv2 response lifecycle logs.
identity-wallet/src/state/common/reducers/unlock_storage.rs Adds tracing + improves unlock lifecycle logs and counts.
identity-wallet/src/state/common/reducers/reset_state.rs Adds tracing + info log for state reset.
identity-wallet/src/state/common/reducers/get_state.rs Adds tracing instrumentation.
identity-wallet/src/state/common/reducers/check_password.rs Adds tracing + logs password verification outcomes.
identity-wallet/src/state/common/reducers/cancel_user_flow.rs Adds tracing + debug log for flow cancellation.
identity-wallet/src/persistence.rs Demotes storage-path logs to debug.
identity-wallet/src/command.rs Adds reduce duration timing and refines timeout/error logs.
identity-wallet/Cargo.toml Adds direct tracing dependency for instrumentation usage.
Cargo.toml Updates oid4vc git rev (includes a temporary marker comment).
Cargo.lock Updates lockfile for oid4vc rev and tracing deps.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Cargo.toml Outdated
Comment thread unime/src-tauri/src/lib.rs
Comment thread identity-wallet/src/state/verified_data/reducers/mod.rs
@nanderstabel
nanderstabel requested a review from Oran-Dan August 21, 2026 07:59
@nanderstabel
nanderstabel merged commit 5013d65 into dev Aug 21, 2026
1 of 3 checks passed
@nanderstabel
nanderstabel deleted the feat/tracing branch August 21, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Added A new feature that requires a minor release. Backend This issue pertains to the UniMe backend.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants