Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
histogram.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_HISTOGRAM_H_
9#define ZEPHYR_INCLUDE_PROMETHEUS_HISTOGRAM_H_
10
22
23#include <stddef.h>
24
34 unsigned long count;
35};
36
57
79#define PROMETHEUS_HISTOGRAM_DEFINE(_name, _desc, _label, _collector, ...) \
80 STRUCT_SECTION_ITERABLE(prometheus_histogram, _name) = { \
81 .base.name = STRINGIFY(_name), \
82 .base.type = PROMETHEUS_HISTOGRAM, \
83 .base.description = _desc, \
84 .base.labels[0] = __DEBRACKET _label, \
85 .base.num_labels = 1, \
86 .base.collector = _collector, \
87 .buckets = NULL, \
88 .num_buckets = 0, \
89 .sum = 0.0, \
90 .count = 0U, \
91 .user_data = COND_CODE_0( \
92 NUM_VA_ARGS_LESS_1(LIST_DROP_EMPTY(__VA_ARGS__, _)), \
93 (NULL), \
94 (GET_ARG_N(1, __VA_ARGS__))), \
95 }
96
106int prometheus_histogram_observe(struct prometheus_histogram *histogram, double value);
107
112#endif /* ZEPHYR_INCLUDE_PROMETHEUS_HISTOGRAM_H_ */
int prometheus_histogram_observe(struct prometheus_histogram *histogram, double value)
Observe a value in a Prometheus histogram metric.
Prometheus metric interface.
Prometheus histogram bucket definition.
Definition histogram.h:30
unsigned long count
Cumulative count of observations in the bucket.
Definition histogram.h:34
double upper_bound
Upper bound value of bucket.
Definition histogram.h:32
Type used to represent a Prometheus histogram metric.
Definition histogram.h:43
size_t num_buckets
Number of buckets in the histogram.
Definition histogram.h:49
void * user_data
User data.
Definition histogram.h:55
struct prometheus_histogram_bucket * buckets
Array of buckets in the histogram.
Definition histogram.h:47
double sum
Sum of all observed values in the histogram.
Definition histogram.h:51
unsigned long count
Total count of observations in the histogram.
Definition histogram.h:53
struct prometheus_metric base
Base of the Prometheus histogram metric.
Definition histogram.h:45
Type used to represent a Prometheus metric base.
Definition metric.h:47