solarwinds_apm 6.1.2 → 7.0.0.prev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/solarwinds_apm/api/current_trace_info.rb +10 -6
- data/lib/solarwinds_apm/api/custom_metrics.rb +8 -25
- data/lib/solarwinds_apm/api/tracing.rb +12 -27
- data/lib/solarwinds_apm/api/transaction_name.rb +6 -10
- data/lib/solarwinds_apm/config.rb +1 -1
- data/lib/solarwinds_apm/constants.rb +1 -0
- data/lib/solarwinds_apm/noop/api.rb +5 -2
- data/lib/solarwinds_apm/noop.rb +0 -24
- data/lib/solarwinds_apm/opentelemetry/otlp_processor.rb +90 -69
- data/lib/solarwinds_apm/opentelemetry/solarwinds_propagator.rb +0 -2
- data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +5 -4
- data/lib/solarwinds_apm/opentelemetry.rb +5 -7
- data/lib/solarwinds_apm/otel_native_config.rb +177 -0
- data/lib/solarwinds_apm/patch/README.md +15 -0
- data/lib/solarwinds_apm/{noop/metadata.rb → sampling/dice.rb} +19 -17
- data/lib/solarwinds_apm/sampling/http_sampler.rb +87 -0
- data/lib/solarwinds_apm/sampling/json_sampler.rb +52 -0
- data/lib/solarwinds_apm/sampling/metrics.rb +38 -0
- data/lib/solarwinds_apm/sampling/oboe_sampler.rb +348 -0
- data/lib/solarwinds_apm/sampling/sampler.rb +197 -0
- data/lib/solarwinds_apm/sampling/sampling_constants.rb +127 -0
- data/lib/solarwinds_apm/sampling/sampling_patch.rb +49 -0
- data/lib/solarwinds_apm/sampling/setting_example.txt +1 -0
- data/lib/solarwinds_apm/{noop/context.rb → sampling/settings.rb} +14 -25
- data/lib/solarwinds_apm/sampling/token_bucket.rb +126 -0
- data/lib/solarwinds_apm/sampling/trace_options.rb +100 -0
- data/lib/solarwinds_apm/{patch.rb → sampling.rb} +20 -4
- data/lib/solarwinds_apm/{noop/span.rb → support/aws_resource_detector.rb} +5 -18
- data/lib/solarwinds_apm/support/logger_formatter.rb +1 -1
- data/lib/solarwinds_apm/support/logging_log_event.rb +1 -1
- data/lib/solarwinds_apm/support/lumberjack_formatter.rb +1 -1
- data/lib/solarwinds_apm/support/otlp_endpoint.rb +99 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/beanstalk.rb +51 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/ec2.rb +145 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/ecs.rb +173 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/eks.rb +174 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/lambda.rb +66 -0
- data/lib/solarwinds_apm/support/resource_detector.rb +192 -0
- data/lib/solarwinds_apm/support/service_key_checker.rb +12 -6
- data/lib/solarwinds_apm/support/transaction_settings.rb +6 -0
- data/lib/solarwinds_apm/support/txn_name_manager.rb +54 -9
- data/lib/solarwinds_apm/support/utils.rb +9 -0
- data/lib/solarwinds_apm/support.rb +3 -4
- data/lib/solarwinds_apm/version.rb +4 -4
- data/lib/solarwinds_apm.rb +27 -73
- metadata +99 -40
- data/ext/oboe_metal/extconf.rb +0 -168
- data/ext/oboe_metal/lib/liboboe-1.0-aarch64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-alpine-aarch64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-lambda-aarch64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-lambda-x86_64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.sha256 +0 -1
- data/ext/oboe_metal/src/VERSION +0 -1
- data/ext/oboe_metal/src/bson/bson.h +0 -220
- data/ext/oboe_metal/src/bson/platform_hacks.h +0 -91
- data/ext/oboe_metal/src/init_solarwinds_apm.cc +0 -18
- data/ext/oboe_metal/src/oboe.h +0 -930
- data/ext/oboe_metal/src/oboe_api.cpp +0 -793
- data/ext/oboe_metal/src/oboe_api.h +0 -621
- data/ext/oboe_metal/src/oboe_debug.h +0 -17
- data/ext/oboe_metal/src/oboe_swig_wrap.cc +0 -11045
- data/lib/oboe_metal.rb +0 -187
- data/lib/solarwinds_apm/cert/star.appoptics.com.issuer.crt +0 -24
- data/lib/solarwinds_apm/oboe_init_options.rb +0 -222
- data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +0 -239
- data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +0 -174
- data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +0 -333
- data/lib/solarwinds_apm/otel_config.rb +0 -174
- data/lib/solarwinds_apm/otel_lambda_config.rb +0 -56
- data/lib/solarwinds_apm/patch/dummy_patch.rb +0 -12
- data/lib/solarwinds_apm/support/oboe_tracing_mode.rb +0 -33
- data/lib/solarwinds_apm/support/support_report.rb +0 -99
- data/lib/solarwinds_apm/support/transaction_cache.rb +0 -57
- data/lib/solarwinds_apm/support/x_trace_options.rb +0 -138
data/ext/oboe_metal/src/oboe.h
DELETED
@@ -1,930 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @file oboe.h
|
3
|
-
*
|
4
|
-
* API header for liboboe application tracing library.
|
5
|
-
*
|
6
|
-
* @package Oboe
|
7
|
-
* @author liboboe
|
8
|
-
* @copyright Copyright (c) 2022, SolarWinds inc
|
9
|
-
* @license
|
10
|
-
* @link
|
11
|
-
**/
|
12
|
-
|
13
|
-
#ifndef LIBOBOE_H
|
14
|
-
#define LIBOBOE_H
|
15
|
-
|
16
|
-
|
17
|
-
#ifdef __cplusplus
|
18
|
-
extern "C" {
|
19
|
-
#endif
|
20
|
-
|
21
|
-
#include <stdio.h>
|
22
|
-
#include <stdbool.h>
|
23
|
-
#include <sys/types.h>
|
24
|
-
#include <sys/time.h>
|
25
|
-
#include <inttypes.h>
|
26
|
-
#if defined _WIN32
|
27
|
-
#include <unistd.h> // On Windows ssize_t definition was put in this header.
|
28
|
-
#endif
|
29
|
-
#include "bson/bson.h"
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Default configuration settings update interval in seconds.
|
33
|
-
*
|
34
|
-
* Borrowed from the Tracelyzer's oboe.h.
|
35
|
-
*/
|
36
|
-
#define OBOE_DEFAULT_SETTINGS_INTERVAL 30
|
37
|
-
|
38
|
-
/**
|
39
|
-
* Default interval to check for timed out settings records in seconds
|
40
|
-
*/
|
41
|
-
#define OBOE_DEFAULT_TIMEOUT_CHECK_INTERVAL 10
|
42
|
-
|
43
|
-
/**
|
44
|
-
* Default metrics flush interval in seconds
|
45
|
-
*/
|
46
|
-
#define OBOE_DEFAULT_METRICS_FLUSH_INTERVAL 60
|
47
|
-
|
48
|
-
/**
|
49
|
-
* Default maximum number of transaction names to track when aggregating metric and histogram data by individual service transaction
|
50
|
-
*/
|
51
|
-
#define OBOE_DEFAULT_MAX_TRANSACTIONS 200
|
52
|
-
|
53
|
-
/**
|
54
|
-
* Default maximum number of custom metrics per flash interval
|
55
|
-
*/
|
56
|
-
#define OBOE_DEFAULT_MAX_CUSTOM_METRICS 500
|
57
|
-
|
58
|
-
/**
|
59
|
-
* Default keepalive interval in seconds.
|
60
|
-
*
|
61
|
-
* A keepalive message will be sent after communications are idle for this interval.
|
62
|
-
*/
|
63
|
-
#define OBOE_DEFAULT_KEEPALIVE_INTERVAL 20
|
64
|
-
|
65
|
-
/**
|
66
|
-
* Time to wait for all remaining data to be sent off
|
67
|
-
*/
|
68
|
-
#define DEFAULT_FLUSH_MAX_WAIT_TIME 5000
|
69
|
-
|
70
|
-
/**
|
71
|
-
* Default events flush timeout in seconds.
|
72
|
-
*/
|
73
|
-
#define OBOE_DEFAULT_EVENTS_FLUSH_INTERVAL 2
|
74
|
-
/**
|
75
|
-
* Default max request size in bytes.
|
76
|
-
*/
|
77
|
-
#define OBOE_DEFAULT_MAX_REQUEST_SIZE_BYTES 3000000
|
78
|
-
/**
|
79
|
-
* Default EC2 metadata timeout in milliseconds
|
80
|
-
*/
|
81
|
-
#define OBOE_DEFAULT_EC2_METADATA_TIMEOUT 50
|
82
|
-
|
83
|
-
#define OBOE_SAMPLE_RESOLUTION 1000000
|
84
|
-
|
85
|
-
#define OBOE_TASK_ID_TRACEPARENT_LEN 16
|
86
|
-
#define OBOE_MAX_TASK_ID_LEN 20
|
87
|
-
#define OBOE_MAX_OP_ID_LEN 8
|
88
|
-
#define OBOE_MAX_METADATA_PACK_LEN 512
|
89
|
-
|
90
|
-
#define TRACEPARENT_CURRENT_VERSION 0
|
91
|
-
|
92
|
-
#define XTR_CURRENT_VERSION 2
|
93
|
-
|
94
|
-
#define XTR_FLAGS_NOT_SAMPLED 0x0
|
95
|
-
#define XTR_FLAGS_SAMPLED 0x1
|
96
|
-
|
97
|
-
#define XTR_UDP_PORT 7831
|
98
|
-
|
99
|
-
#define OBOE_REPORTER_PROTOCOL_FILE "file"
|
100
|
-
#define OBOE_REPORTER_PROTOCOL_UDP "udp"
|
101
|
-
#define OBOE_REPORTER_PROTOCOL_SSL "ssl"
|
102
|
-
#define OBOE_REPORTER_PROTOCOL_NULL "null"
|
103
|
-
|
104
|
-
/** Maximum reasonable length of an arguments string for configuring a reporter. */
|
105
|
-
#define OBOE_REPORTER_ARGS_SIZE 4000
|
106
|
-
|
107
|
-
#ifdef _WIN32
|
108
|
-
/// SRv1 bitwise value mask for the RUM_ENABLE flag.
|
109
|
-
#define SETTINGS_RUM_ENABLE_MASK 0x00000001
|
110
|
-
#endif
|
111
|
-
|
112
|
-
#ifndef HOST_NAME_MAX
|
113
|
-
#define HOST_NAME_MAX 256
|
114
|
-
#endif
|
115
|
-
|
116
|
-
#if !defined(AO_GETPID)
|
117
|
-
#if defined(_WIN32)
|
118
|
-
#define AO_GETPID GetCurrentProcessId
|
119
|
-
#else
|
120
|
-
#define AO_GETPID getpid
|
121
|
-
#endif
|
122
|
-
#endif
|
123
|
-
|
124
|
-
#if !defined(PID_T_DEF)
|
125
|
-
#define PID_T_DEF
|
126
|
-
typedef int pid_t;
|
127
|
-
#endif //PID_T_DEF
|
128
|
-
|
129
|
-
// structs
|
130
|
-
|
131
|
-
typedef struct oboe_ids {
|
132
|
-
uint8_t task_id[OBOE_MAX_TASK_ID_LEN];
|
133
|
-
uint8_t op_id[OBOE_MAX_OP_ID_LEN];
|
134
|
-
} oboe_ids_t;
|
135
|
-
|
136
|
-
typedef struct oboe_metadata {
|
137
|
-
uint8_t version;
|
138
|
-
oboe_ids_t ids;
|
139
|
-
size_t task_len;
|
140
|
-
size_t op_len;
|
141
|
-
uint8_t flags;
|
142
|
-
#ifdef _FUTURE_PLANS_
|
143
|
-
/* Can't add this without breaking the ABI, but someday... */
|
144
|
-
int auto_delete;
|
145
|
-
#endif /* _FUTURE_PLANS_ */
|
146
|
-
} oboe_metadata_t;
|
147
|
-
|
148
|
-
typedef struct oboe_event {
|
149
|
-
oboe_metadata_t metadata;
|
150
|
-
oboe_bson_buffer bbuf;
|
151
|
-
char * bb_str;
|
152
|
-
#ifdef _FUTURE_PLANS_
|
153
|
-
/* Can't add this without breaking the ABI, but someday... */
|
154
|
-
int auto_delete;
|
155
|
-
#endif /* _FUTURE_PLANS_ */
|
156
|
-
} oboe_event_t;
|
157
|
-
|
158
|
-
typedef struct oboe_metric_tag {
|
159
|
-
char *key;
|
160
|
-
char *value;
|
161
|
-
} oboe_metric_tag_t;
|
162
|
-
|
163
|
-
typedef struct oboe_init_options {
|
164
|
-
int version; // the version of this structure (currently on version 17)
|
165
|
-
const char *hostname_alias; // optional hostname alias
|
166
|
-
int log_level; // level at which log messages will be written to log file (0-6)
|
167
|
-
// use OBOE_INIT_LOG_LEVEL_INFO(3) for default log level
|
168
|
-
const char *log_file_path; // file name including path for log file
|
169
|
-
int max_transactions; // maximum number of transaction names to track
|
170
|
-
int max_flush_wait_time; // maximum wait time for flushing data before terminating in milli seconds
|
171
|
-
int events_flush_interval; // events flush timeout in seconds (threshold for batching messages before sending off)
|
172
|
-
int max_request_size_bytes; // limit max RPC request size
|
173
|
-
|
174
|
-
const char *reporter; // the reporter to be used (ssl, upd, file, null, lambda)
|
175
|
-
const char *host; // collector endpoint (reporter=ssl), udp address (reporter=udp), or file path (reporter=file)
|
176
|
-
const char *service_key; // the service key
|
177
|
-
const char *certificates; // content of SSL certificates, passed to gRPC::SslCredentialsOptions() for collector connection verification
|
178
|
-
int buffer_size; // size of the message buffer
|
179
|
-
int trace_metrics; // flag indicating if trace metrics reporting should be enabled (default) or disabled
|
180
|
-
int histogram_precision; // the histogram precision (only for ssl)
|
181
|
-
double token_bucket_capacity; // custom token bucket capacity
|
182
|
-
double token_bucket_rate; // custom token bucket rate
|
183
|
-
int file_single; // use single files in file reporter for each event
|
184
|
-
|
185
|
-
int ec2_metadata_timeout; // EC2 metadata timeout in milliseconds
|
186
|
-
const char *proxy; // HTTP proxy address and port to be used for the gRPC connection
|
187
|
-
int stdout_clear_nonblocking; // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
|
188
|
-
// only used in lambda reporter (off=0, on=1, default off)
|
189
|
-
int metric_format; // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
|
190
|
-
int log_type; // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
|
191
|
-
int defer_init; // defer init (0 = disable; 1 = enabled, parent process will not init oboe but fork child process will init oboe; default = 0)
|
192
|
-
} oboe_init_options_t;
|
193
|
-
|
194
|
-
typedef struct oboe_span_params {
|
195
|
-
int version; // the version of this structure
|
196
|
-
const char *service; // custom service name (will be NULL or empty if default service name should be used)
|
197
|
-
const char *transaction; // transaction name (will be NULL or empty if url given)
|
198
|
-
const char *url; // the raw url which will be processed and used as transaction name
|
199
|
-
// (if transaction is NULL or empty)
|
200
|
-
const char *domain; // a domain to be prepended to the transaction name (can be NULL)
|
201
|
-
int64_t duration; // the duration of the span in micro seconds (usec)
|
202
|
-
int status; // HTTP status code (e.g. 200, 500, ...)
|
203
|
-
const char *method; // HTTP method (e.g. GET, POST, ...)
|
204
|
-
int has_error; // boolean flag whether this transaction contains an error (1) or not (0)
|
205
|
-
int do_metrics; // boolean flag whether a (HTTP) span should be sent (1) or not (0)
|
206
|
-
} oboe_span_params_t;
|
207
|
-
|
208
|
-
//
|
209
|
-
// oboe_get_tracing_decisions input and output structures
|
210
|
-
//
|
211
|
-
typedef struct oboe_tracing_decisions_in {
|
212
|
-
int version; // the version of this structure
|
213
|
-
const char *service_name; // custom service name
|
214
|
-
const char *in_xtrace; // existing X-Trace from passed in HTTP header
|
215
|
-
int custom_sample_rate; // custom sample rate
|
216
|
-
int custom_tracing_mode; // custom tracing mode
|
217
|
-
|
218
|
-
// v2
|
219
|
-
int custom_trigger_mode; // custom trigger mode
|
220
|
-
int request_type; // the request type: OBOE_REQUEST_TYPE_REGULAR, OBOE_REQUEST_TYPE_TRIGGER
|
221
|
-
const char *header_options; // X-Trace-Options HTTP header value
|
222
|
-
const char *header_signature; // X-Trace-Options-Signature HTTP header value
|
223
|
-
time_t header_timestamp; // timestamp from X-Trace-Options header, converted to UNIX timestamp format
|
224
|
-
|
225
|
-
// v3
|
226
|
-
const char *tracestate; // value part of the parsed `sw` entry in the tracestate header, if any
|
227
|
-
} oboe_tracing_decisions_in_t;
|
228
|
-
|
229
|
-
typedef struct oboe_tracing_decisions_out {
|
230
|
-
int version;
|
231
|
-
int sample_rate;
|
232
|
-
int sample_source;
|
233
|
-
int do_sample;
|
234
|
-
int do_metrics;
|
235
|
-
|
236
|
-
// v2
|
237
|
-
int request_provisioned;
|
238
|
-
int auth_status;
|
239
|
-
const char *auth_message;
|
240
|
-
const char *status_message;
|
241
|
-
|
242
|
-
// v3
|
243
|
-
double token_bucket_rate;
|
244
|
-
double token_bucket_capacity;
|
245
|
-
} oboe_tracing_decisions_out_t;
|
246
|
-
|
247
|
-
typedef struct oboe_internal_stats {
|
248
|
-
int version;
|
249
|
-
int reporters_initialized;
|
250
|
-
int event_queue_free;
|
251
|
-
int collector_response_ok;
|
252
|
-
int collector_response_try_later;
|
253
|
-
int collector_response_limit_exceeded;
|
254
|
-
} oboe_internal_stats_t;
|
255
|
-
|
256
|
-
#define OBOE_SPAN_PARAMS_VERSION 2 // version of oboe_span_params_t
|
257
|
-
#define OBOE_TRANSACTION_NAME_MAX_LENGTH 255 // max allowed length for transaction name
|
258
|
-
|
259
|
-
#ifndef MIN
|
260
|
-
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
261
|
-
#endif
|
262
|
-
#ifndef MAX
|
263
|
-
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
264
|
-
#endif
|
265
|
-
|
266
|
-
// oboe_metadata
|
267
|
-
|
268
|
-
#ifdef _FUTURE_PLANS_
|
269
|
-
oboe_metadata_t *oboe_metadata_new();
|
270
|
-
#endif /* _FUTURE_PLANS_ */
|
271
|
-
int oboe_metadata_init (oboe_metadata_t *);
|
272
|
-
int oboe_metadata_destroy (oboe_metadata_t *);
|
273
|
-
|
274
|
-
int oboe_metadata_is_valid (const oboe_metadata_t *);
|
275
|
-
|
276
|
-
int oboe_metadata_copy (oboe_metadata_t *, const oboe_metadata_t *);
|
277
|
-
|
278
|
-
int oboe_metadata_random (oboe_metadata_t *);
|
279
|
-
|
280
|
-
int oboe_metadata_create_event (const oboe_metadata_t *, oboe_event_t *);
|
281
|
-
|
282
|
-
int oboe_metadata_tostr (const oboe_metadata_t *, char *, size_t);
|
283
|
-
int oboe_metadata_tostr_traceparent2xtrace (const oboe_metadata_t *, char *, size_t);
|
284
|
-
int oboe_metadata_fromstr (oboe_metadata_t *, const char *, size_t);
|
285
|
-
|
286
|
-
int oboe_metadata_is_sampled(oboe_metadata_t *md);
|
287
|
-
|
288
|
-
// oboe_event
|
289
|
-
|
290
|
-
#ifdef _FUTURE_PLANS_
|
291
|
-
oboe_event_t *oboe_event_new(const oboe_metadata_t *);
|
292
|
-
#endif /* _FUTURE_PLANS_ */
|
293
|
-
int oboe_event_init (oboe_event_t *, const oboe_metadata_t *, const uint8_t* event_op_id);
|
294
|
-
int oboe_event_destroy (oboe_event_t *);
|
295
|
-
|
296
|
-
int oboe_event_add_info (oboe_event_t *, const char *, const char *);
|
297
|
-
int oboe_event_add_info_int64 (oboe_event_t *, const char *, const int64_t);
|
298
|
-
int oboe_event_add_info_double (oboe_event_t *, const char *, const double);
|
299
|
-
int oboe_event_add_info_bool (oboe_event_t *, const char *, const int);
|
300
|
-
int oboe_event_add_info_bson (oboe_event_t *, const char *key, const oboe_bson *val);
|
301
|
-
int oboe_event_add_edge (oboe_event_t *, const oboe_metadata_t *);
|
302
|
-
int oboe_event_add_edge_fromstr(oboe_event_t *, const char *, size_t);
|
303
|
-
|
304
|
-
int oboe_event_add_timestamp(oboe_event_t *evt);
|
305
|
-
int oboe_event_add_tid(oboe_event_t* evt);
|
306
|
-
int oboe_event_add_hostname(oboe_event_t *evt);
|
307
|
-
|
308
|
-
/**
|
309
|
-
* Send event message using the default reporter.
|
310
|
-
*
|
311
|
-
* @param channel the channel to send out this message (OBOE_SEND_EVENT or OBOE_SEND_STATUS)
|
312
|
-
* @param evt The event message.
|
313
|
-
* @param md The X-Trace metadata.
|
314
|
-
* @return Length of message sent in bytes on success; otherwise -1.
|
315
|
-
*/
|
316
|
-
int oboe_event_send(int channel, oboe_event_t *evt, oboe_metadata_t *md);
|
317
|
-
|
318
|
-
/**
|
319
|
-
* Send event message using the default reporter. (Only for python otel exporter)
|
320
|
-
* This function won't add Timestamp_u by default
|
321
|
-
* @param channel the channel to send out this message (OBOE_SEND_EVENT or OBOE_SEND_STATUS)
|
322
|
-
* @param evt The event message.
|
323
|
-
* @param md The X-Trace metadata.
|
324
|
-
* @return Length of message sent in bytes on success; otherwise -1.
|
325
|
-
*/
|
326
|
-
int oboe_event_send_without_timestamp(int channel, oboe_event_t *evt, oboe_metadata_t *md);
|
327
|
-
|
328
|
-
// oboe_context
|
329
|
-
|
330
|
-
oboe_metadata_t *oboe_context_get();
|
331
|
-
int oboe_context_set(oboe_metadata_t *);
|
332
|
-
int oboe_context_set_fromstr(const char *, size_t);
|
333
|
-
|
334
|
-
int oboe_context_clear();
|
335
|
-
|
336
|
-
int oboe_context_is_valid();
|
337
|
-
|
338
|
-
int oboe_context_is_sampled();
|
339
|
-
|
340
|
-
// oboe_reporter
|
341
|
-
|
342
|
-
struct oboe_reporter;
|
343
|
-
|
344
|
-
/* TODO: Move struct oboe_reporter to private header. */
|
345
|
-
typedef int (*reporter_ready)(void *);
|
346
|
-
typedef int (*reporter_is_within_limit)(void *, const char *, const char *);
|
347
|
-
typedef ssize_t (*reporter_send)(void *, int, const char *, size_t);
|
348
|
-
typedef int (*reporter_send_span)(void *, const char *, const char *, const int64_t, const int);
|
349
|
-
typedef int (*reporter_send_http_span)(void *, const char *, const char *, const int64_t, const int, const char *, const int);
|
350
|
-
typedef int (*reporter_add_custom_metric)(void *, const char *, const double, const int, const int, const char *, const int, const oboe_metric_tag_t*, const size_t);
|
351
|
-
typedef int (*reporter_destroy)(void *);
|
352
|
-
typedef int (*reporter_server_response)(void *);
|
353
|
-
typedef const char* (*reporter_server_warning)(void *);
|
354
|
-
typedef int (*reporter_profiling_interval)(void *);
|
355
|
-
typedef int (*reporter_flush)(void *);
|
356
|
-
typedef struct oboe_reporter {
|
357
|
-
void * descriptor; /*!< Reporter's context. */
|
358
|
-
reporter_ready eventReady; /*!< Check if the reporter is ready for another trace. */
|
359
|
-
reporter_ready profilingReady; /*!< Check if the reporter is ready for another profiling snapshot. */
|
360
|
-
reporter_ready statusReady; /*!< Check if the reporter is ready for another status. */
|
361
|
-
reporter_ready spanReady; /*!< Check if the reporter is ready for another span. */
|
362
|
-
reporter_is_within_limit isWithinLimit;
|
363
|
-
reporter_ready customMetricsReady; /*!< Check if the reporter is ready for another custom metric. */
|
364
|
-
reporter_send send; /*!< Send a trace event message. */
|
365
|
-
reporter_send_span sendSpan;
|
366
|
-
reporter_send_http_span sendHttpSpan;
|
367
|
-
reporter_add_custom_metric addCustomMetric;
|
368
|
-
reporter_destroy destroy; /*!< Destroy the reporter - release all resources. */
|
369
|
-
reporter_server_response getServerResponse;
|
370
|
-
reporter_profiling_interval profilingInterval;
|
371
|
-
reporter_server_warning getServerWarning;
|
372
|
-
reporter_flush flush;
|
373
|
-
} oboe_reporter_t;
|
374
|
-
|
375
|
-
/**
|
376
|
-
* Check if the reporter is ready to send.
|
377
|
-
*
|
378
|
-
* The concept of 'ready' is depends on the specific reporter being used.
|
379
|
-
*
|
380
|
-
* @param rep The reporter context (optional).
|
381
|
-
* @return Non-zero if the reporter is ready to send.
|
382
|
-
*/
|
383
|
-
int oboe_reporter_is_ready(oboe_reporter_t *rep); /* DEPRECATE: Use oboe_is_ready() */
|
384
|
-
|
385
|
-
/**
|
386
|
-
* Release any resources held by the reporter context.
|
387
|
-
*
|
388
|
-
* @param rep Pointer to a reporter context structure.
|
389
|
-
* @return Zero on success; otherwise non-zero to indicate an error.
|
390
|
-
*/
|
391
|
-
int oboe_reporter_destroy(oboe_reporter_t *rep); /* DEPRECATE: Use oboe_shutdown() */
|
392
|
-
|
393
|
-
ssize_t oboe_reporter_udp_send(void *desc, const char *data, size_t len); /* DEPRECATE - Use oboe_event_send() */
|
394
|
-
|
395
|
-
/* Oboe initialization and reporter management */
|
396
|
-
|
397
|
-
/**
|
398
|
-
* Initialize the Oboe subsystems.
|
399
|
-
*
|
400
|
-
* Should be called before any other oboe_* functions.
|
401
|
-
* However, in order to make the library easier to work with, checks
|
402
|
-
* are in place so that it will be called by any of the other functions
|
403
|
-
* that depend on it.
|
404
|
-
*
|
405
|
-
* Besides initializing the oboe library, this will also initialize a
|
406
|
-
* reporter based on the values of environment variables, configuration
|
407
|
-
* file options, and whether a tracelyzer is installed.
|
408
|
-
*
|
409
|
-
* @param options init options
|
410
|
-
* @return One of the OBOE_INIT_* macros
|
411
|
-
*/
|
412
|
-
int oboe_init(oboe_init_options_t* options);
|
413
|
-
|
414
|
-
/**
|
415
|
-
* Initialize the Oboe subsytems using a specific reporter configuration.
|
416
|
-
*
|
417
|
-
* This should be called before any other oboe_* functions butm may also be
|
418
|
-
* used to change or re-initialize the current reporter. To reconnect the
|
419
|
-
* reporter use oboe_disconnect() and oboe_reconnect() instead.
|
420
|
-
*
|
421
|
-
* @param protocol One of OBOE_REPORTER_PROTOCOL_FILE, OBOE_REPORTER_PROTOCOL_UDP,
|
422
|
-
* or OBOE_REPORTER_PROTOCOL_SSL.
|
423
|
-
* @param args A configuration string for the specified protocol (protocol dependent syntax).
|
424
|
-
* @return One of the OBOE_INIT_* macros
|
425
|
-
*/
|
426
|
-
int oboe_init_reporter(const char *protocol, oboe_init_options_t *options);
|
427
|
-
|
428
|
-
/**
|
429
|
-
* returns one of these:
|
430
|
-
* - OBOE_INIT_OPTIONS_SET_DEFAULTS_OK
|
431
|
-
* - OBOE_INIT_OPTIONS_SET_DEFAULTS_WRONG_VERSION
|
432
|
-
*/
|
433
|
-
int oboe_init_options_set_defaults(oboe_init_options_t *options);
|
434
|
-
|
435
|
-
/**
|
436
|
-
* tell reporter to flush all messages that are currently buffered
|
437
|
-
*/
|
438
|
-
int oboe_reporter_flush();
|
439
|
-
|
440
|
-
/**
|
441
|
-
* get the reporter type used
|
442
|
-
*/
|
443
|
-
const char* oboe_get_reporter_type();
|
444
|
-
|
445
|
-
/**
|
446
|
-
* Get reporter default_endpoint
|
447
|
-
* It returns static information from each reporter class and doesn't require oboe_init before calling it
|
448
|
-
* @param reporter_type const char* e.g. SSL, UDP, FILE, ...
|
449
|
-
* @param default_endpoint const char* <empty> means no default endpoint
|
450
|
-
*/
|
451
|
-
const char* oboe_get_reporter_default_endpoint(const char* reporter_type);
|
452
|
-
|
453
|
-
/**
|
454
|
-
* Check if system is AWS Lambda
|
455
|
-
*/
|
456
|
-
int oboe_is_lambda();
|
457
|
-
|
458
|
-
/**
|
459
|
-
* Check if oboe is ready
|
460
|
-
*
|
461
|
-
* Ready means reporters are ready and settings have been received
|
462
|
-
*
|
463
|
-
* @param timeout a timeout value (in milli seconds) to wait until ready, zero means don't wait
|
464
|
-
* @return server response code (e.g. OBOE_SERVER_RESPONSE_OK)
|
465
|
-
*/
|
466
|
-
int oboe_is_ready(const uint32_t timeout);
|
467
|
-
|
468
|
-
/**
|
469
|
-
* Send a raw message using the current reporter.
|
470
|
-
*
|
471
|
-
* Use oboe_event_send() unless you are handling all the details of constructing
|
472
|
-
* the messages for a valid trace.
|
473
|
-
*
|
474
|
-
* @param channel the channel to send out this message (OBOE_SEND_EVENT or OBOE_SEND_STATUS)
|
475
|
-
* @param data A BSON-encoded event message.
|
476
|
-
* @param len The length of the message data in bytes.
|
477
|
-
* @return Length of message sent in bytes on success; otherwise -1.
|
478
|
-
*/
|
479
|
-
int oboe_raw_send(int channel, const char *data, size_t len);
|
480
|
-
|
481
|
-
/**
|
482
|
-
* Shut down the Oboe subsystems.
|
483
|
-
*
|
484
|
-
* This may be called on exit in order to release any resources held by
|
485
|
-
* the Oboe library including any child threads.
|
486
|
-
*/
|
487
|
-
void oboe_shutdown();
|
488
|
-
|
489
|
-
/**
|
490
|
-
* Don't call *coming_impl function directly, they are temporary
|
491
|
-
*/
|
492
|
-
bool oboe_validate_tracing_decisions_in_t(oboe_tracing_decisions_in_t *in);
|
493
|
-
int oboe_init_coming_impl(const char* json);
|
494
|
-
int oboe_tracing_decisions_coming_impl(oboe_tracing_decisions_in_t *in, oboe_tracing_decisions_out_t *out);
|
495
|
-
void oboe_shutdown_coming_impl();
|
496
|
-
|
497
|
-
// Settings interface
|
498
|
-
|
499
|
-
#define OBOE_SETTINGS_VERSION 1
|
500
|
-
#define OBOE_SETTINGS_MAGIC_NUMBER 0x6f626f65
|
501
|
-
#define OBOE_SETTINGS_TYPE_DEFAULT_SAMPLE_RATE 0
|
502
|
-
#define OBOE_SETTINGS_TYPE_LAYER_SAMPLE_RATE 1
|
503
|
-
#define OBOE_SETTINGS_TYPE_LAYER_APP_SAMPLE_RATE 2
|
504
|
-
#define OBOE_SETTINGS_TYPE_LAYER_HTTPHOST_SAMPLE_RATE 3
|
505
|
-
#define OBOE_SETTINGS_TYPE_CONFIG_STRING 4
|
506
|
-
#define OBOE_SETTINGS_TYPE_CONFIG_INT 5
|
507
|
-
#define OBOE_SETTINGS_FLAG_OK 0x0
|
508
|
-
#define OBOE_SETTINGS_FLAG_INVALID 0x1
|
509
|
-
#define OBOE_SETTINGS_FLAG_OVERRIDE 0x2
|
510
|
-
#define OBOE_SETTINGS_FLAG_SAMPLE_START 0x4
|
511
|
-
#define OBOE_SETTINGS_FLAG_SAMPLE_THROUGH 0x8
|
512
|
-
#define OBOE_SETTINGS_FLAG_SAMPLE_THROUGH_ALWAYS 0x10
|
513
|
-
#define OBOE_SETTINGS_FLAG_TRIGGERED_TRACE 0x20
|
514
|
-
#define OBOE_SETTINGS_MAX_STRLEN 256
|
515
|
-
|
516
|
-
#define OBOE_SETTINGS_UNSET -1
|
517
|
-
|
518
|
-
// Value for "SampleSource" info key
|
519
|
-
// where was the sample rate specified? (oboe settings, config file, hard-coded default, etc)
|
520
|
-
#define OBOE_SAMPLE_RATE_SOURCE_FILE 1
|
521
|
-
#define OBOE_SAMPLE_RATE_SOURCE_DEFAULT 2
|
522
|
-
#define OBOE_SAMPLE_RATE_SOURCE_OBOE 3
|
523
|
-
#define OBOE_SAMPLE_RATE_SOURCE_LAST_OBOE 4
|
524
|
-
#define OBOE_SAMPLE_RATE_SOURCE_DEFAULT_MISCONFIGURED 5
|
525
|
-
#define OBOE_SAMPLE_RATE_SOURCE_OBOE_DEFAULT 6
|
526
|
-
#define OBOE_SAMPLE_RATE_SOURCE_CUSTOM 7
|
527
|
-
|
528
|
-
#define OBOE_SAMPLE_RESOLUTION 1000000
|
529
|
-
|
530
|
-
// Used to convert to settings flags:
|
531
|
-
#define OBOE_TRACE_NEVER 0 // deprecated: do not use, only here for backward compatibility
|
532
|
-
#define OBOE_TRACE_ALWAYS 1 // deprecated: do not use, only here for backward compatibility
|
533
|
-
#define OBOE_TRACE_DISABLED 0
|
534
|
-
#define OBOE_TRACE_ENABLED 1
|
535
|
-
#define OBOE_TRIGGER_DISABLED 0
|
536
|
-
#define OBOE_TRIGGER_ENABLED 1
|
537
|
-
|
538
|
-
#define OBOE_SEND_EVENT 0
|
539
|
-
#define OBOE_SEND_STATUS 1
|
540
|
-
#define OBOE_SEND_PROFILING 2
|
541
|
-
|
542
|
-
// these codes are used by oboe_is_ready()
|
543
|
-
#define OBOE_SERVER_RESPONSE_UNKNOWN 0
|
544
|
-
#define OBOE_SERVER_RESPONSE_OK 1
|
545
|
-
#define OBOE_SERVER_RESPONSE_TRY_LATER 2
|
546
|
-
#define OBOE_SERVER_RESPONSE_LIMIT_EXCEEDED 3
|
547
|
-
#define OBOE_SERVER_RESPONSE_INVALID_API_KEY 4 // deprecated
|
548
|
-
#define OBOE_SERVER_RESPONSE_CONNECT_ERROR 5
|
549
|
-
|
550
|
-
// these codes are used by oboe_span() and oboe_http_span()
|
551
|
-
#define OBOE_SPAN_NULL_PARAMS -1
|
552
|
-
#define OBOE_SPAN_NULL_BUFFER -2
|
553
|
-
#define OBOE_SPAN_INVALID_VERSION -3
|
554
|
-
#define OBOE_SPAN_NO_REPORTER -4
|
555
|
-
#define OBOE_SPAN_NOT_READY -5
|
556
|
-
|
557
|
-
// these codes are returned by oboe_sample_layer_custom(), oboe_tracing_decisions(),
|
558
|
-
// oboe_reporter_is_ready(), and referenced in settings_messages.c (to convert
|
559
|
-
// error codes to messages.)
|
560
|
-
//
|
561
|
-
// they are structured such that codes that are <= 0 are successful, i.e., no
|
562
|
-
// error status needs to be reported to the user, while codes > 0 are errors that
|
563
|
-
// need to be reported.
|
564
|
-
|
565
|
-
#define OBOE_TRACING_DECISIONS_FAILED_AUTH -5
|
566
|
-
#define OBOE_TRACING_DECISIONS_TRIGGERED_TRACE_EXHAUSTED -4
|
567
|
-
#define OBOE_TRACING_DECISIONS_TRIGGERED_TRACE_DISABLED -3
|
568
|
-
#define OBOE_TRACING_DECISIONS_TRACING_DISABLED -2
|
569
|
-
#define OBOE_TRACING_DECISIONS_XTRACE_NOT_SAMPLED -1
|
570
|
-
#define OBOE_TRACING_DECISIONS_OK 0
|
571
|
-
#define OBOE_TRACING_DECISIONS_NULL_OUT 1
|
572
|
-
#define OBOE_TRACING_DECISIONS_NO_CONFIG 2
|
573
|
-
#define OBOE_TRACING_DECISIONS_REPORTER_NOT_READY 3
|
574
|
-
#define OBOE_TRACING_DECISIONS_NO_VALID_SETTINGS 4
|
575
|
-
#define OBOE_TRACING_DECISIONS_QUEUE_FULL 5
|
576
|
-
#define OBOE_TRACING_DECISIONS_BAD_ARG 6
|
577
|
-
|
578
|
-
// convert above codes into const char* messages.
|
579
|
-
const char* oboe_get_tracing_decisions_message(int code);
|
580
|
-
|
581
|
-
#define OBOE_TRACING_DECISIONS_AUTH_NOT_CHECKED -2
|
582
|
-
#define OBOE_TRACING_DECISIONS_AUTH_NOT_PRESENT -1
|
583
|
-
#define OBOE_TRACING_DECISIONS_AUTH_OK 0
|
584
|
-
#define OBOE_TRACING_DECISIONS_AUTH_NO_SIG_KEY 1
|
585
|
-
#define OBOE_TRACING_DECISIONS_AUTH_INVALID_SIG 2
|
586
|
-
#define OBOE_TRACING_DECISIONS_AUTH_BAD_TIMESTAMP 3
|
587
|
-
#define OBOE_TRACING_DECISIONS_AUTH_INTERNAL_ERROR 4
|
588
|
-
|
589
|
-
// convert above codes into const char* messages.
|
590
|
-
const char* oboe_get_tracing_decisions_auth_message (int code);
|
591
|
-
|
592
|
-
#define OBOE_REQUEST_TYPE_NONE -1
|
593
|
-
#define OBOE_REQUEST_TYPE_REGULAR 0
|
594
|
-
#define OBOE_REQUEST_TYPE_TRIGGER 1
|
595
|
-
|
596
|
-
#define OBOE_INIT_OPTIONS_SET_DEFAULTS_OK 0
|
597
|
-
#define OBOE_INIT_OPTIONS_SET_DEFAULTS_WRONG_VERSION 1
|
598
|
-
|
599
|
-
//
|
600
|
-
// these codes are returned by oboe_init(), oboe_init_reporter(), _oboe_create_reporter()
|
601
|
-
//
|
602
|
-
#define OBOE_INIT_ALREADY_INIT -1
|
603
|
-
#define OBOE_INIT_OK 0
|
604
|
-
#define OBOE_INIT_WRONG_VERSION 1
|
605
|
-
#define OBOE_INIT_INVALID_PROTOCOL 2
|
606
|
-
#define OBOE_INIT_NULL_REPORTER 3
|
607
|
-
#define OBOE_INIT_DESC_ALLOC 4
|
608
|
-
#define OBOE_INIT_FILE_OPEN_LOG 5
|
609
|
-
#define OBOE_INIT_UDP_NO_SUPPORT 6
|
610
|
-
#define OBOE_INIT_UDP_OPEN 7
|
611
|
-
#define OBOE_INIT_SSL_CONFIG_AUTH 8
|
612
|
-
#define OBOE_INIT_SSL_LOAD_CERT 9
|
613
|
-
#define OBOE_INIT_SSL_REPORTER_CREATE 10
|
614
|
-
#define OBOE_INIT_SSL_MISSING_KEY 11
|
615
|
-
|
616
|
-
//
|
617
|
-
// these codes are returned by oboe_custom_metric_summary() and oboe_custom_metric_increment()
|
618
|
-
//
|
619
|
-
#define OBOE_CUSTOM_METRICS_OK 0
|
620
|
-
#define OBOE_CUSTOM_METRICS_INVALID_COUNT 1
|
621
|
-
#define OBOE_CUSTOM_METRICS_INVALID_REPORTER 2
|
622
|
-
#define OBOE_CUSTOM_METRICS_TAG_LIMIT_EXCEEDED 3
|
623
|
-
#define OBOE_CUSTOM_METRICS_STOPPING 4
|
624
|
-
#define OBOE_CUSTOM_METRICS_QUEUE_LIMIT_EXCEEDED 5
|
625
|
-
|
626
|
-
//
|
627
|
-
// these codes are returned by oboe_reporter_flush()
|
628
|
-
//
|
629
|
-
#define OBOE_REPORTER_FLUSH_OK 0
|
630
|
-
#define OBOE_REPORTER_FLUSH_METRIC_ERROR 1
|
631
|
-
#define OBOE_REPORTER_FLUSH_BAD_UTF8 2
|
632
|
-
#define OBOE_REPORTER_FLUSH_NO_REPORTER 3
|
633
|
-
#define OBOE_REPORTER_FLUSH_REPORTER_NOT_READY 4
|
634
|
-
|
635
|
-
#define OBOE_INIT_LOG_LEVEL_FATAL 0
|
636
|
-
#define OBOE_INIT_LOG_LEVEL_ERROR 1
|
637
|
-
#define OBOE_INIT_LOG_LEVEL_WARNING 2
|
638
|
-
#define OBOE_INIT_LOG_LEVEL_INFO 3
|
639
|
-
#define OBOE_INIT_LOG_LEVEL_DEBUG 4
|
640
|
-
#define OBOE_INIT_LOG_LEVEL_PREVIOUS_MEDIUM 5
|
641
|
-
#define OBOE_INIT_LOG_LEVEL_TRACE 6
|
642
|
-
|
643
|
-
#define OBOE_INIT_LOG_TYPE_STDERR 0
|
644
|
-
#define OBOE_INIT_LOG_TYPE_STDOUT 1
|
645
|
-
#define OBOE_INIT_LOG_TYPE_FILE 2
|
646
|
-
#define OBOE_INIT_LOG_TYPE_NULL 3 // NULL means no output
|
647
|
-
#define OBOE_INIT_LOG_TYPE_DISABLE 4 // Explicit disable logging
|
648
|
-
|
649
|
-
// token buckets
|
650
|
-
enum TOKEN_BUCKETS {
|
651
|
-
TOKEN_BUCKET_SAMPLING, // for normal requests
|
652
|
-
TOKEN_BUCKET_TT_RELAXED, // for triggered traces initiated by Pingdom and
|
653
|
-
// other trusted sources (relaxed settings)
|
654
|
-
TOKEN_BUCKET_TT_STRICT, // for triggered traces initiated by CLI and
|
655
|
-
// other untrusted sources (strict settings)
|
656
|
-
TOKEN_BUCKET_COUNT // IMPORTANT NOTE: this must be the last element
|
657
|
-
// inside the enum
|
658
|
-
};
|
659
|
-
|
660
|
-
typedef struct {
|
661
|
-
uint32_t magic;
|
662
|
-
uint32_t timestamp;
|
663
|
-
uint16_t type;
|
664
|
-
uint16_t flags;
|
665
|
-
uint32_t value;
|
666
|
-
uint32_t ttl;
|
667
|
-
uint32_t _pad;
|
668
|
-
char layer[OBOE_SETTINGS_MAX_STRLEN]; // Flawfinder: ignore
|
669
|
-
double bucket_capacity[TOKEN_BUCKET_COUNT];
|
670
|
-
double bucket_rate_per_sec[TOKEN_BUCKET_COUNT];
|
671
|
-
char signature_key[OBOE_SETTINGS_MAX_STRLEN]; // Flawfinder: ignore
|
672
|
-
} oboe_settings_t;
|
673
|
-
|
674
|
-
typedef struct {
|
675
|
-
float available;
|
676
|
-
double capacity;
|
677
|
-
double rate_per_usec; // time is usecs from gettimeofday
|
678
|
-
struct timeval last_check;
|
679
|
-
} token_bucket_t;
|
680
|
-
|
681
|
-
|
682
|
-
typedef struct {
|
683
|
-
char name[OBOE_SETTINGS_MAX_STRLEN]; // Flawfinder: ignore
|
684
|
-
volatile uint32_t request_count; // all the requests that came through this layer
|
685
|
-
volatile uint32_t exhaustion_count; // # of times the token bucket limiting caused a trace to not occur
|
686
|
-
volatile uint32_t trace_count; // # of traces that were sent (includes "enabled" or "through" traces)
|
687
|
-
volatile uint32_t sample_count; // # of traces that caused a random coin-flip (not "through" traces)
|
688
|
-
volatile uint32_t through_count; // # of through traces
|
689
|
-
volatile uint32_t through_ignored_count; // # of new requests, that are rejected due to start_always_flag == 0
|
690
|
-
// that have through_always_flag == 1
|
691
|
-
volatile uint32_t triggered_count; // # of triggered traces
|
692
|
-
volatile uint32_t last_used_sample_rate;
|
693
|
-
volatile uint32_t last_used_sample_source;
|
694
|
-
|
695
|
-
volatile uint8_t used;
|
696
|
-
} entry_layer_t;
|
697
|
-
|
698
|
-
// Current settings configuration:
|
699
|
-
typedef struct {
|
700
|
-
int tracing_mode; // pushed from server, override from config file
|
701
|
-
int sample_rate; // pushed from server, override from config file
|
702
|
-
int trigger_mode; // pushed from server, override from config file
|
703
|
-
oboe_settings_t *settings; // cached settings, updated by tracelyzer (init to NULL)
|
704
|
-
int last_auto_sample_rate; // stores last known automatic sampling rate
|
705
|
-
uint16_t last_auto_flags; // stores last known flags associated with above
|
706
|
-
uint32_t last_auto_timestamp; // timestamp from last *settings lookup
|
707
|
-
uint32_t last_refresh; // last refresh time
|
708
|
-
token_bucket_t bucket[TOKEN_BUCKET_COUNT]; // token buckets for various tasks
|
709
|
-
} oboe_settings_cfg_t;
|
710
|
-
|
711
|
-
int oboe_settings_init_local();
|
712
|
-
oboe_settings_t* oboe_settings_get(uint16_t type, const char* layer, const char* arg);
|
713
|
-
oboe_settings_t* oboe_settings_get_layer_tracing_mode(const char* layer);
|
714
|
-
oboe_settings_t* oboe_settings_get_layer_sample_rate(const char* layer);
|
715
|
-
uint32_t oboe_settings_get_latest_timestamp(const char* layer);
|
716
|
-
int oboe_settings_get_value(oboe_settings_t *s, int *outval, unsigned short *outflags, uint32_t *outtimestamp);
|
717
|
-
entry_layer_t* oboe_settings_entry_layer_get(const char* name);
|
718
|
-
|
719
|
-
oboe_settings_cfg_t* oboe_settings_cfg_get();
|
720
|
-
void oboe_settings_cfg_init(oboe_settings_cfg_t *cfg);
|
721
|
-
|
722
|
-
void oboe_settings_set(int sample_rate, int tracing_mode, int trigger_mode);
|
723
|
-
void oboe_settings_rate_set(int sample_rate);
|
724
|
-
void oboe_settings_mode_set(int tracing_mode);
|
725
|
-
void oboe_settings_trigger_set(int trigger_mode);
|
726
|
-
|
727
|
-
/**
|
728
|
-
* Convert a tracing mode to a printable string.
|
729
|
-
*/
|
730
|
-
const char *oboe_tracing_mode_to_string(int tracing_mode);
|
731
|
-
|
732
|
-
/**
|
733
|
-
* Check if sampling is enabled.
|
734
|
-
*
|
735
|
-
* @param cfg Optional pointer to the settings configuration for the current
|
736
|
-
* thread, as an optimization to avoid retrieving it. May be NULL.
|
737
|
-
* @return Non-zero if sampling is now enabled.
|
738
|
-
*/
|
739
|
-
int oboe_sample_is_enabled(oboe_settings_cfg_t *cfg);
|
740
|
-
|
741
|
-
/**
|
742
|
-
* Check if this request should be sampled.
|
743
|
-
*
|
744
|
-
* Checks for sample rate flags and settings for the specified service, considers
|
745
|
-
* the current tracing mode and any special features in the X-Trace
|
746
|
-
* headers, and, if appropriate, rolls the virtual dice to
|
747
|
-
* decide if this request should be sampled.
|
748
|
-
*
|
749
|
-
* This is designed to be called once per request.
|
750
|
-
*
|
751
|
-
* @param in Struct containing all params to help making a tracing decision
|
752
|
-
* @param out Struct containing all params that get set during decision making
|
753
|
-
*/
|
754
|
-
int oboe_tracing_decisions(oboe_tracing_decisions_in_t *in, oboe_tracing_decisions_out_t *out);
|
755
|
-
|
756
|
-
/* Oboe configuration interface. */
|
757
|
-
#ifndef _WIN32
|
758
|
-
/**
|
759
|
-
* Check if the Oboe library is compatible with a given version.revision.
|
760
|
-
*
|
761
|
-
* This will succeed if the library is at least as recent as specified and if no
|
762
|
-
* definitions have been removed since that revision.
|
763
|
-
*
|
764
|
-
* @param version The library's version number which increments every time the API changes.
|
765
|
-
* @param revision The revision of the current version of the library.
|
766
|
-
* @return Non-zero if the Oboe library is considered compatible with the specified revision.
|
767
|
-
*/
|
768
|
-
extern int oboe_config_check_version(int version, int revision);
|
769
|
-
#endif
|
770
|
-
/**
|
771
|
-
* Get the Oboe library version number.
|
772
|
-
*
|
773
|
-
* This number increments whenever the API is changed.
|
774
|
-
*
|
775
|
-
* @return The library's version number or -1 if the version is not known.
|
776
|
-
*/
|
777
|
-
extern int oboe_config_get_version();
|
778
|
-
|
779
|
-
/**
|
780
|
-
* Get the Oboe library revision number.
|
781
|
-
*
|
782
|
-
* This is the revision of the current version which is updated whenever
|
783
|
-
* compatible changes are made to the API/ABI (ie. additions).
|
784
|
-
*
|
785
|
-
* @return The library's revision number or -1 if not known.
|
786
|
-
*/
|
787
|
-
extern int oboe_config_get_revision();
|
788
|
-
|
789
|
-
/*
|
790
|
-
* Get the Oboe library version as a string.
|
791
|
-
*
|
792
|
-
* Returns the complete VERSION string or null
|
793
|
-
*/
|
794
|
-
const char* oboe_config_get_version_string();
|
795
|
-
|
796
|
-
// Span reporting
|
797
|
-
|
798
|
-
/*
|
799
|
-
* generate a new general span
|
800
|
-
*
|
801
|
-
* @param buffer a char buffer where the final transaction name will be written to
|
802
|
-
* @param buffer_length the length of the char buffer
|
803
|
-
* @param params additional span parameters
|
804
|
-
*
|
805
|
-
* @return size of the final transaction name written to buffer
|
806
|
-
* if an error occurs, these values will be returned:
|
807
|
-
* - OBOE_SPAN_NULL_PARAMS
|
808
|
-
* - OBOE_SPAN_NULL_BUFFER
|
809
|
-
* - OBOE_SPAN_INVALID_VERSION
|
810
|
-
* - OBOE_SPAN_NO_REPORTER
|
811
|
-
* - OBOE_SPAN_NOT_READY
|
812
|
-
*/
|
813
|
-
int oboe_span(char *buffer, const uint16_t buffer_length, oboe_span_params_t *params);
|
814
|
-
|
815
|
-
/*
|
816
|
-
* generate a new HTTP span
|
817
|
-
*
|
818
|
-
* @param buffer a char buffer where the final transaction name will be written to
|
819
|
-
* @param buffer_length the length of the char buffer
|
820
|
-
* @param params additional span parameters
|
821
|
-
*
|
822
|
-
* @return size of the final transaction name written to buffer
|
823
|
-
* if an error occurs, these values will be returned:
|
824
|
-
* - OBOE_SPAN_NULL_PARAMS
|
825
|
-
* - OBOE_SPAN_NULL_BUFFER
|
826
|
-
* - OBOE_SPAN_INVALID_VERSION
|
827
|
-
* - OBOE_SPAN_NO_REPORTER
|
828
|
-
* - OBOE_SPAN_NOT_READY
|
829
|
-
*/
|
830
|
-
int oboe_http_span(char *buffer, const uint16_t buffer_length, oboe_span_params_t *params);
|
831
|
-
|
832
|
-
/*
|
833
|
-
* helper functions to mark the start/end of a span
|
834
|
-
*
|
835
|
-
* @return monotonic time in micro seconds (usec) since some unspecified starting point
|
836
|
-
*/
|
837
|
-
int64_t oboe_span_start();
|
838
|
-
int64_t oboe_span_stop();
|
839
|
-
|
840
|
-
// Custom metrics
|
841
|
-
|
842
|
-
int oboe_custom_metric_summary(const char *name, const double value, const int count, const int host_tag, const char *service_name,
|
843
|
-
const oboe_metric_tag_t tags[], const size_t tags_count);
|
844
|
-
|
845
|
-
int oboe_custom_metric_increment(const char *name, const int count, const int host_tag, const char *service_name,
|
846
|
-
const oboe_metric_tag_t tags[], const size_t tags_count);
|
847
|
-
|
848
|
-
// Service names
|
849
|
-
|
850
|
-
/*
|
851
|
-
* Perform validation and replacement of invalid characters on the given service name.
|
852
|
-
*
|
853
|
-
* The rules are as follows:
|
854
|
-
* .toLowerCase() // automatically convert to lowercase
|
855
|
-
* .replace(/ /g, "-") // automatically convert spaces to hyphens
|
856
|
-
* .replace(/[^a-z0-9.:_-]/g, ""); // remove remaining invalid characters
|
857
|
-
*
|
858
|
-
* @param service_name pointer to the service name string to perform the validation on
|
859
|
-
* (important: address must be editable)
|
860
|
-
* @param length pointer to the length of the service name
|
861
|
-
*
|
862
|
-
* @return 0 if service name is valid
|
863
|
-
* 1 if service name was invalid and has been transformed
|
864
|
-
* (new valid service name is stored in service_name and length)
|
865
|
-
* -1 NULL pointer passed in for service_name or length
|
866
|
-
*/
|
867
|
-
int oboe_validate_transform_service_name(char *service_name, int *length);
|
868
|
-
|
869
|
-
// Timer tools
|
870
|
-
void oboe_timer_tool_wait(int usec);
|
871
|
-
|
872
|
-
// Get profiling interval as configured remotely
|
873
|
-
int oboe_get_profiling_interval();
|
874
|
-
|
875
|
-
// Get server warning message
|
876
|
-
const char* oboe_get_server_warning();
|
877
|
-
|
878
|
-
// Regex tools (Deprecated)
|
879
|
-
void* oboe_regex_new_expression(const char* exprString);
|
880
|
-
void oboe_regex_delete_expression(void* expression);
|
881
|
-
int oboe_regex_match(const char* string, void* expression);
|
882
|
-
|
883
|
-
/* oboe internal stats for agents to consume */
|
884
|
-
oboe_internal_stats_t* oboe_get_internal_stats();
|
885
|
-
|
886
|
-
// Random
|
887
|
-
void oboe_random_bytes(uint8_t bytes[], size_t sz);
|
888
|
-
|
889
|
-
// oboe logging macro (Phasing out marco)
|
890
|
-
#define OBOE_DEBUG_LOG_CONFIG(module, app_name, trace_mode, sample_rate, reporter_type, reporter_args, extra) do {} while(0)
|
891
|
-
#define OBOE_DEBUG_LOG_FATAL(module, ...) do {} while(0)
|
892
|
-
#define OBOE_DEBUG_LOG_ERROR(module, ...) do {} while(0)
|
893
|
-
#define OBOE_DEBUG_LOG_WARNING(module, ...) do {} while(0)
|
894
|
-
#define OBOE_DEBUG_LOG_INFO(module, ...) do {} while(0)
|
895
|
-
#define OBOE_DEBUG_LOG_LOW(module, ...) do {} while(0)
|
896
|
-
#define OBOE_DEBUG_LOG_MEDIUM(module, ...) do {} while(0)
|
897
|
-
#define OBOE_DEBUG_LOG_HIGH(module, ...) do {} while(0)
|
898
|
-
|
899
|
-
void oboe_init_once();
|
900
|
-
|
901
|
-
/**
|
902
|
-
* Request Counts function
|
903
|
-
* If succeed, it can get the value and reset the value to 0
|
904
|
-
* @param value output value
|
905
|
-
* @return bool
|
906
|
-
*/
|
907
|
-
bool oboe_consume_request_count(unsigned int* value);
|
908
|
-
bool oboe_consume_token_bucket_exhaustion_count(unsigned int* value);
|
909
|
-
bool oboe_consume_trace_count(unsigned int* value);
|
910
|
-
bool oboe_consume_sample_count(unsigned int* value);
|
911
|
-
bool oboe_consume_through_ignored_count(unsigned int* value);
|
912
|
-
bool oboe_consume_through_trace_count(unsigned int* value);
|
913
|
-
bool oboe_consume_triggered_trace_count(unsigned int* value);
|
914
|
-
/**
|
915
|
-
* Request Counts function
|
916
|
-
* If succeed, it can get the value
|
917
|
-
* @param value output value
|
918
|
-
* @return bool
|
919
|
-
*/
|
920
|
-
bool oboe_get_last_used_sample_rate(unsigned int* value);
|
921
|
-
bool oboe_get_last_used_sample_source(unsigned int* value);
|
922
|
-
|
923
|
-
void oboe_metrics_attributes_upsert(const char* key, const char* value);
|
924
|
-
bool oboe_metrics_attributes_remove(const char* key);
|
925
|
-
|
926
|
-
#ifdef __cplusplus
|
927
|
-
} // extern "C"
|
928
|
-
#endif
|
929
|
-
|
930
|
-
#endif // LIBOBOE_H
|