Skip to content

Metrics: explicit-bucket Histogram (fixed buckets β†’ GCounter)Β #1203

Description

@keddie

πŸ€– This comment was generated by Claude on behalf of @keddie.

Part of #1201.

Explicit-bucket Histogram β€” fixed buckets β†’ GCounter

The classic Prometheus-style histogram: the consumer predefines bucket boundaries, and each bucket counts how many observations fell in it. Mergeable form is trivial and reuses machinery we have.

Shape

Histogram β‰ˆ (bucket_boundary β†’ GCounter)   // fixed key set, chosen up front
          + GCounter                        // total count
          + GCounter-of-sum (optional)       // running sum for the mean
  • Buckets are a fixed, config-given set of boundaries β€” the key space never changes.
  • Each bucket is a GCounter so counting is idempotent under anti-entropy re-delivery (the per-source-keyed counting trick; naive count-add double-counts).
  • Merge = per-bucket GCounter merge β€” associative, commutative, idempotent.
  • Serializes to OTLP HistogramDataPoint (explicit bounds + bucket_counts).

Why this exists alongside DDSketch (#1201's sub-issue)

Explicit-bucket vs. DDSketch is a real choice, not redundancy:

  • Explicit β€” you pick boundaries; great when you know the range and want fixed, cheap, predictable buckets. Bad if you guess wrong (p99 lands in one giant low-res bucket).
  • DDSketch (exponential) β€” log buckets auto-cover whatever range appears at uniform relative resolution; better for latency spanning orders of magnitude.

Ship both; they map to two distinct OTel point types (Histogram vs. ExponentialHistogram).

Notes / design surface

  • Bucket boundaries are a cluster-wide constant (like Ξ± for DDSketch and p for HLL) β€” two histograms merge only if boundaries match. Fixed config, not per-call.
  • Decide whether to carry sum and min/max (OTLP allows optional min/max) β€” min/max are not cleanly mergeable as CRDTs unless done as separate min/max-registers; call it out.

Acceptance

  • bucket β†’ GCounter histogram with fixed boundaries + total count (+ optional sum).
  • OTLP HistogramDataPoint serialization.
  • Tests: record/merge, per-bucket idempotency under re-merge, boundary-mismatch rejection.

Placement (zoo vs. exporter-local) is resolved once for the epic β€” see #1201.

Metadata

Metadata

Assignees

No one assigned

    Labels

    readyClear acceptance criteria, ready to implement

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions