1 /* 2 * Copyright (c) 2024 Mustafa Abdullah Kus, Sparse Technology 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/net/prometheus/gauge.h> 8 9 #include <stdlib.h> 10 #include <string.h> 11 12 #include <zephyr/kernel.h> 13 14 #include <zephyr/logging/log.h> 15 LOG_MODULE_REGISTER(pm_gauge, CONFIG_PROMETHEUS_LOG_LEVEL); 16 prometheus_gauge_set(struct prometheus_gauge * gauge,double value)17int prometheus_gauge_set(struct prometheus_gauge *gauge, double value) 18 { 19 if (value < 0) { 20 LOG_ERR("Invalid value"); 21 return -EINVAL; 22 } 23 24 if (gauge) { 25 gauge->value = value; 26 } 27 28 return 0; 29 } 30