libprom
1.2.0
C based libraries to expose metrics in Promtheus exposition format
|
Go to the documentation of this file.
18 #ifndef PROM_COLLECTOR_H
19 #define PROM_COLLECTOR_H
21 #include <sys/types.h>
83 prom_collector_t *
ppc_new(
const char *limits_path,
const char *stat_path, pid_t pid,
const char **label_keys,
const char **label_vals);
163 #endif // PROM_COLLECTOR_H
int prom_collector_add_metric(prom_collector_t *self, prom_metric_t *metric)
Add the given metric to the given collector.
prom_collector_t * ppc_new(const char *limits_path, const char *stat_path, pid_t pid, const char **label_keys, const char **label_vals)
Create a prom collector which includes the default process metrics.
Functions for retrieving metric samples from metrics given an ordered set of labels.
struct prom_metric prom_metric_t
A prometheus metric.
Definition: prom_metric.h:43
prom_collector_t * prom_collector_new(const char *name)
Create a collector.
int prom_collector_destroy_generic(void *gen)
Cast the given pointer to prom_collector_t and call prom_collector_destroy() with it.
void prom_collector_free_data_fn(prom_collector_t *self)
The function to use to cleanup and free custom data attached via prom_collector_data_set().
Definition: prom_collector.h:56
void * prom_collector_data_set(prom_collector_t *self, void *data, prom_collector_free_data_fn *fn)
Attach custom data to the given collector as well as the callback to use to clean it up.
void prom_collector_free_generic(void *gen)
Same as prom_collector_destroy_generic(), but drops any return codes.
prom_map_t * prom_collector_metrics_get(prom_collector_t *self)
Get a map of all metrics of the given collector keyed by their names.
void * prom_collector_data_get(prom_collector_t *self)
Get the pointer to the custom data attached to the given collector.
prom_map_t * prom_collect_fn(prom_collector_t *self)
The function used to prepare and return all relevant metrics of the given collector ready for Prometh...
Definition: prom_collector.h:47
int prom_collector_set_collect_fn(prom_collector_t *self, prom_collect_fn *fn)
Set the function, which prepares (if needed) and returns all relevant metrics of the given collector ...
int prom_collector_destroy(prom_collector_t *self)
Destroy the given collector including all attached metrics.
struct prom_collector prom_collector_t
A prom collector calls collect to prepare metrics and return them to the registry to which it is regi...
Definition: prom_collector.h:34