Skip to main content

CompressTelemetry

Struct CompressTelemetry 

Source
pub struct CompressTelemetry {
    pub codec: &'static str,
    pub bytes_in: u64,
    pub bytes_out: u64,
    pub gpu_seconds: Option<f64>,
    pub oom: bool,
}
Expand description

v0.8 #55: per-op telemetry returned by CodecRegistry::compress_with_telemetry / decompress_with_telemetry. Lets the s4-server caller stamp Prometheus metrics (s4_gpu_compress_seconds, s4_gpu_throughput_bytes_per_sec, s4_gpu_oom_total) without s4-codec needing a metrics dep itself — callback pattern keeps the codec dep tree slim.

Fields:

  • codec: stable codec kind name (CodecKind::as_str()"cpu-zstd" / "nvcomp-zstd" / etc).
  • bytes_in: input length to the operation. For compress this is the uncompressed input; for decompress this is the compressed input.
  • bytes_out: output length. For compress = compressed; for decompress = decompressed.
  • gpu_seconds: Some(elapsed_secs) for GPU-backed codecs (Nvcomp*), None for CPU codecs (CpuZstd / Passthrough / CpuGzip). Callers skip the GPU metric stamp when this is None.
  • oom: true iff the operation failed with an OOM-classified error. The associated Result is still Err(...); this flag exists so the stamp helper can tell OOM apart from generic backend errors without introspecting the CodecError chain at the call site.

Fields§

§codec: &'static str§bytes_in: u64§bytes_out: u64§gpu_seconds: Option<f64>§oom: bool

Implementations§

Source§

impl CompressTelemetry

Source

pub fn cpu(codec: &'static str, bytes_in: u64, bytes_out: u64) -> Self

CPU-codec convenience constructor — gpu_seconds = None, oom = false. Used by passthrough / cpu-zstd / cpu-gzip path.

Source

pub fn gpu( codec: &'static str, bytes_in: u64, bytes_out: u64, seconds: f64, ) -> Self

GPU-codec convenience constructor — populates gpu_seconds from the measured wall-clock duration of the inner compress / decompress call.

Source

pub fn with_oom(self) -> Self

Mark this telemetry as the OOM-failure shape — paired with Err(CodecError::Backend(...)). Callers stamp s4_gpu_oom_total{codec=...} when this is true.

Trait Implementations§

Source§

impl Clone for CompressTelemetry

Source§

fn clone(&self) -> CompressTelemetry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CompressTelemetry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for CompressTelemetry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.