libprom  1.2.0
C based libraries to expose metrics in Promtheus exposition format
prom_gauge.h
Go to the documentation of this file.
1 /*
2 Copyright 2019-2020 DigitalOcean Inc.
3 Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de>
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
23 #ifndef PROM_GAUGE_H
24 #define PROM_GAUGE_H
25 
26 #include <stdlib.h>
27 
28 #include "prom_metric.h"
29 
37 
55 prom_gauge_t *prom_gauge_new(const char *name, const char *help, size_t label_key_count, const char **label_keys);
56 
65 
84 int prom_gauge_inc(prom_gauge_t *self, const char **label_values);
85 
104 int prom_gauge_dec(prom_gauge_t *self, const char **label_values);
105 
125 int prom_gauge_add(prom_gauge_t *self, double r_value, const char **label_values);
126 
146 int prom_gauge_sub(prom_gauge_t *self, double r_value, const char **label_values);
147 
167 int prom_gauge_set(prom_gauge_t *self, double r_value, const char **label_values);
168 
169 #endif // PROM_GAUGE_H
prom_metric.h
Functions for retrieving metric samples from metrics given an ordered set of labels.
prom_gauge_sub
int prom_gauge_sub(prom_gauge_t *self, double r_value, const char **label_values)
Subtract the value to the given gauge.
prom_gauge_dec
int prom_gauge_dec(prom_gauge_t *self, const char **label_values)
Decrement the given gauge by 1.
prom_metric_t
struct prom_metric prom_metric_t
A prometheus metric.
Definition: prom_metric.h:43
prom_gauge_add
int prom_gauge_add(prom_gauge_t *self, double r_value, const char **label_values)
Add the given value to the given gauge.
prom_gauge_destroy
int prom_gauge_destroy(prom_gauge_t *self)
Destroys the given gauge.
prom_gauge_inc
int prom_gauge_inc(prom_gauge_t *self, const char **label_values)
Increment the given gauge by 1.
prom_gauge_t
prom_metric_t prom_gauge_t
Prometheus metric: gauge.
Definition: prom_gauge.h:36
prom_gauge_new
prom_gauge_t * prom_gauge_new(const char *name, const char *help, size_t label_key_count, const char **label_keys)
Construct a new metric of type gauge (or short: gauge).
prom_gauge_set
int prom_gauge_set(prom_gauge_t *self, double r_value, const char **label_values)
Set the given gauge to the given value.