prometheus-client-c
0.1.1
Prometheus client for the C programming language
|
The collector registry registers collectors for metric exposition. More...
Go to the source code of this file.
Typedefs | |
typedef struct prom_collector_registry | prom_collector_registry_t |
A prom_registry_t is responsible for registering metrics and briding them to the string exposition format. | |
Functions | |
int | prom_collector_registry_default_init (void) |
Initializes the default collector registry and enables metric collection on the executing process. More... | |
prom_collector_registry_t * | prom_collector_registry_new (const char *name) |
Constructs a prom_collector_registry_t*. More... | |
int | prom_collector_registry_destroy (prom_collector_registry_t *self) |
Destroy a collector registry. More... | |
int | prom_collector_registry_enable_process_metrics (prom_collector_registry_t *self) |
Enable process metrics on the given collector registry. More... | |
prom_metric_t * | prom_collector_registry_must_register_metric (prom_metric_t *metric) |
Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY. More... | |
int | prom_collector_registry_register_metric (prom_metric_t *metric) |
Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY. More... | |
int | prom_collector_registry_register_collector (prom_collector_registry_t *self, prom_collector_t *collector) |
Register a collector with the given registry. More... | |
const char * | prom_collector_registry_bridge (prom_collector_registry_t *self) |
Returns a string in the default metric exposition format. More... | |
int | prom_collector_registry_validate_metric_name (prom_collector_registry_t *self, const char *metric_name) |
Validates that the given metric name complies with the specification: More... | |
Variables | |
prom_collector_registry_t * | PROM_COLLECTOR_REGISTRY_DEFAULT |
Initialize the default registry by calling prom_collector_registry_init within your program. More... | |
The collector registry registers collectors for metric exposition.
const char* prom_collector_registry_bridge | ( | prom_collector_registry_t * | self | ) |
Returns a string in the default metric exposition format.
The string MUST be freed to avoid unnecessary heap memory growth.
Reference: https://prometheus.io/docs/instrumenting/exposition_formats/
self | The target prom_collector_registry_t* |
int prom_collector_registry_default_init | ( | void | ) |
Initializes the default collector registry and enables metric collection on the executing process.
int prom_collector_registry_destroy | ( | prom_collector_registry_t * | self | ) |
Destroy a collector registry.
You MUST set self to NULL after destruction.
self | The target prom_collector_registry_t* |
int prom_collector_registry_enable_process_metrics | ( | prom_collector_registry_t * | self | ) |
Enable process metrics on the given collector registry.
self | The target prom_collector_registry_t* |
prom_metric_t* prom_collector_registry_must_register_metric | ( | prom_metric_t * | metric | ) |
Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY.
The metric to be registered MUST NOT already be registered with the given . If so, the program will halt. It returns a prom_metric_t* to simplify metric creation and registration. Furthermore, PROM_DEFAULT_COLLECTOR_REGISTRY must be registered via prom_collector_registry_default_init() prior to calling this function. The metric will be added to the default registry's default collector.
metric | The metric to register on PROM_DEFAULT_COLLECTOR_REGISTRY* |
prom_collector_registry_t* prom_collector_registry_new | ( | const char * | name | ) |
Constructs a prom_collector_registry_t*.
name | The name of the collector registry. It MUST NOT be default. |
int prom_collector_registry_register_collector | ( | prom_collector_registry_t * | self, |
prom_collector_t * | collector | ||
) |
Register a collector with the given registry.
Returns a non-zero integer value on failure.
self | The target prom_collector_registry_t* |
collector | The prom_collector_t* to register onto the prom_collector_registry_t* as self |
int prom_collector_registry_register_metric | ( | prom_metric_t * | metric | ) |
Registers a metric with the default collector on PROM_DEFAULT_COLLECTOR_REGISTRY.
Returns an non-zero integer value on failure.
See prom_collector_registry_must_register_metric.
metric | The metric to register on PROM_DEFAULT_COLLECTOR_REGISTRY* |
int prom_collector_registry_validate_metric_name | ( | prom_collector_registry_t * | self, |
const char * | metric_name | ||
) |
Validates that the given metric name complies with the specification:
Reference: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels
Returns a non-zero integer value on failure.
self | The target prom_collector_registry_t* |
metric_name | The metric name to validate |
prom_collector_registry_t* PROM_COLLECTOR_REGISTRY_DEFAULT |
Initialize the default registry by calling prom_collector_registry_init within your program.
You MUST NOT modify this value.