libprom  @VERSION@
C based libraries to expose metrics in Promtheus exposition format
Defines | Typedefs | Functions
prom/include/prom_metric.h File Reference

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

#include <math.h>
#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.

Defines

#define NaN   (0.0f / 0.0f)

Typedefs

typedef struct prom_metric prom_metric_t
 A prometheus metric.

Functions

pms_tpms_from_labels (prom_metric_t *self, const char **label_values)
 Get a prom metric sample by label values.
pms_histogram_tpms_histogram_from_labels (prom_metric_t *self, const char **label_values)
 Get a prom histogram metric sample by label values.

Detailed Description

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


Typedef Documentation

typedef struct prom_metric prom_metric_t

A prometheus metric.

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


Function Documentation

pms_t* pms_from_labels ( prom_metric_t self,
const char **  label_values 
)

Get a prom metric sample by label values.

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:
selfMetric to use for lookup.
label_valueslabel values associated with the metric sample being searched. 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:
The sample found, NULL otherwise.
pms_histogram_t* pms_histogram_from_labels ( prom_metric_t self,
const char **  label_values 
)

Get a prom histogram metric sample by label values.

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:
selfMetric to use for lookup.
label_valueslabel values associated with the metric sample being searched. 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:
The histogram sample found, NULL otherwise.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines