Line data Source code
1 1 : /*
2 : * Copyright (c) 2024 Mustafa Abdullah Kus, Sparse Technology
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : #ifndef ZEPHYR_INCLUDE_PROMETHEUS_FORMATTER_H_
8 : #define ZEPHYR_INCLUDE_PROMETHEUS_FORMATTER_H_
9 :
10 : /**
11 : * @file
12 : *
13 : * @brief Prometheus formatter APIs.
14 : *
15 : * @addtogroup prometheus
16 : * @{
17 : */
18 :
19 : #include <zephyr/net/prometheus/collector.h>
20 :
21 : /**
22 : * @brief Format exposition data for Prometheus
23 : *
24 : * Formats the exposition data collected by the specified collector into the provided buffer.
25 : * Function will format metric data according to Prometheus text-based format
26 : *
27 : * @param collector Pointer to the collector containing the data to format.
28 : * @param buffer Pointer to the buffer where the formatted exposition data will be stored.
29 : * @param buffer_size Size of the buffer.
30 : *
31 : * @return 0 on success, negative errno on error.
32 : */
33 1 : int prometheus_format_exposition(struct prometheus_collector *collector, char *buffer,
34 : size_t buffer_size);
35 :
36 : /**
37 : * @brief Format exposition data for one metric for Prometheus
38 : *
39 : * Formats the exposition data of one specific metric into the provided buffer.
40 : * Function will format metric data according to Prometheus text-based format.
41 : *
42 : * @param metric Pointer to the metric containing the data to format.
43 : * @param buffer Pointer to the buffer where the formatted exposition data will be stored.
44 : * @param buffer_size Size of the buffer.
45 : * @param written How many bytes have been written to the buffer.
46 : *
47 : * @return 0 on success, negative errno on error.
48 : */
49 1 : int prometheus_format_one_metric(struct prometheus_metric *metric, char *buffer,
50 : size_t buffer_size, int *written);
51 :
52 : /**
53 : * @}
54 : */
55 :
56 : #endif /* ZEPHYR_INCLUDE_PROMETHEUS_FORMATTER_H_ */
|