libprom  @VERSION@
C based libraries to expose metrics in Promtheus exposition format
Classes | Typedefs | Functions | Variables
prom_histogram_buckets.h File Reference

https://prometheus.io/docs/concepts/metric_types/#histogram More...

#include "stdlib.h"
Include dependency graph for prom_histogram_buckets.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  phb
 

Typedefs

typedef struct phb phb_t
 

Functions

phb_tphb_new (size_t count, double bucket,...)
 Construct a new histogram bucket with the given values. More...
 
phb_tphb_linear (double start, double width, size_t count)
 Construct a linearly sized prom histogram bucket. More...
 
phb_tphb_exponential (double start, double factor, size_t count)
 Construct an exponentially sized prom histogram bucket. More...
 
int phb_destroy (phb_t *self)
 Destroy the given prom histogram bucket. More...
 
size_t phb_count (phb_t *self)
 Get the number of valus in the given bucket. More...
 

Variables

phb_tprom_histogram_default_buckets
 default histogram buckets: .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10
 

Detailed Description

https://prometheus.io/docs/concepts/metric_types/#histogram

Note
To get rid off braindamaged long names, you may replace prom_histogram_bucket with PHB .

Function Documentation

◆ phb_count()

size_t phb_count ( phb_t self)

Get the number of valus in the given bucket.

Parameters
selfThe bucket to query.
Returns
The number of values in the bucket.

◆ phb_destroy()

int phb_destroy ( phb_t self)

Destroy the given prom histogram bucket.

Parameters
selfThe bucket to destroy.
Returns
Non-zero integer value upon failure, otherwise 0 .
Note
No matter what gets returned, you should never use any bucket passed to this function but set it to NULL .

◆ phb_exponential()

phb_t* phb_exponential ( double  start,
double  factor,
size_t  count 
)

Construct an exponentially sized prom histogram bucket.

Parameters
startThe first inclusive upper bound. The value MUST be > 0.
factorThe factor to apply to the previous upper bound to produce the next upper bound. The value MUST be greater than 1.
countThe total number of buckets. The final +Inf bucket is not counted and not included. The value MUST be greater than or equal to 1.
Returns
The new histogram bucket, or NULL if an error occured.

◆ phb_linear()

phb_t* phb_linear ( double  start,
double  width,
size_t  count 
)

Construct a linearly sized prom histogram bucket.

Parameters
startThe first inclusive upper bound.
widthThe distance between each upper bound.
countThe total number of buckets. The final +Inf bucket is not counted and not included.
Returns
The constructed histogram bucket or NULL if an error occured.

◆ phb_new()

phb_t* phb_new ( size_t  count,
double  bucket,
  ... 
)

Construct a new histogram bucket with the given values.

Parameters
countNumber of buckets.
bucketcount values to add to the bucket.
Returns
The new histogram bucket, or NULL if an error occured.