libprom  @VERSION@
C based libraries to expose metrics in Promtheus exposition format
prom_counter.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 
18 #ifndef PROM_COUNTER_H
19 #define PROM_COUNTER_H
20 
21 #include <stdlib.h>
22 
23 #include "prom_metric.h"
24 
37 
57 prom_counter_t *prom_counter_new(const char *name, const char *help, size_t label_key_count, const char **label_keys);
58 
67 
86 int prom_counter_inc(prom_counter_t *self, const char **label_values);
87 
107 int prom_counter_add(prom_counter_t *self, double r_value, const char **label_values);
108 
120 int prom_counter_reset(prom_counter_t *self, double r_value, const char **label_values);
121 
122 #endif // PROM_COUNTER_H
int prom_counter_add(prom_counter_t *self, double r_value, const char **label_values)
Add the value to the give counter.
int prom_counter_inc(prom_counter_t *self, const char **label_values)
Increment the given counter by 1.
struct prom_metric prom_metric_t
A prometheus metric.
Definition: prom_metric.h:43
prom_metric_t prom_counter_t
Prometheus metric: counter.
Definition: prom_counter.h:36
int prom_counter_reset(prom_counter_t *self, double r_value, const char **label_values)
Reset the given counter to the given value.
int prom_counter_destroy(prom_counter_t *self)
Destroys the given counter.
Functions for retrieving metric samples from metrics given an ordered set of labels.
prom_counter_t * prom_counter_new(const char *name, const char *help, size_t label_key_count, const char **label_keys)
Construct a new metric of type counter (or short: counter).