Skip to content

Commit bca1af9

Browse files
committed
PR comments
Signed-off-by: Bob Weinand <[email protected]>
1 parent 28c3df1 commit bca1af9

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

datadog-ipc-macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ fn gen_serve_fn(
275275
#[cfg(target_os = "linux")]
276276
{
277277
__pending_acks += 1;
278-
if #force_flush || __pending_acks >= 20 {
278+
if #force_flush || __pending_acks >= datadog_ipc::ACK_BUFFER_SIZE {
279279
datadog_ipc::send_acks_async(&async_fd, __pending_acks).await;
280280
__pending_acks = 0;
281281
}

datadog-ipc/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ pub mod codec;
1919
pub use client::IpcClientConn;
2020
#[cfg(target_os = "linux")]
2121
pub use platform::send_acks_async;
22+
23+
/// Maximum number of 1-byte acks buffered per connection before a forced flush.
24+
/// Must match the `MAX_BATCH` limit inside `send_acks_async`.
25+
pub const ACK_BUFFER_SIZE: u32 = 20;
2226
pub use platform::{
2327
max_message_size, AsyncConn, PeerCredentials, SeqpacketConn, SeqpacketListener,
2428
HANDLE_SUFFIX_SIZE,

datadog-ipc/src/platform/unix/sockets/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ pub async fn send_raw_async(fd: &AsyncConn, data: &[u8]) -> io::Result<()> {
515515
/// waiting for all outstanding ones at the next blocking call.
516516
#[cfg(target_os = "linux")]
517517
pub async fn send_acks_async(fd: &AsyncConn, count: u32) {
518-
const MAX_BATCH: usize = 20;
518+
const MAX_BATCH: usize = crate::ACK_BUFFER_SIZE as usize;
519519
let count = (count as usize).min(MAX_BATCH);
520520
if count == 0 {
521521
return;

datadog-sidecar/src/service/sidecar_server.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ impl SidecarInterface for ConnectionSidecarHandler {
448448
};
449449
let mut telemetry_guard = telemetry_mutex.lock_or_panic();
450450
let Some(telemetry) = telemetry_guard.as_mut() else {
451-
return; // extremely rare: stopped again between the two get_or_create calls
451+
// Extremely rare: the client was stopped between the two get_or_create calls.
452+
warn!("enqueue_actions: telemetry client stopped during retry for instance {instance_id:?}; dropping actions");
453+
return;
452454
};
453455

454456
// Auto-register any metrics known to this connection but not yet registered

0 commit comments

Comments
 (0)