Skip to content

Commit 8e83cf0

Browse files
jukkarnashif
authored andcommitted
net: prometheus: Configure max number of labels from Kconfig
Allow user to configure the label count from Kconfig. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 52a337c commit 8e83cf0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

include/zephyr/net/prometheus/label.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
* @{
1717
*/
1818

19-
/* maximum namber of labels per metric */
20-
#define MAX_PROMETHEUS_LABELS_PER_METRIC 5
19+
#if defined(CONFIG_PROMETHEUS)
20+
/** Maximum number of labels per metric */
21+
#define MAX_PROMETHEUS_LABELS_PER_METRIC CONFIG_PROMETHEUS_LABEL_MAX_COUNT
22+
#else
23+
#define MAX_PROMETHEUS_LABELS_PER_METRIC 1
24+
#endif /* CONFIG_PROMETHEUS */
2125

2226
/**
2327
* @brief Prometheus label definition.

subsys/net/lib/prometheus/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ menuconfig PROMETHEUS
1010

1111
if PROMETHEUS
1212

13+
config PROMETHEUS_LABEL_MAX_COUNT
14+
int "Max label count in metric"
15+
range 1 8
16+
default 1
17+
help
18+
Specify how many labels can be attached to a metric.
19+
1320
module = PROMETHEUS
1421
module-dep = NET_LOG
1522
module-str = Log level for PROMETHEUS

0 commit comments

Comments
 (0)