Skip to content

Comments

Feature: privacy mode to suppress logs and tracing (V2)#94

Merged
Garandor merged 7 commits intomasterfrom
feature/NODE-4814-privacy-mode-v2
Jan 29, 2026
Merged

Feature: privacy mode to suppress logs and tracing (V2)#94
Garandor merged 7 commits intomasterfrom
feature/NODE-4814-privacy-mode-v2

Conversation

@GTC6244
Copy link
Contributor

@GTC6244 GTC6244 commented Jan 29, 2026

WHAT

Rework of #17 , removing the added threading concerns and simplifiying the concept. This PR now simply adds the tag privacy_mode to request ids where a header has been added indicating that privacy mode is desired.

NOTES

We may want to change this slightly to simply add another field to the context within layers, but this is a quick way to guarantee that the solution works, without having to evaluate specific logs.

The test is relatively straightforward - I added a parameter to an existing test forcing it to either use privacy mode or not. If it's not being used, we see the "req: 203942309" values in the logs. If it's being used, these lines are suppressed. ( The interim test was to add the privacy mode tag, but NOT suppress the logs, to prove this works as well! ).

@GTC6244 GTC6244 requested review from Garandor and glitch003 January 29, 2026 01:07
@GTC6244 GTC6244 self-assigned this Jan 29, 2026
Copilot AI review requested due to automatic review settings January 29, 2026 01:07
Copy link
Contributor

Copilot AI left a comment

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 implements a privacy mode feature (V2) that suppresses logs and tracing for requests that include an X-Privacy-Mode header. The implementation tags request IDs with a "privacy_mode" suffix when the header is detected, and a new PrivacyModeLayer in the tracing subscriber filters out log events and spans for requests with this tag.

Changes:

  • Added X-Privacy-Mode header constant and detection logic in request context extraction
  • Created PrivacyModeLayer to filter logs/traces based on privacy mode tag in request ID
  • Integrated privacy filter layer into all logging subscriber configurations
  • Added test parameter to existing integration tests to exercise privacy mode behavior

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
rust/lit-core/lit-api-core/src/context/mod.rs Adds X-Privacy-Mode header detection and appends privacy_mode tag to request/correlation IDs when header is present
rust/lit-core/lit-observability/src/logging/privacy_filter.rs New privacy mode layer that filters logs/spans by checking for privacy_mode tag in request context
rust/lit-core/lit-observability/src/logging/mod.rs Integrates PrivacyModeLayer into simple logging subscribers
rust/lit-core/lit-observability/src/lib.rs Adds PRIVACY_MODE_TAG constant and integrates PrivacyModeLayer into main subscriber
rust/lit-core/lit-observability/Cargo.toml Adds explicit tracing-core dependency
rust/lit-node/lit-node/tests/common/lit_actions.rs Adds add_privacy_mode parameter to test helper and header injection logic
rust/lit-node/lit-node/tests/integration/lit_actions.rs Adds test case with privacy mode enabled
rust/lit-node/lit-node/tests/integration/session_sigs.rs Updates test calls with false for add_privacy_mode parameter
rust/lit-node/lit-node/tests/common/web_user_tests.rs Updates test call with false for add_privacy_mode parameter
rust/lit-core/lit-observability/src/tracing/mod.rs Whitespace formatting change (trailing space)
rust/lit-node/Cargo.lock Transitive dependency version updates
rust/lit-core/Cargo.lock Transitive dependency version updates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +695 to +698
#[test_case(
true,
"Anyone can sign with a MGB PKP within its permitted Lit Action - Privacy Mode Enabled",
true
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The privacy mode test case doesn't programmatically verify that logs are suppressed when privacy mode is enabled. According to the PR description, this test is meant to be verified manually by inspecting logs. Consider adding a comment explaining that this test case should be validated by observing that request ID logs are suppressed when privacy mode is enabled, to help future maintainers understand the test's purpose.

Copilot uses AI. Check for mistakes.
GTC6244 and others added 3 commits January 28, 2026 20:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Jan 29, 2026

PASS [ 44.373s] (3/3) lit_node::test toxiproxy::perf_tests::load_with_no_latency
PASS [ 44.559s] (2/3) lit_node::test toxiproxy::perf_tests::load_with_50ms_latency_single_link
PASS [ 86.306s] (1/3) lit_node::test toxiproxy::perf_tests::load_with_50ms_latency_all_links

Copy link
Contributor

@Garandor Garandor left a comment

Choose a reason for hiding this comment

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

two suggestions, otherwise LGTM!

@Garandor
Copy link
Contributor

one more note, I think we should at least be able to track the number of transactions made using privacy mode to see if the feature has any adoption.

I'd add an otel counter to trigger each time a request with X-PRIVACY header is found, but this could also be done in a followup

Copy link
Contributor

This stack of pull requests is managed by Graphite. Learn more about stacking.

* proposed changes

* count privacy mode requests received via otel
Copy link
Contributor

@Garandor Garandor left a comment

Choose a reason for hiding this comment

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

proposed changes merged in, LGTM from my end and ready to go when CI passes

@Garandor Garandor merged commit 3c73010 into master Jan 29, 2026
33 checks passed
@Garandor Garandor deleted the feature/NODE-4814-privacy-mode-v2 branch January 29, 2026 17:39
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.

2 participants