Skip to main content

encode_histogram

Function encode_histogram 

Source
fn encode_histogram(
    table_writer: &mut MultiTableData,
    name: &str,
    hist: &Histogram,
    resource_attrs: Option<&Vec<KeyValue>>,
    scope_attrs: Option<&Vec<KeyValue>>,
    metric_ctx: &OtlpMetricCtx,
    outcome: &mut MetricsIngestOutcome,
) -> Result<bool>
Expand description

Encode histogram data. This function returns 3 insert requests for 3 tables.

The implementation has been following Prometheus histogram table format:

  • A %metric%_bucket table including greptime_le tag that stores bucket upper limit, and greptime_value for bucket count
  • A %metric%_sum table storing sum of samples
  • A %metric%_count table storing count of samples.

By its Prometheus compatibility, we hope to be able to use prometheus quantile functions on this table. Delta points retain their temporality tag and interval values. Bucket counts are prefix-summed within each point, never accumulated across timestamps.