|
libprom
1.2.0
C based libraries to expose metrics in Promtheus exposition format
|
https://prometheus.io/docs/concepts/metric_types/#histogram More...


Go to the source code of this file.
Typedefs | |
| typedef prom_metric_t | prom_histogram_t |
| Prometheus metric: histogram. More... | |
Functions | |
| prom_histogram_t * | prom_histogram_new (const char *name, const char *help, phb_t *buckets, size_t label_key_count, const char **label_keys) |
Construct a new metric of type histogram (or short: histogram) More... | |
| int | prom_histogram_destroy (prom_histogram_t *self) |
| Destroy the given histogram. More... | |
| int | prom_histogram_observe (prom_histogram_t *self, double value, const char **label_values) |
| Observe the given value of the given histogram with the given labels. More... | |
| typedef prom_metric_t prom_histogram_t |
Prometheus metric: histogram.
References
| int prom_histogram_destroy | ( | prom_histogram_t * | self | ) |
Destroy the given histogram.
0 otherwise. NULL . | prom_histogram_t* prom_histogram_new | ( | const char * | name, |
| const char * | help, | ||
| phb_t * | buckets, | ||
| size_t | label_key_count, | ||
| const char ** | label_keys | ||
| ) |
Construct a new metric of type histogram (or short: histogram)
| name | Name of the histogram. |
| help | Sort histogram description. |
| buckets | Buckets to assign. See prom_histogram_buckets.h . |
| label_key_count | The number of labels associated with the given histogram. Pass 0 if the histogram does not require labels. |
| label_keys | A collection of label keys. The number of keys MUST match the value passed as label_key_count. If no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a literal. |
NULL otherwise.Example
// An example with labels phb_t* buckets = phb_linear(5.0, 5.0, 10); prom_histogram_new("foo", "foo is a histogram with labels", buckets, 2, (const char**) { "one", "two" });
// An example without labels phb_t* buckets = phb_linear(5.0, 5.0, 10); prom_histogram_new("foo", "foo is a histogram without labels", buckets, 0, NULL);
| int prom_histogram_observe | ( | prom_histogram_t * | self, |
| double | value, | ||
| const char ** | label_values | ||
| ) |
Observe the given value of the given histogram with the given labels.
| self | Histogram to observe. |
| value | Value to observe. |
| label_values | The label values associated with the histogram sample being updated. The number of labels must match the value passed as label_key_count in the histogram's constructor. If no label values are necessary, pass NULL. Otherwise, it may be convenient to pass this value as a literal. |
0 otherwise.
1.8.17