The library provides Prometheus metrics types, collector and exposion formatter. The library isn't thread-safe for now. The next first pull request will support that. Can be use exposion formatted output with Zephyr Http server. Signed-off-by: Mustafa Abdullah Kus <mustafa.kus@sparsetechnology.com>
29 lines
477 B
C
29 lines
477 B
C
/*
|
|
* Copyright (c) 2024 Mustafa Abdullah Kus, Sparse Technology
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <zephyr/net/prometheus/counter.h>
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <zephyr/kernel.h>
|
|
|
|
#include <zephyr/logging/log.h>
|
|
LOG_MODULE_REGISTER(pm_counter, CONFIG_PROMETHEUS_LOG_LEVEL);
|
|
|
|
int prometheus_counter_inc(struct prometheus_counter *counter)
|
|
{
|
|
if (!counter) {
|
|
return -EINVAL;
|
|
}
|
|
|
|
if (counter) {
|
|
counter->value++;
|
|
}
|
|
|
|
return 0;
|
|
}
|