Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
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_NET_PROMETHEUS_SUMMARY_H_
9
#define ZEPHYR_INCLUDE_NET_PROMETHEUS_SUMMARY_H_
10
19
20
#include <
zephyr/sys/iterable_sections.h
>
21
#include <
zephyr/net/prometheus/metric.h
>
22
23
#include <stddef.h>
24
30
struct
prometheus_summary_quantile
{
32
double
quantile
;
34
double
value
;
36
void
*
user_data
;
37
};
38
45
struct
prometheus_summary
{
47
struct
prometheus_metric
base
;
49
struct
prometheus_summary_quantile
*
quantiles
;
51
size_t
num_quantiles
;
53
double
sum
;
55
unsigned
long
count
;
57
void
*
user_data
;
58
};
59
82
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
110
int
prometheus_summary_observe
(
struct
prometheus_summary
*summary,
double
value
);
111
123
int
prometheus_summary_observe_set
(
struct
prometheus_summary
*summary,
124
double
value
,
unsigned
long
count);
125
129
130
#endif
/* ZEPHYR_INCLUDE_NET_PROMETHEUS_SUMMARY_H_ */
prometheus_summary_observe
int prometheus_summary_observe(struct prometheus_summary *summary, double value)
Observes a value in a Prometheus summary metric.
prometheus_summary_observe_set
int prometheus_summary_observe_set(struct prometheus_summary *summary, double value, unsigned long count)
Set the summary value to specific value.
metric.h
Prometheus metric interface.
prometheus_metric
Type used to represent a Prometheus metric base.
Definition
metric.h:47
prometheus_summary_quantile
Prometheus summary quantile definition.
Definition
summary.h:30
prometheus_summary_quantile::value
double value
Value of the quantile.
Definition
summary.h:34
prometheus_summary_quantile::user_data
void * user_data
User data.
Definition
summary.h:36
prometheus_summary_quantile::quantile
double quantile
Quantile of the summary.
Definition
summary.h:32
prometheus_summary
Type used to represent a Prometheus summary metric.
Definition
summary.h:45
prometheus_summary::quantiles
struct prometheus_summary_quantile * quantiles
Array of quantiles associated with the Prometheus summary metric.
Definition
summary.h:49
prometheus_summary::count
unsigned long count
Total count of observations in the summary metric.
Definition
summary.h:55
prometheus_summary::num_quantiles
size_t num_quantiles
Number of quantiles associated with the Prometheus summary metric.
Definition
summary.h:51
prometheus_summary::base
struct prometheus_metric base
Base of the Prometheus summary metric.
Definition
summary.h:47
prometheus_summary::user_data
void * user_data
User data.
Definition
summary.h:57
prometheus_summary::sum
double sum
Sum of all observed values in the summary metric.
Definition
summary.h:53
iterable_sections.h
Iterable sections helpers.
zephyr
net
prometheus
summary.h
Generated on
for Zephyr API by
1.17.0