lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::PromHistogram Class Reference

Fixed-bin histogram exported as a Prometheus histogram: numBins upper bounds binMin + i * binWidth plus an overflow bucket. More...

#include <MetricExporter.hh>

Public Types

using BucketBoundaries = std::vector< double >
 Upper bounds of the buckets.
 

Public Member Functions

 PromHistogram (unsigned numBins, double binWidth, double binMin)
 Set numBins upper bounds starting at binMin with spacing binWidth, and numBins + 1 zeroed counts (the last is the overflow bucket).
 
void observe (double value)
 Count value in the first bucket whose upper bound is at least value (the overflow bucket if none) and add it to the sum.
 
void collect (prometheus::MetricFamily &family)
 Fill the histogram buckets (cumulative counts, upper bounds with infinity for the last), sample count and sum of the first metric in family.
 
void clear ()
 Zero all counts and the sum.
 
uint64_t counts (unsigned idx) const
 Return the count of bucket idx.
 
void dump () const
 Print the count of every bucket to stdout.
 

Detailed Description

Fixed-bin histogram exported as a Prometheus histogram: numBins upper bounds binMin + i * binWidth plus an overflow bucket.

Member Typedef Documentation

◆ BucketBoundaries

using Pds::PromHistogram::BucketBoundaries = std::vector<double>

Upper bounds of the buckets.

Constructor & Destructor Documentation

◆ PromHistogram()

Pds::PromHistogram::PromHistogram ( unsigned  numBins,
double  binWidth,
double  binMin 
)

Set numBins upper bounds starting at binMin with spacing binWidth, and numBins + 1 zeroed counts (the last is the overflow bucket).

Member Function Documentation

◆ clear()

void Pds::PromHistogram::clear ( )

Zero all counts and the sum.

◆ collect()

void Pds::PromHistogram::collect ( prometheus::MetricFamily &  family)

Fill the histogram buckets (cumulative counts, upper bounds with infinity for the last), sample count and sum of the first metric in family.

◆ counts()

uint64_t Pds::PromHistogram::counts ( unsigned  idx) const
inline

Return the count of bucket idx.

◆ dump()

void Pds::PromHistogram::dump ( ) const

Print the count of every bucket to stdout.

◆ observe()

void Pds::PromHistogram::observe ( double  value)

Count value in the first bucket whose upper bound is at least value (the overflow bucket if none) and add it to the sum.


The documentation for this class was generated from the following file: