Skip to content

Commit

Permalink
Add a function to flush sidecar's telemetry actions (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamluc authored May 27, 2024
1 parent 259ca9c commit d1a9934
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion sidecar-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,30 @@ pub unsafe extern "C" fn ddog_sidecar_telemetry_end(
MaybeError::None
}

// Returns whether the sidecar transport is closed or not.
/// Flushes the telemetry data.
#[no_mangle]
#[allow(clippy::missing_safety_doc)]
pub unsafe extern "C" fn ddog_sidecar_telemetry_flush(
transport: &mut Box<SidecarTransport>,
instance_id: &InstanceId,
queue_id: &QueueId,
) -> MaybeError {
try_c!(blocking::enqueue_actions(
transport,
instance_id,
queue_id,
vec![
SidecarAction::Telemetry(TelemetryActions::Lifecycle(
LifecycleAction::FlushMetricAggr
)),
SidecarAction::Telemetry(TelemetryActions::Lifecycle(LifecycleAction::FlushData)),
],
));

MaybeError::None
}

/// Returns whether the sidecar transport is closed or not.
#[no_mangle]
pub extern "C" fn ddog_sidecar_is_closed(transport: &mut Box<SidecarTransport>) -> bool {
transport.is_closed()
Expand Down

0 comments on commit d1a9934

Please sign in to comment.