lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
MetricExporter.hh File Reference

Prometheus monitoring helpers: exposer creation, a histogram type, and MetricExporter, a collectable that reads application counters on each scrape. More...

#include <iostream>
#include <vector>
#include <chrono>
#include <functional>
#include <prometheus/exposer.h>
#include <prometheus/metric_type.h>
#include <prometheus/metric_family.h>

Classes

struct  Pds::Previous
 Last sample of a Rate metric (value and time), used to compute the rate at the next scrape. More...
 
class  Pds::PromHistogram
 Fixed-bin histogram exported as a Prometheus histogram: numBins upper bounds binMin + i * binWidth plus an overflow bucket. More...
 
class  Pds::MetricExporter
 Prometheus collectable holding named metrics whose values come from callbacks evaluated at each scrape (Collect()). More...
 

Namespaces

namespace  Pds
 Outer namespace of the HSD digitizer helpers.
 

Enumerations

enum class  Pds::MetricType {
  Pds::Gauge , Pds::Counter , Pds::Rate , Pds::Constant ,
  Pds::Histogram , Pds::Float
}
 Kind of a metric registered with MetricExporter. More...
 

Functions

std::unique_ptr< prometheus::Exposer > Pds::createExposer (const std::string &prometheusDir, const std::string &hostname)
 Same as createExposer(prometheusDir, hostname, 0).
 
std::unique_ptr< prometheus::Exposer > Pds::createExposer (const std::string &prometheusDir, const std::string &hostname, unsigned portOffset)
 Start a Prometheus exposer on the first usable port from 9200 + portOffset (wrapping within 9200 to 9299) and write the scrape target file prometheusDir/drpmon_HOST_N.yaml for it.
 
template<typename T >
void Pds::setValue (prometheus::MetricFamily &family, const T &value)
 Set the counter or gauge value of the first metric of family to value; prints wrong type for other metric types.
 

Detailed Description

Prometheus monitoring helpers: exposer creation, a histogram type, and MetricExporter, a collectable that reads application counters on each scrape.