Couchbase C Client  3.3.10
Asynchronous C Client for Couchbase
metrics.h
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright 2017-2020 Couchbase, Inc.
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 LCB_METRICS_H
19 #define LCB_METRICS_H
20 
21 // As part of implementation of metrics and tracing, the metrics.h file was moved to
22 // the iometrics.h file. To ensure backwards compatibility, we include iometrics.h.
23 #include <libcouchbase/iometrics.h>
24 
25 #include <libcouchbase/error.h>
26 #include <libcouchbase/visibility.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 #define LCBTRACE_F_LOGGING 0x01
36 
64 typedef struct {
65  const char *key;
66  const char *value;
68 
75 typedef struct lcbmetrics_VALUERECORDER_ lcbmetrics_VALUERECORDER;
76 
92 typedef struct lcbmetrics_METER_ lcbmetrics_METER;
93 
104 typedef const lcbmetrics_VALUERECORDER *(*lcbmetrics_VALUE_RECORDER_CALLBACK)(const lcbmetrics_METER *meter,
105  const char *name,
106  const lcbmetrics_TAG *tags, size_t ntags);
107 
118 typedef void (*lcbmetrics_RECORD_VALUE)(const lcbmetrics_VALUERECORDER *recorder, uint64_t value);
119 
127 LIBCOUCHBASE_API
128 lcb_STATUS lcbmetrics_valuerecorder_create(lcbmetrics_VALUERECORDER **recorder, void *cookie);
129 
137 LIBCOUCHBASE_API
138 lcb_STATUS lcbmetrics_valuerecorder_dtor_callback(lcbmetrics_VALUERECORDER *recorder,
139  void (*callback)(const lcbmetrics_VALUERECORDER *recorder));
140 
148 LIBCOUCHBASE_API lcb_STATUS lcbmetrics_valuerecorder_record_value_callback(lcbmetrics_VALUERECORDER *recorder,
149  lcbmetrics_RECORD_VALUE callback);
150 
157 LIBCOUCHBASE_API
158 lcb_STATUS lcbmetrics_valuerecorder_cookie(const lcbmetrics_VALUERECORDER *recorder, void **cookie);
159 
170 LIBCOUCHBASE_API
171 void lcbmetrics_valuerecorder_destroy(const lcbmetrics_VALUERECORDER *recorder);
172 
182 LIBCOUCHBASE_API
183 lcb_STATUS lcbmetrics_meter_create(lcbmetrics_METER **meter, void *cookie);
184 
192 LIBCOUCHBASE_API
193 lcb_STATUS lcbmetrics_meter_dtor_callback(lcbmetrics_METER *meter, void (*callback)(const lcbmetrics_METER *meter));
194 
202 LIBCOUCHBASE_API lcb_STATUS lcbmetrics_meter_value_recorder_callback(lcbmetrics_METER *meter,
203  lcbmetrics_VALUE_RECORDER_CALLBACK callback);
204 
211 LIBCOUCHBASE_API
212 lcb_STATUS lcbmetrics_meter_cookie(const lcbmetrics_METER *meter, void **cookie);
213 
224 LIBCOUCHBASE_API
225 void lcbmetrics_meter_destroy(const lcbmetrics_METER *meter);
226 
229 #ifdef __cplusplus
230 }
231 #endif /* __cplusplus */
232 #endif // LCB_METRICS_H
Definition of all of the error codes used by libcouchbase.
lcb_STATUS
Error codes returned by the library.
Definition: error.h:212
Operation metrics tags.
Definition: metrics.h:64