libprom 1.2.1
C based libraries to expose metrics in Promtheus exposition format
Loading...
Searching...
No Matches
prom_histogram_buckets.h
Go to the documentation of this file.
1/*
2Copyright 2019-2020 DigitalOcean Inc.
3Copyright 2021 Jens Elkner <jel+libprom@cs.uni-magdeburg.de>
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16*/
17
25#include "stdlib.h"
26
27#ifndef PROM_HISTOGRAM_BUCKETS_H
28#define PROM_HISTOGRAM_BUCKETS_H
29
30typedef struct phb {
31 int count;
32 const double *upper_bound;
33 const char **key;
34} phb_t;
35
42phb_t *phb_new(size_t count, double bucket, ...);
43
48
57phb_t *phb_linear(double start, double width, size_t count);
58
68phb_t *phb_exponential(double start, double factor, size_t count);
69
77int phb_destroy(phb_t *self);
78
84size_t phb_count(phb_t *self);
85
86#endif // PROM_HISTOGRAM_BUCKETS_H
int phb_destroy(phb_t *self)
Destroy the given prom histogram bucket.
phb_t * prom_histogram_default_buckets
default histogram buckets: .005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10
phb_t * phb_exponential(double start, double factor, size_t count)
Construct an exponentially sized prom histogram bucket.
phb_t * phb_linear(double start, double width, size_t count)
Construct a linearly sized prom histogram bucket.
size_t phb_count(phb_t *self)
Get the number of valus in the given bucket.
phb_t * phb_new(size_t count, double bucket,...)
Construct a new histogram bucket with the given values.
Definition prom_histogram_buckets.h:30
int count
Number of buckets.
Definition prom_histogram_buckets.h:31
const char ** key
count keys used to lookup samples.
Definition prom_histogram_buckets.h:33
const double * upper_bound
count ascending upper limits
Definition prom_histogram_buckets.h:32