|
prometheus-client-c
0.1.1
Prometheus client for the C programming language
|
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 |
| A prometheus histogram. More... | |
Functions | |
| prom_histogram_t * | prom_histogram_new (const char *name, const char *help, prom_histogram_buckets_t *buckets, size_t label_key_count, const char **label_keys) |
| Construct a prom_histogram_t*. More... | |
| int | prom_histogram_destroy (prom_histogram_t *self) |
| Destroy a prom_histogram_t*. More... | |
| int | prom_histogram_observe (prom_histogram_t *self, double value, const char **label_values) |
| Observe the prom_histogram_t given the value and labells. More... | |
| typedef prom_metric_t prom_histogram_t |
| int prom_histogram_destroy | ( | prom_histogram_t * | self | ) |
Destroy a prom_histogram_t*.
self MUSTS be set to NULL after destruction. Returns a non-zero integer value upon failure.
| prom_histogram_t* prom_histogram_new | ( | const char * | name, |
| const char * | help, | ||
| prom_histogram_buckets_t * | buckets, | ||
| size_t | label_key_count, | ||
| const char ** | label_keys | ||
| ) |
Construct a prom_histogram_t*.
| name | The name of the metric |
| help | The metric description |
| buckets | The prom_histogram_buckets_t*. See prom_histogram_buckets.h. |
| label_key_count | is the number of labels associated with the given metric. Pass 0 if the metric 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. |
Example
// An example with labels
prom_histogram_buckets_t* buckets = prom_histogram_buckets_linear(5.0, 5.0, 10);
prom_histogram_new("foo", "foo is a counter with labels", buckets, 2, (const char**) { "one", "two" });
// An example without labels
prom_histogram_buckets_t* buckets = prom_histogram_buckets_linear(5.0, 5.0, 10);
prom_histogram_new("foo", "foo is a counter without labels", buckets, 0, NULL);
| int prom_histogram_observe | ( | prom_histogram_t * | self, |
| double | value, | ||
| const char ** | label_values | ||
| ) |
Observe the prom_histogram_t given the value and labells.
| self | The target prom_histogram_t* |
| value | The value to observe |
| 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. |
1.8.13