Skip to content

Commit 0b59f64

Browse files
authored
chore(remote-config): make live debugger optional feature (#1246)
chore(remote-config): make live debugger optional feature
1 parent 8719ad8 commit 0b59f64

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

datadog-remote-config/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ name = "datadog-remote-config"
55
version = "0.0.1"
66

77
[features]
8+
default = []
9+
live-debugger = ["datadog-live-debugger"]
810
test = ["hyper/server", "hyper-util"]
911

1012
[dependencies]
1113
anyhow = { version = "1.0" }
1214
ddcommon = { path = "../ddcommon" }
1315
datadog-trace-protobuf = { path = "../datadog-trace-protobuf" }
14-
datadog-live-debugger = { path = "../datadog-live-debugger" }
16+
datadog-live-debugger = { path = "../datadog-live-debugger", optional = true }
1517
hyper = { workspace = true }
1618
http-body-util = "0.1"
1719
http = "1.0"

datadog-remote-config/src/fetch/fetcher.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ pub mod tests {
696696
endpoint: server.endpoint.clone(),
697697
products: vec![
698698
RemoteConfigProduct::ApmTracing,
699-
RemoteConfigProduct::LiveDebugger,
699+
RemoteConfigProduct::AgentConfig,
700700
],
701701
capabilities: vec![RemoteConfigCapabilities::ApmTracingCustomTags],
702702
};
@@ -727,7 +727,7 @@ pub mod tests {
727727

728728
let client = req.client.as_ref().unwrap();
729729
assert_eq!(client.capabilities, &[128, 0]);
730-
assert_eq!(client.products, &["APM_TRACING", "LIVE_DEBUGGING"]);
730+
assert_eq!(client.products, &["APM_TRACING", "AGENT_CONFIG"]);
731731
assert!(client.is_tracer);
732732
assert!(!client.is_agent);
733733
assert_eq!(client.id, "foo");
@@ -779,7 +779,7 @@ pub mod tests {
779779

780780
let client = req.client.as_ref().unwrap();
781781
assert_eq!(client.capabilities, &[128, 0]);
782-
assert_eq!(client.products, &["APM_TRACING", "LIVE_DEBUGGING"]);
782+
assert_eq!(client.products, &["APM_TRACING", "AGENT_CONFIG"]);
783783
assert!(client.is_tracer);
784784
assert!(!client.is_agent);
785785
assert_eq!(client.id, "foo");

datadog-remote-config/src/fetch/test_server.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ impl RemoteConfigServer {
216216
language: "php".to_string(),
217217
tracer_version: "1.2.3".to_string(),
218218
endpoint: self.endpoint.clone(),
219+
#[cfg(not(feature = "live-debugger"))]
220+
products: vec![RemoteConfigProduct::ApmTracing],
221+
#[cfg(feature = "live-debugger")]
219222
products: vec![
220223
RemoteConfigProduct::ApmTracing,
221224
RemoteConfigProduct::LiveDebugger,

datadog-remote-config/src/parse.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ use crate::{
77
},
88
RemoteConfigPath, RemoteConfigProduct, RemoteConfigSource,
99
};
10+
#[cfg(feature = "live-debugger")]
1011
use datadog_live_debugger::LiveDebuggingData;
1112

1213
#[derive(Debug)]
1314
pub enum RemoteConfigData {
1415
DynamicConfig(DynamicConfigFile),
16+
#[cfg(feature = "live-debugger")]
1517
LiveDebugger(LiveDebuggingData),
1618
TracerFlareConfig(AgentConfigFile),
1719
TracerFlareTask(AgentTaskFile),
@@ -33,6 +35,7 @@ impl RemoteConfigData {
3335
RemoteConfigProduct::ApmTracing => {
3436
RemoteConfigData::DynamicConfig(config::dynamic::parse_json(data)?)
3537
}
38+
#[cfg(feature = "live-debugger")]
3639
RemoteConfigProduct::LiveDebugger => {
3740
let parsed = datadog_live_debugger::parse_json(&String::from_utf8_lossy(data))?;
3841
RemoteConfigData::LiveDebugger(parsed)
@@ -46,6 +49,7 @@ impl From<&RemoteConfigData> for RemoteConfigProduct {
4649
fn from(value: &RemoteConfigData) -> Self {
4750
match value {
4851
RemoteConfigData::DynamicConfig(_) => RemoteConfigProduct::ApmTracing,
52+
#[cfg(feature = "live-debugger")]
4953
RemoteConfigData::LiveDebugger(_) => RemoteConfigProduct::LiveDebugger,
5054
RemoteConfigData::TracerFlareConfig(_) => RemoteConfigProduct::AgentConfig,
5155
RemoteConfigData::TracerFlareTask(_) => RemoteConfigProduct::AgentTask,

datadog-remote-config/src/path.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub enum RemoteConfigProduct {
2323
AsmData,
2424
AsmDD,
2525
AsmFeatures,
26+
#[cfg(feature = "live-debugger")]
2627
LiveDebugger,
2728
}
2829

@@ -36,6 +37,7 @@ impl Display for RemoteConfigProduct {
3637
RemoteConfigProduct::AsmData => "ASM_DATA",
3738
RemoteConfigProduct::AsmDD => "ASM_DD",
3839
RemoteConfigProduct::AsmFeatures => "ASM_FEATURES",
40+
#[cfg(feature = "live-debugger")]
3941
RemoteConfigProduct::LiveDebugger => "LIVE_DEBUGGING",
4042
};
4143
write!(f, "{str}")
@@ -85,6 +87,7 @@ impl RemoteConfigPath {
8587
"ASM_DATA" => RemoteConfigProduct::AsmData,
8688
"ASM_DD" => RemoteConfigProduct::AsmDD,
8789
"ASM_FEATURES" => RemoteConfigProduct::AsmFeatures,
90+
#[cfg(feature = "live-debugger")]
8891
"LIVE_DEBUGGING" => RemoteConfigProduct::LiveDebugger,
8992
product => anyhow::bail!("Unknown product {}", product),
9093
},

datadog-sidecar/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ datadog-sidecar-macros = { path = "../datadog-sidecar-macros" }
2222
ddtelemetry = { path = "../ddtelemetry", features = ["tracing"] }
2323
data-pipeline = { path = "../data-pipeline" }
2424
datadog-trace-utils = { path = "../datadog-trace-utils" }
25-
datadog-remote-config = { path = "../datadog-remote-config" }
25+
datadog-remote-config = { path = "../datadog-remote-config" , features = ["live-debugger"]}
2626
datadog-live-debugger = { path = "../datadog-live-debugger" }
2727
datadog-crashtracker = { path = "../datadog-crashtracker" }
2828
dogstatsd-client = { path = "../dogstatsd-client" }

0 commit comments

Comments
 (0)