Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
summary.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Mustafa Abdullah Kus, Sparse Technology
3 * Copyright (c) 2024 Nordic Semiconductor
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_INCLUDE_PROMETHEUS_SUMMARY_H_
9#define ZEPHYR_INCLUDE_PROMETHEUS_SUMMARY_H_
10
22
23#include <stddef.h>
24
32 double quantile;
34 double value;
36 void *user_data;
37};
38
59
83#define PROMETHEUS_SUMMARY_DEFINE(_name, _desc, _label, _collector, ...) \
84 STRUCT_SECTION_ITERABLE(prometheus_summary, _name) = { \
85 .base.name = STRINGIFY(_name), \
86 .base.type = PROMETHEUS_SUMMARY, \
87 .base.description = _desc, \
88 .base.labels[0] = __DEBRACKET _label, \
89 .base.num_labels = 1, \
90 .base.collector = _collector, \
91 .quantiles = NULL, \
92 .num_quantiles = 0, \
93 .sum = 0.0, \
94 .count = 0U, \
95 .user_data = COND_CODE_0( \
96 NUM_VA_ARGS_LESS_1(LIST_DROP_EMPTY(__VA_ARGS__, _)), \
97 (NULL), \
98 (GET_ARG_N(1, __VA_ARGS__))), \
99 }
100
111
124 double value, unsigned long count);
125
130#endif /* ZEPHYR_INCLUDE_PROMETHEUS_SUMMARY_H_ */
int prometheus_summary_observe(struct prometheus_summary *summary, double value)
Observes a value in a Prometheus summary metric.
int prometheus_summary_observe_set(struct prometheus_summary *summary, double value, unsigned long count)
Set the summary value to specific value.
Prometheus metric interface.
Type used to represent a Prometheus metric base.
Definition metric.h:47
Prometheus summary quantile definition.
Definition summary.h:30
double value
Value of the quantile.
Definition summary.h:34
void * user_data
User data.
Definition summary.h:36
double quantile
Quantile of the summary.
Definition summary.h:32
Type used to represent a Prometheus summary metric.
Definition summary.h:45
struct prometheus_summary_quantile * quantiles
Array of quantiles associated with the Prometheus summary metric.
Definition summary.h:49
unsigned long count
Total count of observations in the summary metric.
Definition summary.h:55
size_t num_quantiles
Number of quantiles associated with the Prometheus summary metric.
Definition summary.h:51
struct prometheus_metric base
Base of the Prometheus summary metric.
Definition summary.h:47
void * user_data
User data.
Definition summary.h:57
double sum
Sum of all observed values in the summary metric.
Definition summary.h:53