Skip to content

Commit 8f52fd4

Browse files
paullegranddcVianneyRuhlmann
authored andcommitted
Add redis obfuscation
1 parent d033328 commit 8f52fd4

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

data-pipeline/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ ddcommon = { path = "../ddcommon" }
2222
datadog-trace-protobuf = { path = "../trace-protobuf" }
2323
datadog-trace-utils = { path = "../trace-utils" }
2424
datadog-trace-normalization = { path = "../trace-normalization" }
25+
datadog-trace-obfuscation = { path = "../trace-obfuscation" }
2526
datadog-ddsketch = { path = "../ddsketch" }

data-pipeline/src/stats_exporter.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl StatsExporter {
126126

127127
pub fn insert(&self, mut span_stat: SpanStats) {
128128
normalize_span_stat(&mut span_stat);
129-
// todo obfuscation
129+
obfuscate_span_stat(&mut span_stat);
130130

131131
let mut buckets = self.buckets.lock().unwrap();
132132
let bucket = buckets
@@ -194,6 +194,19 @@ fn normalize_span_stat(span: &mut SpanStats) {
194194
normalize_utils::normalize_resource(&mut span.resource_name, &span.operation_name);
195195
}
196196

197+
fn obfuscate_span_stat(span: &mut SpanStats) {
198+
match &*span.span_type {
199+
"redis" => {
200+
span.resource_name =
201+
datadog_trace_obfuscation::redis::obfuscate_redis_string(&span.resource_name);
202+
}
203+
"sql" | "cassandra" => {
204+
// TODO integrate SQL obfuscation
205+
}
206+
_ => {}
207+
};
208+
}
209+
197210
fn encode_bucket(key: BucketKey, bucket: Bucket) -> pb::ClientGroupedStats {
198211
pb::ClientGroupedStats {
199212
service: key.service_name,

0 commit comments

Comments
 (0)