prometheus-client-c  0.1.1
Prometheus client for the C programming language
Typedefs | Functions
prom_metric.h File Reference

Functions for retrieving metric samples from metrics given an ordered set of labels. More...

#include "prom_metric_sample.h"
#include "prom_metric_sample_histogram.h"
Include dependency graph for prom_metric.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct prom_metric prom_metric_t
 A prometheus metric. More...
 

Functions

prom_metric_sample_tprom_metric_sample_from_labels (prom_metric_t *self, const char **label_values)
 Returns a prom_metric_sample_t*. More...
 
prom_metric_sample_histogram_tprom_metric_sample_histogram_from_labels (prom_metric_t *self, const char **label_values)
 Returns a prom_metric_sample_histogram_t*. More...
 

Detailed Description

Functions for retrieving metric samples from metrics given an ordered set of labels.

Typedef Documentation

◆ prom_metric_t

typedef struct prom_metric prom_metric_t

A prometheus metric.

Reference: https://prometheus.io/docs/concepts/data_model

Function Documentation

◆ prom_metric_sample_from_labels()

prom_metric_sample_t* prom_metric_sample_from_labels ( prom_metric_t self,
const char **  label_values 
)

Returns a prom_metric_sample_t*.

The order of label_values is significant.

You may use this function to cache metric samples to avoid sample lookup. Metric samples are stored in a hash map with O(1) lookups in average case; nonethless, caching metric samples and updating them directly might be preferrable in performance-sensitive situations.

Parameters
selfThe target prom_metric_t*
label_valuesThe label values associated with the metric sample being updated. The number of labels must match the value passed to 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.
Returns
A prom_metric_sample_t*

◆ prom_metric_sample_histogram_from_labels()

prom_metric_sample_histogram_t* prom_metric_sample_histogram_from_labels ( prom_metric_t self,
const char **  label_values 
)

Returns a prom_metric_sample_histogram_t*.

The order of label_values is significant.

You may use this function to cache metric samples to avoid sample lookup. Metric samples are stored in a hash map with O(1) lookups in average case; nonethless, caching metric samples and updating them directly might be preferrable in performance-sensitive situations.

Parameters
selfThe target prom_histogram_metric_t*
label_valuesThe label values associated with the metric sample being updated. The number of labels must match the value passed to 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.
Returns
prom_metric_sample_histogram_t*