libprom
1.2.0
C based libraries to expose metrics in Promtheus exposition format
|
Go to the documentation of this file.
23 #ifndef PROM_REGISTRY_H
24 #define PROM_REGISTRY_H
32 #define METRIC_LABEL_SCRAPE "libprom"
35 #define METRIC_NAME_SCRAPE "scrape_duration_seconds"
39 #define COLLECTOR_NAME_DEFAULT "default"
42 #define COLLECTOR_NAME_PROCESS "process"
45 #define REGISTRY_NAME_DEFAULT "default"
91 #define PROM_COLLECTOR_REGISTRY_DEFAULT PROM_COLLECTOR_REGISTRY
int pcr_enable_process_metrics(pcr_t *self)
Enable process metrics on the given collector registry.
@ PROM_NONE
placeholder for 0 - implies nothing
Definition: prom_collector_registry.h:53
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_SCRAPETIME_ALL
Implies PROM_SCRAPETIME, but measures and dumps the dump time of every single collector as well.
Definition: prom_collector_registry.h:67
struct pcr pcr_t
A prom_registry_t is responsible for registering metrics and briding them to the string exposition fo...
Definition: prom_collector_registry.h:83
prom_collector_t * pcr_get(pcr_t *self, const char *name)
Get a reference to the prom collector with the given name from the given prom collector registry.
@ PROM_COMPACT
Omit any "# HELP" and "# TYPE" lines in metric exports.
Definition: prom_collector_registry.h:72
int pcr_enable_scrape_metrics(pcr_t *self)
Create a scrape duration gauge metric and attach it to the given prom collector registry.
pcr_t * PROM_COLLECTOR_REGISTRY
Initialize the default registry by calling pcr_init() within your app.
int pcr_init(PROM_INIT_FLAGS features, const char *mprefix)
Initializes the default collector registry PROM_COLLECTOR_REGISTRY named REGISTRY_NAME_DEFAULT.
A prom_collector is used to collect metrics.
char * pcr_bridge(pcr_t *self)
Export all relevant metrics registered with the given registry in the default metric exposition forma...
unsigned int PROM_INIT_FLAGS
collection of prom collector registry features.
Definition: prom_collector_registry.h:78
int pcr_register_metric(prom_metric_t *metric)
Registers a metric with the default collector on PROM_COLLECTOR_REGISTRY.
int pcr_default_init(void)
Initializes the default collector registry.
prom_init_flag
flags for the setup of a prom collector registry.
Definition: prom_collector_registry.h:51
@ PROM_PROCESS
Automatically setup and attach a process collector, which collects stats of this process on pcr_bridg...
Definition: prom_collector_registry.h:57
int pcr_destroy(pcr_t *self)
Destroy the given collector registry.
int pcr_validate_metric_name(pcr_t *self, const char *metric_name)
Validates that the given metric name complies with the specification:
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
int pcr_register_collector(pcr_t *self, prom_collector_t *collector)
Register a collector with the given registry.
pcr_t * pcr_new(const char *name)
Constructs a registry named default which contains one empty prom collector named default ,...
int pcr_check_name(const char *name, bool is_label)
Check whether the given label | metric name complies with the specification:
@ PROM_SCRAPETIME
Automatically create and use a metric to monitor the time needed to dump all the metrics of all regis...
Definition: prom_collector_registry.h:63
prom_metric_t * pcr_must_register_metric(prom_metric_t *metric)
Registers a metric with the default collector on PROM_COLLECTOR_REGISTRY.