Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 1.44 KB

File metadata and controls

51 lines (41 loc) · 1.44 KB

Native histograms → OTel example

Demonstrates the end-to-end pipeline behind centrifuge.MetricsConfig.EnableNativeHistograms:

Centrifuge metrics (native histograms)
    → prometheus.Registry
    → OTel Prometheus bridge (go.opentelemetry.io/contrib/bridges/prometheus)
    → OTel SDK PeriodicReader
    → stdoutmetric exporter (prints OTel JSON)

The two duration metrics that were historically Summaries — command_duration_seconds and survey_duration_seconds — are now exposed only as Histograms, under their _histogram names. When EnableNativeHistograms is on:

  • Those _histogram metrics switch to native (sparse, exponential) schema.
  • The bridge translates native histograms to OTel ExponentialHistogram — the high-fidelity form most OTel-native backends prefer.

Replace stdoutmetric with otlpmetricgrpc (or any other OTLP exporter) to push to a real backend.

Run

go run .

The active signal is centrifuge_node_survey_duration_seconds_histogram — the demo calls node.Survey(...) in a loop. Look for:

{
  "Name": "centrifuge_node_survey_duration_seconds_histogram",
  "Data": {
    "DataPoints": [{
      "Count": 100,
      "Scale": 3,
      "PositiveBucket": { "Offset": -134, "Counts": [1,1,1,3,5,4,...] },
      ...
    }]
  }
}

The Scale + PositiveBucket.{Offset,Counts} shape is OTel ExponentialHistogram — the form most OTel-native backends ingest with full fidelity.