Skip to content

Commit 5f701de

Browse files
committed
feat(rc): add process_tags to remote config Target
1 parent 3b283c5 commit 5f701de

File tree

11 files changed

+32
-0
lines changed

11 files changed

+32
-0
lines changed

datadog-remote-config/examples/remote_config_fetch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ async fn main() {
3333
env: ENV.to_string(),
3434
app_version: VERSION.to_string(),
3535
tags: vec![Tag::new("test", "value").unwrap()],
36+
process_tags: vec![],
3637
},
3738
RUNTIME_ID.to_string(),
3839
ConfigOptions {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ impl<S: FileStorage> ConfigFetcher<S> {
277277
env,
278278
app_version,
279279
tags,
280+
process_tags,
280281
} = (*target).clone();
281282

282283
let mut cached_target_files = vec![];
@@ -325,6 +326,7 @@ impl<S: FileStorage> ConfigFetcher<S> {
325326
env,
326327
app_version,
327328
tags: tags.iter().map(|t| t.to_string()).collect(),
329+
process_tags: process_tags.iter().map(|t| t.to_string()).collect(),
328330
}),
329331
is_agent: false,
330332
client_agent: None,
@@ -603,6 +605,7 @@ pub mod tests {
603605
env: "env".to_string(),
604606
app_version: "1.3.5".to_string(),
605607
tags: vec![],
608+
process_tags: vec![],
606609
})
607610
});
608611

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ pub mod tests {
385385
env: "env".to_string(),
386386
app_version: "7.8.9".to_string(),
387387
tags: vec![],
388+
process_tags: vec![],
388389
})
389390
});
390391

datadog-remote-config/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub struct Target {
3232
pub env: String,
3333
pub app_version: String,
3434
pub tags: Vec<Tag>,
35+
pub process_tags: Vec<Tag>,
3536
}
3637

3738
#[repr(C)]

datadog-sidecar-ffi/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ pub unsafe extern "C" fn ddog_remote_config_reader_for_endpoint<'a>(
255255
env: env_name.to_utf8_lossy().into(),
256256
app_version: app_version.to_utf8_lossy().into(),
257257
tags: tags.as_slice().to_vec(),
258+
process_tags: vec![],
258259
}),
259260
))
260261
}

datadog-sidecar/src/service/remote_configs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl RemoteConfigs {
110110
app_version: String,
111111
tags: Vec<Tag>,
112112
dynamic_instrumentation_state: DynamicInstrumentationConfigState,
113+
process_tags: Vec<Tag>,
113114
) -> RemoteConfigsGuard {
114115
match self.0.lock_or_panic().entry(options.invariants) {
115116
Entry::Occupied(e) => e.into_mut(),
@@ -148,6 +149,7 @@ impl RemoteConfigs {
148149
capabilities: options.capabilities,
149150
},
150151
dynamic_instrumentation_state,
152+
process_tags,
151153
)
152154
}
153155

datadog-sidecar/src/service/runtime_info.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ impl ActiveApplication {
142142
.as_ref()
143143
.expect("Expecting remote config invariants to be set early")
144144
.clone();
145+
146+
let process_tags = session
147+
.process_tags
148+
.lock_or_panic()
149+
.clone()
150+
.unwrap_or_default();
151+
145152
if *session.remote_config_enabled.lock_or_panic() {
146153
self.remote_config_guard = Some(
147154
remote_configs.add_runtime(
@@ -158,6 +165,14 @@ impl ActiveApplication {
158165
.expect("set_metadata was called before"),
159166
self.global_tags.clone(),
160167
dynamic_instrumentation_state,
168+
process_tags
169+
.split(',')
170+
.filter_map(|s| {
171+
s.split_once(':').and_then(|(key, value)| {
172+
libdd_common::tag::Tag::new(key, value).ok()
173+
})
174+
})
175+
.collect(),
161176
),
162177
);
163178
}

datadog-sidecar/src/shm_remote_config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,14 @@ impl<N: NotifyTarget + 'static> ShmRemoteConfigs<N> {
461461
tags: Vec<Tag>,
462462
product_capabilities: ProductCapabilities,
463463
dynamic_instrumentation_state: DynamicInstrumentationConfigState,
464+
process_tags: Vec<Tag>,
464465
) -> ShmRemoteConfigsGuard<N> {
465466
let target = Arc::new(Target {
466467
service,
467468
env,
468469
app_version,
469470
tags,
471+
process_tags,
470472
});
471473
self.0.add_runtime(
472474
runtime_id.clone(),
@@ -776,6 +778,7 @@ mod tests {
776778
env: "env".to_string(),
777779
app_version: "1.3.5".to_string(),
778780
tags: vec![],
781+
process_tags: vec![],
779782
})
780783
});
781784

@@ -852,6 +855,7 @@ mod tests {
852855
capabilities: server.dummy_options().capabilities,
853856
},
854857
DynamicInstrumentationConfigState::Disabled,
858+
DUMMY_TARGET.process_tags.clone(),
855859
);
856860

857861
receiver.recv().await;

datadog-tracer-flare/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ impl TracerFlareManager {
169169
env,
170170
app_version,
171171
tags: vec![],
172+
process_tags: vec![],
172173
},
173174
runtime_id,
174175
config_to_fetch,

libdd-trace-protobuf/src/pb/remoteconfig.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ message ClientTracer {
3535
string env = 5;
3636
string app_version = 6;
3737
repeated string tags = 7;
38+
repeated string process_tags = 9;
3839
}
3940

4041
message ClientAgent {

0 commit comments

Comments
 (0)