1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>prometheus-client-c: prom/include/prom_counter.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">prometheus-client-c
 <span id="projectnumber">0.1.1</span>
</div>
<div id="projectbrief">Prometheus client for the C programming language</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_2c63f04010e7ff462eba5e344f58cd21.html">prom</a></li><li class="navelem"><a class="el" href="dir_83821d63a26a6eb889c4977bd95ca990.html">include</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">prom_counter.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><a href="https://prometheus.io/docs/concepts/metric_types/#counter">https://prometheus.io/docs/concepts/metric_types/#counter</a>
<a href="#details">More...</a></p>
<div class="textblock"><code>#include <stdlib.h></code><br />
<code>#include "<a class="el" href="prom__metric_8h_source.html">prom_metric.h</a>"</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for prom_counter.h:</div>
<div class="dyncontent">
<div class="center"><img src="prom__counter_8h__incl.png" border="0" usemap="#prom_2include_2prom__counter_8h" alt=""/></div>
<map name="prom_2include_2prom__counter_8h" id="prom_2include_2prom__counter_8h">
<area shape="rect" id="node3" href="prom__metric_8h.html" title="Functions for retrieving metric samples from metrics given an ordered set of labels. " alt="" coords="129,80,246,107"/>
<area shape="rect" id="node4" href="prom__metric__sample_8h.html" title="Functions for interfacting with metric samples directly. " alt="" coords="5,162,177,189"/>
<area shape="rect" id="node5" href="prom__metric__sample__histogram_8h.html" title="Functions for interacting with histogram metric samples directly. " alt="" coords="202,155,362,196"/>
</map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dyncontent">
<div class="center"><img src="prom__counter_8h__dep__incl.png" border="0" usemap="#prom_2include_2prom__counter_8hdep" alt=""/></div>
<map name="prom_2include_2prom__counter_8hdep" id="prom_2include_2prom__counter_8hdep">
<area shape="rect" id="node2" href="prom_8h.html" title="Include prom.h to include the entire public API. " alt="" coords="33,80,190,107"/>
</map>
</div>
</div>
<p><a href="prom__counter_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a814ceed99a1d618334e51f4d0e160606"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a></td></tr>
<tr class="memdesc:a814ceed99a1d618334e51f4d0e160606"><td class="mdescLeft"> </td><td class="mdescRight">A prometheus counter. <a href="#a814ceed99a1d618334e51f4d0e160606">More...</a><br /></td></tr>
<tr class="separator:a814ceed99a1d618334e51f4d0e160606"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a3302a9f1a3556d17af9af29729be2651"><td class="memItemLeft" align="right" valign="top"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#a3302a9f1a3556d17af9af29729be2651">prom_counter_new</a> (const char *name, const char *help, size_t label_key_count, const char **label_keys)</td></tr>
<tr class="memdesc:a3302a9f1a3556d17af9af29729be2651"><td class="mdescLeft"> </td><td class="mdescRight">Construct a prom_counter_t*. <a href="#a3302a9f1a3556d17af9af29729be2651">More...</a><br /></td></tr>
<tr class="separator:a3302a9f1a3556d17af9af29729be2651"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac36abc71c11df1e774c8c102b1fdb78d"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#ac36abc71c11df1e774c8c102b1fdb78d">prom_counter_destroy</a> (<a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *self)</td></tr>
<tr class="memdesc:ac36abc71c11df1e774c8c102b1fdb78d"><td class="mdescLeft"> </td><td class="mdescRight">Destroys a prom_counter_t*. <a href="#ac36abc71c11df1e774c8c102b1fdb78d">More...</a><br /></td></tr>
<tr class="separator:ac36abc71c11df1e774c8c102b1fdb78d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a315695fdd8b9b6fa59904bb2e35bfa35"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#a315695fdd8b9b6fa59904bb2e35bfa35">prom_counter_inc</a> (<a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *self, const char **label_values)</td></tr>
<tr class="memdesc:a315695fdd8b9b6fa59904bb2e35bfa35"><td class="mdescLeft"> </td><td class="mdescRight">Increment the prom_counter_t by 1. <a href="#a315695fdd8b9b6fa59904bb2e35bfa35">More...</a><br /></td></tr>
<tr class="separator:a315695fdd8b9b6fa59904bb2e35bfa35"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:addd8a7efc39e17d30b2267e5a0a626db"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="prom__counter_8h.html#addd8a7efc39e17d30b2267e5a0a626db">prom_counter_add</a> (<a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> *self, double r_value, const char **label_values)</td></tr>
<tr class="memdesc:addd8a7efc39e17d30b2267e5a0a626db"><td class="mdescLeft"> </td><td class="mdescRight">Add the value to the prom_counter_t*. <a href="#addd8a7efc39e17d30b2267e5a0a626db">More...</a><br /></td></tr>
<tr class="separator:addd8a7efc39e17d30b2267e5a0a626db"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a href="https://prometheus.io/docs/concepts/metric_types/#counter">https://prometheus.io/docs/concepts/metric_types/#counter</a> </p>
</div><h2 class="groupheader">Typedef Documentation</h2>
<a id="a814ceed99a1d618334e51f4d0e160606"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a814ceed99a1d618334e51f4d0e160606">◆ </a></span>prom_counter_t</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef <a class="el" href="prom__metric_8h.html#afd1bd014c48955d6c2c36aa8a8cbb889">prom_metric_t</a> <a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>A prometheus counter. </p>
<p>References</p><ul>
<li>See <a href="https://prometheus.io/docs/concepts/metric_types/#counter">https://prometheus.io/docs/concepts/metric_types/#counter</a> </li>
</ul>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="addd8a7efc39e17d30b2267e5a0a626db"></a>
<h2 class="memtitle"><span class="permalink"><a href="#addd8a7efc39e17d30b2267e5a0a626db">◆ </a></span>prom_counter_add()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int prom_counter_add </td>
<td>(</td>
<td class="paramtype"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> * </td>
<td class="paramname"><em>self</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">double </td>
<td class="paramname"><em>r_value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char ** </td>
<td class="paramname"><em>label_values</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Add the value to the prom_counter_t*. </p>
<p>A non-zero integer value will be returned on failure. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">self</td><td>The target prom_counter_t* </td></tr>
<tr><td class="paramname">r_value</td><td>The double to add to the prom_counter_t passed as self. The value MUST be greater than or equal to 0. </td></tr>
<tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the counter's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure.</dd></dl>
<p><em>Example</em> </p><pre class="fragment">// An example with labels
prom_counter_add(foo_counter, 22, (const char**) { "bar", "bang" });
// An example without labels
prom_counter_add(foo_counter, 22, NULL);</pre>
</div>
</div>
<a id="ac36abc71c11df1e774c8c102b1fdb78d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac36abc71c11df1e774c8c102b1fdb78d">◆ </a></span>prom_counter_destroy()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int prom_counter_destroy </td>
<td>(</td>
<td class="paramtype"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> * </td>
<td class="paramname"><em>self</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destroys a prom_counter_t*. </p>
<p>You must set self to NULL after destruction. A non-zero integer value will be returned on failure. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">self</td><td>A prom_counter_t* </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure. </dd></dl>
</div>
</div>
<a id="a315695fdd8b9b6fa59904bb2e35bfa35"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a315695fdd8b9b6fa59904bb2e35bfa35">◆ </a></span>prom_counter_inc()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int prom_counter_inc </td>
<td>(</td>
<td class="paramtype"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a> * </td>
<td class="paramname"><em>self</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char ** </td>
<td class="paramname"><em>label_values</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Increment the prom_counter_t by 1. </p>
<p>A non-zero integer value will be returned on failure. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">self</td><td>The target prom_counter_t* </td></tr>
<tr><td class="paramname">label_values</td><td>The label values associated with the metric sample being updated. The number of labels must match the value passed to label_key_count in the counter's constructor. If no label values are necessary, pass NULL. Otherwise, It may be convenient to pass this value as a literal. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A non-zero integer value upon failure.</dd></dl>
<p><em>Example</em> </p><pre class="fragment">// An example with labels
prom_counter_inc(foo_counter, (const char**) { "bar", "bang" });
// An example without labels
prom_counter_inc(foo_counter, NULL);</pre>
</div>
</div>
<a id="a3302a9f1a3556d17af9af29729be2651"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3302a9f1a3556d17af9af29729be2651">◆ </a></span>prom_counter_new()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="prom__counter_8h.html#a814ceed99a1d618334e51f4d0e160606">prom_counter_t</a>* prom_counter_new </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>help</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>label_key_count</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char ** </td>
<td class="paramname"><em>label_keys</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct a prom_counter_t*. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">name</td><td>The name of the metric </td></tr>
<tr><td class="paramname">help</td><td>The metric description </td></tr>
<tr><td class="paramname">label_key_count</td><td>The number of labels associated with the given metric. Pass 0 if the metric does not require labels. </td></tr>
<tr><td class="paramname">label_keys</td><td>A collection of label keys. The number of keys MUST match the value passed as label_key_count. If no labels are required, pass NULL. Otherwise, it may be convenient to pass this value as a literal. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The constructed prom_counter_t*</dd></dl>
<p><em>Example</em> </p><pre class="fragment">// An example with labels
prom_counter_new("foo", "foo is a counter with labels", 2, (const char**) { "one", "two" });
// An example without labels
prom_counter_new("foo", "foo is a counter without labels", 0, NULL);</pre>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
|