-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trace Tag Replacer: functionality to scrub sensitive data from spans #111
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
14eb5b2
obfuscator init
thedavl 9d8c7e5
add tag replacer
thedavl 1070666
update dockerfile tool
thedavl 62a1e8c
Create DefaultTraceTagReplacer
thedavl b9b3e75
use borrowed str over owned String
thedavl 32107cf
lint
thedavl ca6daa9
Update CODEOWNERS
thedavl 530f3cf
rename obfuscator to replacer
thedavl b8bb46c
lint
thedavl 4495bfa
Update replacer.rs
thedavl 6f4cf14
move parse_rules_from_string out of struct
thedavl 7d00515
remove trait
thedavl 89c1874
comment
thedavl e39da91
Merge branch 'main' into david.lee/trace-obfuscator
thedavl 334410a
Update LICENSE-3rdparty.yml
thedavl 6bba281
move trace protobuf definitions into their own crate
thedavl fc84f24
Merge branch 'main' into david.lee/trace-obfuscator
thedavl e577cc9
Update Dockerfile.build
thedavl e6e165c
Merge branch 'david.lee/trace-obfuscator' of github.com:DataDog/libda…
thedavl 4dcae5c
Update CODEOWNERS
thedavl 8627022
Update LICENSE-3rdparty.yml
thedavl 9ceccb0
address nit
thedavl c05cccf
add criterion benchmark
thedavl 0a28c71
lint
thedavl baf1c55
fix CI
thedavl a4de7ad
Update Dockerfile.build
thedavl 2166645
rename bench file
thedavl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,6 @@ | |
|
||
#![deny(clippy::all)] | ||
|
||
pub mod pb { | ||
include!("./pb/pb.rs"); | ||
} | ||
|
||
pub mod normalizer; | ||
|
||
pub mod normalize_utils; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "datadog-trace-obfuscation" | ||
version = "2.0.0" | ||
authors = ["David Lee <david.lee@datadoghq.com>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
anyhow = "1.0" | ||
regex = "1" | ||
datadog-trace-protobuf = { path = "../trace-protobuf" } | ||
|
||
[dev-dependencies] | ||
duplicate = "0.4.1" | ||
criterion = "0.4" | ||
|
||
[[bench]] | ||
name = "replace_trace_tags_bench" | ||
harness = false |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. This product includes software | ||
// developed at Datadog (https://www.datadoghq.com/). Copyright 2023-Present | ||
// Datadog, Inc. | ||
|
||
use std::collections::HashMap; | ||
|
||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use datadog_trace_obfuscation::replacer; | ||
use datadog_trace_protobuf::pb; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
let rules: &[replacer::ReplaceRule] = &replacer::parse_rules_from_string(&[ | ||
["http.url", "(token/)([^/]*)", "${1}?"], | ||
["http.url", "guid", "[REDACTED]"], | ||
["*", "(token/)([^/]*)", "${1}?"], | ||
["*", "this", "that"], | ||
["custom.tag", "(/foo/bar/).*", "${1}extra"], | ||
["resource.name", "prod", "stage"], | ||
]) | ||
.unwrap(); | ||
|
||
let span_1 = pb::Span { | ||
duration: 10000000, | ||
error: 0, | ||
resource: "GET /some/raclette".to_string(), | ||
service: "django".to_string(), | ||
name: "django.controller".to_string(), | ||
span_id: 123, | ||
start: 1448466874000000000, | ||
trace_id: 424242, | ||
meta: HashMap::from([ | ||
("resource.name".to_string(), "this is prod".to_string()), | ||
( | ||
"http.url".to_string(), | ||
"some/[REDACTED]/token/abcdef/abc".to_string(), | ||
), | ||
( | ||
"other.url".to_string(), | ||
"some/guid/token/abcdef/abc".to_string(), | ||
), | ||
("custom.tag".to_string(), "/foo/bar/foo".to_string()), | ||
]), | ||
metrics: HashMap::from([("cheese_weight".to_string(), 100000.0)]), | ||
parent_id: 1111, | ||
r#type: "http".to_string(), | ||
meta_struct: HashMap::new(), | ||
}; | ||
|
||
let mut trace = [span_1]; | ||
c.bench_function("replace_trace_tags_bench", |b| { | ||
b.iter(|| { | ||
replacer::replace_trace_tags(black_box(&mut trace), black_box(rules)); | ||
}) | ||
}); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. This product includes software | ||
// developed at Datadog (https://www.datadoghq.com/). Copyright 2023-Present | ||
// Datadog, Inc. | ||
|
||
#![deny(clippy::all)] | ||
|
||
pub mod replacer; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this clippy setting still required?