Skip to content

Commit

Permalink
use a Thrift adapter to redact partial results details
Browse files Browse the repository at this point in the history
Summary: We redact the response itself and the error reports, resulting in more succint log lines and less formatting overhead

Reviewed By: donsbot

Differential Revision: D66427803

fbshipit-source-id: 4ce780f4ac8b83c8dc587317f65c9cae3040960b
  • Loading branch information
Pepe Iborra authored and facebook-github-bot committed Nov 25, 2024
1 parent aa369ca commit a7ef79a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions shed/fbthrift_ext/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ rust_library(
"fbsource//third-party/rust:chrono",
"fbsource//third-party/rust:ordered-float",
"fbsource//third-party/rust:paste",
"fbsource//third-party/rust:serde",
"fbsource//third-party/rust:serde_derive",
"fbsource//third-party/rust:thiserror",
"fbsource//third-party/rust:uuid",
"fbsource//third-party/rust:valuable",
Expand Down
2 changes: 2 additions & 0 deletions shed/fbthrift_ext/adapters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ chrono = { version = "0.4", features = ["clock", "serde", "std"], default-featur
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
ordered-float = { version = "3.7", features = ["serde"] }
paste = "1.0.14"
serde = { version = "1.0.185", features = ["derive", "rc"] }
serde_derive = "1.0.185"
thiserror = "1.0.64"
uuid = { version = "1.2", features = ["serde", "v4", "v5", "v6", "v7", "v8"] }
valuable = { version = "0.1", features = ["derive"] }
4 changes: 3 additions & 1 deletion shed/fbthrift_ext/adapters/redacted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use std::marker::PhantomData;

use fbthrift::adapter::ThriftAdapter;
use serde_derive::Deserialize;
use serde_derive::Serialize;

const REDACTED: &str = "<REDACTED>";

Expand Down Expand Up @@ -48,7 +50,7 @@ impl<T: Clone + PartialEq + Send + Sync> Redactable for T {}
/// [`Debug`]: std::fmt::Debug
/// [`Display`]: std::fmt::Display
/// [`Valuable`]: valuable::Valuable
#[derive(Clone, PartialEq)]
#[derive(Clone, Default, Serialize, Deserialize, PartialEq)]
pub struct Redacted<T: Redactable> {
inner: T,
}
Expand Down

0 comments on commit a7ef79a

Please sign in to comment.