Skip to main content

encode_downsampled

Function encode_downsampled 

Source
pub fn encode_downsampled(
    agent_id: String,
    metrics: HashMap<String, Vec<(i64, f64)>>,
    threshold: usize,
) -> Result<Vec<u8>, Box<dyn Error>>
Expand description

Encode metrics with LTTB downsampling

§Arguments

  • agent_id - Agent identifier
  • metrics - Map of metric_name -> [(timestamp, value), …]
  • threshold - LTTB downsampling threshold (points per metric)

§Returns

MessagePack-encoded downsampled metrics ready for HTTP POST