Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ members = [
"datadog-log-ffi",
]

exclude = [
"regex-experiments"
]

# https://doc.rust-lang.org/cargo/reference/resolver.html
resolver = "2"

Expand Down
38 changes: 36 additions & 2 deletions LICENSE-3rdparty.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion datadog-live-debugger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ddcommon = { path = "../ddcommon" }
hyper = { workspace = true}
http-body-util = "0.1"

regex = "1.9.3"
regex-lite = "^0.1"
percent-encoding = "2.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion datadog-live-debugger/src/expr_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::expr_defs::{
BinaryComparison, CollectionMatch, CollectionSource, Condition, DslPart, NumberSource,
Reference, StringComparison, StringSource, Value,
};
use regex::Regex;
use regex_lite::Regex;
use std::borrow::Cow;
use std::cmp::min;
use std::fmt::{Display, Formatter};
Expand Down
2 changes: 1 addition & 1 deletion datadog-live-debugger/src/redacted_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ pub unsafe fn add_redacted_type<I: AsRef<[u8]>>(name: I) {
regex_str.push('|')
}
let name = String::from_utf8_lossy(name);
regex_str.push_str(regex::escape(&name[..name.len() - 1]).as_str());
regex_str.push_str(regex_lite::escape(&name[..name.len() - 1]).as_str());
regex_str.push_str(".*");
} else {
let added_types = &mut (*(&*ADDED_REDACTED_TYPES as *const Vec<Vec<u8>>).cast_mut());
Expand Down
2 changes: 1 addition & 1 deletion datadog-trace-obfuscation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license.workspace = true

[dependencies]
anyhow = "1.0"
regex = "1"
regex-lite = "^0.1"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0"
url = "2.4.0"
Expand Down
2 changes: 1 addition & 1 deletion datadog-trace-obfuscation/src/ip_address.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use regex::Regex;
use regex_lite::Regex;
use std::{borrow::Cow, collections::HashSet, net::Ipv6Addr, sync::LazyLock};

const ALLOWED_IP_ADDRESSES: [&str; 4] = [
Expand Down
16 changes: 8 additions & 8 deletions datadog-trace-obfuscation/src/replacer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use datadog_trace_protobuf::pb;
use regex::Regex;
use regex_lite::Regex;
use serde::Deserialize;

#[derive(Deserialize)]
Expand All @@ -27,7 +27,7 @@ pub struct ReplaceRule {
name: String,

// re holds the regex pattern for matching.
re: regex::Regex,
re: regex_lite::Regex,

// repl specifies the replacement string to be used when Pattern matches.
repl: String,
Expand Down Expand Up @@ -97,7 +97,7 @@ pub fn parse_rules_from_string(
anyhow::bail!("Obfuscator Error: Error while parsing rule: {}", err)
}
};
let no_expansion = regex::Replacer::no_expansion(&mut &raw_rule.repl).is_some();
let no_expansion = regex_lite::Replacer::no_expansion(&mut &raw_rule.repl).is_some();
vec.push(ReplaceRule {
name: raw_rule.name,
re: compiled_regex,
Expand Down Expand Up @@ -155,7 +155,7 @@ fn replace_all(
#[allow(clippy::unwrap_used)]
let m = cap.get(0).unwrap();
scratch_space.push_str(&haystack[last_match..m.start()]);
regex::Replacer::replace_append(&mut replace, &cap, scratch_space);
regex_lite::Replacer::replace_append(&mut replace, &cap, scratch_space);
last_match = m.end();
}
scratch_space.push_str(&haystack[last_match..]);
Expand Down Expand Up @@ -286,13 +286,13 @@ mod tests {
fn test_replace_rule_eq() {
let rule1 = replacer::ReplaceRule {
name: "http.url".to_string(),
re: regex::Regex::new("(token/)([^/]*)").unwrap(),
re: regex_lite::Regex::new("(token/)([^/]*)").unwrap(),
repl: "${1}?".to_string(),
no_expansion: false,
};
let rule2 = replacer::ReplaceRule {
name: "http.url".to_string(),
re: regex::Regex::new("(token/)([^/]*)").unwrap(),
re: regex_lite::Regex::new("(token/)([^/]*)").unwrap(),
repl: "${1}?".to_string(),
no_expansion: false,
};
Expand All @@ -304,13 +304,13 @@ mod tests {
fn test_replace_rule_neq() {
let rule1 = replacer::ReplaceRule {
name: "http.url".to_string(),
re: regex::Regex::new("(token/)([^/]*)").unwrap(),
re: regex_lite::Regex::new("(token/)([^/]*)").unwrap(),
repl: "${1}?".to_string(),
no_expansion: false,
};
let rule2 = replacer::ReplaceRule {
name: "http.url".to_string(),
re: regex::Regex::new("(broken/)([^/]*)").unwrap(),
re: regex_lite::Regex::new("(broken/)([^/]*)").unwrap(),
repl: "${1}?".to_string(),
no_expansion: false,
};
Expand Down
2 changes: 1 addition & 1 deletion ddcommon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ http-body-util = "0.1"
tower-service = "0.3"
cc = "1.1.31"
pin-project = "1"
regex = "1.5"
regex-lite = "^0.1"
rustls = { version = "0.23", default-features = false, optional = true }
rustls-native-certs = { version = "0.8.1", optional = true }
thiserror = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion ddcommon/src/azure_app_services.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use regex::Regex;
use regex_lite::Regex;
use std::env;
use std::sync::LazyLock;

Expand Down
2 changes: 1 addition & 1 deletion ddcommon/src/entity_id/unix/container_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

//! This module provides functions to parse the container id from the cgroup file
use super::CgroupFileParsingError;
use regex::Regex;
use regex_lite::Regex;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
Expand Down
2 changes: 1 addition & 1 deletion ddcommon/src/entity_id/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub static ENTITY_ID: LazyLock<Option<&'static str>> = LazyLock::new(|| {
#[cfg(test)]
mod tests {
use super::*;
use regex::Regex;
use regex_lite::Regex;

static IN_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"in-\d+").unwrap());
static CI_REGEX: LazyLock<Regex> = LazyLock::new(|| {
Expand Down
1 change: 1 addition & 0 deletions regex-experiments/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
61 changes: 61 additions & 0 deletions regex-experiments/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions regex-experiments/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "cgroup-parse-bench"
version = "0.1.0"
edition = "2021"

[dependencies]
regex = "1"
regex-lite = "0.1"
Loading
Loading