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


Go to the source code of this file.
Typedefs | |
| typedef prom_metric_t | prom_counter_t |
| Prometheus metric: counter. More... | |
Functions | |
| prom_counter_t * | prom_counter_new (const char *name, const char *help, size_t label_key_count, const char **label_keys) |
Construct a new metric of type counter (or short: counter). More... | |
| int | prom_counter_destroy (prom_counter_t *self) |
| Destroys the given counter. More... | |
| int | prom_counter_inc (prom_counter_t *self, const char **label_values) |
| Increment the given counter by 1. More... | |
| int | prom_counter_add (prom_counter_t *self, double r_value, const char **label_values) |
| Add the value to the give counter. More... | |
| int | prom_counter_reset (prom_counter_t *self, double r_value, const char **label_values) |
| Reset the given counter to the given value. More... | |
| typedef prom_metric_t prom_counter_t |
Prometheus metric: counter.
References
| int prom_counter_add | ( | prom_counter_t * | self, |
| double | r_value, | ||
| const char ** | label_values | ||
| ) |
Add the value to the give counter.
| self | Where to add the value. |
| r_value | Value to add. MUST be >= 0. |
| label_values | The label values associated with the counter sample being updated. The number of labels must match the value passed as label_key_count in the counter's constructor. If no label values are necessary, pass NULL. Otherwise, it may be convenient to pass this value as a literal. |
0 otherwise.Example
// An example with labels prom_counter_add(foo_counter, 22, (const char**) { "bar", "bang" });
// An example without labels prom_counter_add(foo_counter, 22, NULL);
| int prom_counter_destroy | ( | prom_counter_t * | self | ) |
Destroys the given counter.
| self | Counter to destroy. |
0 otherwise. NULL . | int prom_counter_inc | ( | prom_counter_t * | self, |
| const char ** | label_values | ||
| ) |
Increment the given counter by 1.
| self | counter to increment. |
| label_values | The label values associated with the counter sample being updated. The number of labels must match the value passed as label_key_count in the counter's constructor. If no label values are necessary, pass NULL. Otherwise, it may be convenient to pass this value as a literal. |
0 otherwise.Example
// An example with labels prom_counter_inc(foo_counter, (const char**) { "bar", "bang" });
// An example without labels prom_counter_inc(foo_counter, NULL);
| prom_counter_t* prom_counter_new | ( | const char * | name, |
| const char * | help, | ||
| size_t | label_key_count, | ||
| const char ** | label_keys | ||
| ) |
Construct a new metric of type counter (or short: counter).
| name | Name of the counter. |
| help | Short counter description. |
| label_key_count | The number of labels associated with the given counter. Pass 0 if the counter 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 prom_counter_new("foo", "foo is a counter with labels", 2, (const char**) { "one", "two" });
// An example without labels prom_counter_new("foo", "foo is a counter without labels", 0, NULL);
| int prom_counter_reset | ( | prom_counter_t * | self, |
| double | r_value, | ||
| const char ** | label_values | ||
| ) |
Reset the given counter to the given value.
| self | Where to set the given value. |
| r_value | Value to set. MUST be >= 0. |
| label_values | The label values associated with the counter sample being updated. The number of labels must match the value passed as label_key_count in the counter'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