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
@@ -1,621 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* C++ liboboe wrapper primarily for generating SWIG interfaces
|
3
|
-
*/
|
4
|
-
#ifndef OBOE_API_H
|
5
|
-
#define OBOE_API_H
|
6
|
-
|
7
|
-
#include <unistd.h>
|
8
|
-
#include <cstdlib>
|
9
|
-
#include <cstring>
|
10
|
-
#include <iostream>
|
11
|
-
#include <string>
|
12
|
-
#include <vector>
|
13
|
-
|
14
|
-
#include "oboe.h"
|
15
|
-
|
16
|
-
class Event;
|
17
|
-
class Reporter;
|
18
|
-
class Context;
|
19
|
-
|
20
|
-
// exclude some stuff that unnecessarily bloats the swig interface
|
21
|
-
#ifndef SWIG
|
22
|
-
// FrameData is for profiling and only used via Ruby directly compiled c++ code
|
23
|
-
typedef struct frame_data {
|
24
|
-
std::string klass;
|
25
|
-
std::string method;
|
26
|
-
std::string file;
|
27
|
-
int lineno = 0;
|
28
|
-
} FrameData;
|
29
|
-
#endif // SWIG exclusion
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Metadata is the X-Trace identifier and the information needed to work with it.
|
33
|
-
*/
|
34
|
-
class Metadata : private oboe_metadata_t {
|
35
|
-
friend class Reporter;
|
36
|
-
friend class Context;
|
37
|
-
public:
|
38
|
-
Metadata(const oboe_metadata_t *md);
|
39
|
-
~Metadata();
|
40
|
-
/**
|
41
|
-
* Return an `new` C++ object
|
42
|
-
* Object ownership changed via SWIG
|
43
|
-
* SWIG managed the de-allocation using %newobject keyword
|
44
|
-
* @return Event*
|
45
|
-
*/
|
46
|
-
Event *createEvent();
|
47
|
-
/**
|
48
|
-
* Return an `new` C++ object
|
49
|
-
* Object ownership changed via SWIG
|
50
|
-
* SWIG managed the de-allocation using %newobject keyword
|
51
|
-
* @return Metadata*
|
52
|
-
*/
|
53
|
-
Metadata *copy();
|
54
|
-
bool isValid();
|
55
|
-
bool isSampled();
|
56
|
-
/**
|
57
|
-
* Return an `new` C++ object
|
58
|
-
* Object ownership changed via SWIG
|
59
|
-
* SWIG managed the de-allocation using %newobject keyword
|
60
|
-
* @param sampled bool default=true
|
61
|
-
* @return Metadata*
|
62
|
-
*/
|
63
|
-
static Metadata *makeRandom(bool sampled = true);
|
64
|
-
/**
|
65
|
-
* Return an `new` C++ object
|
66
|
-
* Object ownership changed via SWIG
|
67
|
-
* SWIG managed the de-allocation using %newobject keyword
|
68
|
-
* @param s std::string
|
69
|
-
* @return Metadata*
|
70
|
-
*/
|
71
|
-
static Metadata *fromString(const std::string& s);
|
72
|
-
/**
|
73
|
-
* Return this pointer
|
74
|
-
* No Object ownership changed via SWIG
|
75
|
-
* @return oboe_metadata_t*
|
76
|
-
*/
|
77
|
-
oboe_metadata_t *metadata();
|
78
|
-
#ifdef SWIGJAVA
|
79
|
-
std::string toStr();
|
80
|
-
#else
|
81
|
-
std::string toString();
|
82
|
-
#endif
|
83
|
-
};
|
84
|
-
|
85
|
-
/**
|
86
|
-
* The Context class manages the metadata and the settings configuration.
|
87
|
-
*
|
88
|
-
* The metadata includes the X-Trace identifier fields and the information work working with it.
|
89
|
-
* The metadata is needed before any trace messages can be sent and must either be generated for
|
90
|
-
* new traces or derived from the X-Trace header of an existing trace.
|
91
|
-
*
|
92
|
-
* The settings information is used primarily to determine when a new request should be traced.
|
93
|
-
* The information begins with configuration values for tracing_mode and sample_rate and then
|
94
|
-
* updates are received periodically from the collector to adjust the rate at which traces
|
95
|
-
* are generated.
|
96
|
-
*/
|
97
|
-
class Context {
|
98
|
-
public:
|
99
|
-
/**
|
100
|
-
* Set the tracing mode.
|
101
|
-
*
|
102
|
-
* @param newMode One of
|
103
|
-
* - OBOE_TRACE_DISABLED(0) to disable tracing,
|
104
|
-
* - OBOE_TRACE_ENABLED(1) to start a new trace if needed, or
|
105
|
-
*/
|
106
|
-
static void setTracingMode(int newMode);
|
107
|
-
|
108
|
-
/**
|
109
|
-
* Set the trigger tracing mode.
|
110
|
-
*
|
111
|
-
* @param newMode One of
|
112
|
-
* - OBOE_TRIGGER_DISABLED(0) to disable tracing, or
|
113
|
-
* - OBOE_TRIGGER_ENABLED(1) to start a new trace if needed
|
114
|
-
*/
|
115
|
-
static void setTriggerMode(int newMode);
|
116
|
-
|
117
|
-
/**
|
118
|
-
* Set the default sample rate.
|
119
|
-
*
|
120
|
-
* This rate is used until overridden by the AppOptics servers. If not set then the
|
121
|
-
* value comes from settings records downloaded from AppOptics.
|
122
|
-
*
|
123
|
-
* The rate is interpreted as a ratio out of OBOE_SAMPLE_RESOLUTION (currently 1,000,000).
|
124
|
-
*
|
125
|
-
* @param newRate A number between 0 (none) and OBOE_SAMPLE_RESOLUTION (a million)
|
126
|
-
*/
|
127
|
-
static void setDefaultSampleRate(int newRate);
|
128
|
-
|
129
|
-
/**
|
130
|
-
* Ask the collector for the final tracing decisions
|
131
|
-
*
|
132
|
-
* call once per request
|
133
|
-
*
|
134
|
-
* when compiled via SWIG this function takes 0-8 input argss and returns 9 output args
|
135
|
-
*
|
136
|
-
* inputs (0-8, all optional):
|
137
|
-
* @param in_xtrace, a valid xtrace string
|
138
|
-
* @param tracestate, value of sw member in tracestate, ignored when not in w3c mode
|
139
|
-
* @param custom_sample_rate, 0-1000000
|
140
|
-
* @param custom_tracing_mode, 0(disabled) or 1(enabled)
|
141
|
-
* @param request_type, 0 normal sampling, 1 trigger trace
|
142
|
-
* @param custom_custom_trigger_mode, 0(disabled) or 1(enabled)
|
143
|
-
* @param header_options, the string from the X-Trace-Options header
|
144
|
-
* @param header_signature, the string from the X-Trace-Options-Signature header
|
145
|
-
* @param header_timestamp, the timestamp inside the X-Trace-Options header
|
146
|
-
*
|
147
|
-
* returns:
|
148
|
-
* @param do_metrics, ignore when using SWIG, it will be mapped to the first return value
|
149
|
-
* @param do_sample, ignore when using SWIG, it will be mapped to the second return value
|
150
|
-
* @param sample_rate, ignore when using SWIG, it will be mapped to the third return value
|
151
|
-
* @param sample_source, ignore when using SWIG, it will be mapped to the forth return value
|
152
|
-
* @param type, 0 normal sampling, 1 - trigger trace
|
153
|
-
* @param auth, 0 success, 1 failure, -1 not requested
|
154
|
-
* @param status_msg, message describing the trigger tracing decision
|
155
|
-
* @param auth_msg, message describing the success/failure of the authorization
|
156
|
-
*
|
157
|
-
* @status one of the OBOE_TRACING_DECISION_* codes
|
158
|
-
*/
|
159
|
-
|
160
|
-
static void getDecisions(
|
161
|
-
// output
|
162
|
-
int *do_metrics,
|
163
|
-
int *do_sample,
|
164
|
-
int *sample_rate,
|
165
|
-
int *sample_source,
|
166
|
-
double *bucket_rate,
|
167
|
-
double *bucket_cap,
|
168
|
-
int *type,
|
169
|
-
int *auth,
|
170
|
-
std::string *status_msg,
|
171
|
-
std::string *auth_msg,
|
172
|
-
int *status,
|
173
|
-
// input
|
174
|
-
const char *in_xtrace = NULL,
|
175
|
-
const char *tracestate = NULL,
|
176
|
-
int custom_tracing_mode = OBOE_SETTINGS_UNSET,
|
177
|
-
int custom_sample_rate = OBOE_SETTINGS_UNSET,
|
178
|
-
int request_type = 0,
|
179
|
-
int custom_trigger_mode = 0,
|
180
|
-
const char *header_options = NULL,
|
181
|
-
const char *header_signature = NULL,
|
182
|
-
long header_timestamp = 0);
|
183
|
-
|
184
|
-
/**
|
185
|
-
* Return a pointer to the current context
|
186
|
-
* Return a pointer in C++ heap
|
187
|
-
* No object ownership changed via SWIG
|
188
|
-
* @return oboe_metadata_t*
|
189
|
-
*/
|
190
|
-
static oboe_metadata_t *get();
|
191
|
-
/**
|
192
|
-
* Get the current context as a printable string.
|
193
|
-
*/
|
194
|
-
#ifdef SWIGJAVA
|
195
|
-
static std::string toStr();
|
196
|
-
#else
|
197
|
-
static std::string toString();
|
198
|
-
#endif
|
199
|
-
|
200
|
-
/**
|
201
|
-
* Set the current context (this updates thread-local storage).
|
202
|
-
*/
|
203
|
-
static void set(oboe_metadata_t *md);
|
204
|
-
|
205
|
-
/**
|
206
|
-
* Set the current context from a string.
|
207
|
-
* @param s const std::string&
|
208
|
-
*/
|
209
|
-
static void fromString(const std::string& s);
|
210
|
-
|
211
|
-
/**
|
212
|
-
* Return an `new` C++ object
|
213
|
-
* Object ownership changed via SWIG
|
214
|
-
* SWIG managed the de-allocation using %newobject keyword
|
215
|
-
* @return Metadata*
|
216
|
-
*/
|
217
|
-
static Metadata *copy();
|
218
|
-
|
219
|
-
static void setSampledFlag();
|
220
|
-
|
221
|
-
static void clear();
|
222
|
-
|
223
|
-
static bool isValid();
|
224
|
-
|
225
|
-
static bool isSampled();
|
226
|
-
|
227
|
-
/**
|
228
|
-
* Perform validation and replacement of invalid characters on the given service key.
|
229
|
-
*/
|
230
|
-
static std::string validateTransformServiceName(const std::string& service_key);
|
231
|
-
|
232
|
-
/**
|
233
|
-
* Shut down the Oboe library.
|
234
|
-
*
|
235
|
-
* This releases any resources held by the library which may include terminating
|
236
|
-
* child threads.
|
237
|
-
*/
|
238
|
-
static void shutdown();
|
239
|
-
|
240
|
-
/**
|
241
|
-
* check if oboe is ready for tracing
|
242
|
-
*
|
243
|
-
* @param timeout an optional timeout (in milli seconds) to block this function until ready
|
244
|
-
* @return one of the return codes (see oboe.h):
|
245
|
-
* - OBOE_SERVER_RESPONSE_UNKNOWN
|
246
|
-
* - OBOE_SERVER_RESPONSE_OK
|
247
|
-
* - OBOE_SERVER_RESPONSE_TRY_LATER
|
248
|
-
* - OBOE_SERVER_RESPONSE_LIMIT_EXCEEDED
|
249
|
-
* - OBOE_SERVER_RESPONSE_INVALID_API_KEY
|
250
|
-
* - OBOE_SERVER_RESPONSE_CONNECT_ERROR
|
251
|
-
*/
|
252
|
-
static int isReady(unsigned int timeout);
|
253
|
-
|
254
|
-
/**
|
255
|
-
* check if oboe is running in a AWS Lambda environment
|
256
|
-
*/
|
257
|
-
static bool isLambda();
|
258
|
-
|
259
|
-
/**
|
260
|
-
* Return an `new` C++ object
|
261
|
-
* Object ownership changed via SWIG
|
262
|
-
* SWIG managed the de-allocation using %newobject keyword
|
263
|
-
* @return Event*
|
264
|
-
*/
|
265
|
-
static Event *createEvent();
|
266
|
-
/**
|
267
|
-
* Return an `new` C++ object
|
268
|
-
* Object ownership changed via SWIG
|
269
|
-
* SWIG managed the de-allocation using %newobject keyword
|
270
|
-
* @return Event*
|
271
|
-
*/
|
272
|
-
static Event *startTrace();
|
273
|
-
/**
|
274
|
-
* Create entry event with user-defined metadata and timestamp
|
275
|
-
* Return an `new` C++ object
|
276
|
-
* Object ownership changed via SWIG
|
277
|
-
* SWIG managed the de-allocation using %newobject keyword
|
278
|
-
* @param md const oboe_metadata_t *
|
279
|
-
* @param timestamp int64_t
|
280
|
-
* @param parent_md const oboe_metadata_t * default = nullptr
|
281
|
-
* @return Event*
|
282
|
-
*/
|
283
|
-
static Event* createEntry(const oboe_metadata_t *md, int64_t timestamp, const oboe_metadata_t *parent_md = nullptr);
|
284
|
-
/**
|
285
|
-
* Create an continuous event with user-defined timestamp
|
286
|
-
* Return an `new` C++ object
|
287
|
-
* Object ownership changed via SWIG
|
288
|
-
* SWIG managed the de-allocation using %newobject keyword
|
289
|
-
* @param timestamp int64_t
|
290
|
-
* @return Event*
|
291
|
-
*/
|
292
|
-
static Event* createEvent(int64_t timestamp);
|
293
|
-
/**
|
294
|
-
* Create exit event with user-defined timestamp
|
295
|
-
* Return an `new` C++ object
|
296
|
-
* Object ownership changed via SWIG
|
297
|
-
* SWIG managed the de-allocation using %newobject keyword
|
298
|
-
* @param timestamp int64_t
|
299
|
-
* @return Event*
|
300
|
-
*/
|
301
|
-
static Event* createExit(int64_t timestamp);
|
302
|
-
};
|
303
|
-
|
304
|
-
class Event : private oboe_event_t {
|
305
|
-
friend class Reporter;
|
306
|
-
friend class Context;
|
307
|
-
friend class Metadata;
|
308
|
-
|
309
|
-
private:
|
310
|
-
Event();
|
311
|
-
Event(const oboe_metadata_t *md, bool addEdge = true);
|
312
|
-
|
313
|
-
public:
|
314
|
-
~Event();
|
315
|
-
|
316
|
-
// called e.g. from Python e.addInfo("Key", None) & Ruby e.addInfo("Key", nil)
|
317
|
-
bool addInfo(const char *key, void *val);
|
318
|
-
bool addInfo(const char *key, const std::string& val);
|
319
|
-
bool addInfo(const char *key, long val);
|
320
|
-
bool addInfo(const char *key, double val);
|
321
|
-
bool addInfo(const char *key, bool val);
|
322
|
-
bool addInfo(const char *key, const long *vals, int num);
|
323
|
-
|
324
|
-
#ifndef SWIG // for profiling only used by Ruby gem cpp-code
|
325
|
-
bool addInfo(const char *key, const std::vector<FrameData> &vals);
|
326
|
-
#endif
|
327
|
-
|
328
|
-
bool addEdge(oboe_metadata_t *md);
|
329
|
-
bool addContextOpId(const oboe_metadata_t *md);
|
330
|
-
|
331
|
-
bool addHostname();
|
332
|
-
|
333
|
-
/**
|
334
|
-
* Return an `new` C++ object
|
335
|
-
* Object ownership changed via SWIG
|
336
|
-
* SWIG managed the de-allocation using %newobject keyword
|
337
|
-
* @return Metadata*
|
338
|
-
*/
|
339
|
-
Metadata *getMetadata();
|
340
|
-
std::string metadataString();
|
341
|
-
std::string opIdString();
|
342
|
-
|
343
|
-
/**
|
344
|
-
* Report this event.
|
345
|
-
*
|
346
|
-
* This sends the event using the default reporter.
|
347
|
-
* @param with_system_timestamp bool True means system timestamp 'Timestamp_u' will be added to event
|
348
|
-
* @return True on success; otherwise an error message is logged.
|
349
|
-
*/
|
350
|
-
bool send(bool with_system_timestamp = true);
|
351
|
-
|
352
|
-
/**
|
353
|
-
* Report a profiling event
|
354
|
-
*
|
355
|
-
* This sends the event using the default reporter
|
356
|
-
* It doesn't add a timestamp
|
357
|
-
* The timestamp needs to be precise for profiling and therefore
|
358
|
-
* needs to be added by the agent when the snapshot is taken
|
359
|
-
*/
|
360
|
-
bool sendProfiling();
|
361
|
-
|
362
|
-
bool addSpanRef(const oboe_metadata_t *md);
|
363
|
-
bool addProfileEdge(std::string id);
|
364
|
-
/**
|
365
|
-
* Create a new event object using the given metadata context.
|
366
|
-
* NOTE: The metadata context must be unique to the new trace.
|
367
|
-
* Return an `new` C++ object
|
368
|
-
* Object ownership changed via SWIG
|
369
|
-
* SWIG managed the de-allocation using %newobject keyword
|
370
|
-
* @param md const oboe_metadata_t*
|
371
|
-
* @return Event*
|
372
|
-
*/
|
373
|
-
static Event *startTrace(const oboe_metadata_t *md);
|
374
|
-
};
|
375
|
-
|
376
|
-
class Span {
|
377
|
-
public:
|
378
|
-
/**
|
379
|
-
* these functions return the final transaction name
|
380
|
-
* to be used in the exit event of the trace
|
381
|
-
*/
|
382
|
-
static std::string createSpan(const char *transaction, const char *domain, const int64_t duration, const int has_error, const char *service_name = NULL);
|
383
|
-
|
384
|
-
static std::string createHttpSpan(const char *transaction, const char *url, const char *domain, const int64_t duration,
|
385
|
-
const int status, const char *method, const int has_error, const char *service_name = NULL);
|
386
|
-
};
|
387
|
-
|
388
|
-
class MetricTags {
|
389
|
-
friend class CustomMetrics;
|
390
|
-
|
391
|
-
public:
|
392
|
-
MetricTags(size_t count);
|
393
|
-
~MetricTags();
|
394
|
-
bool add(size_t index, const char *k, const char *v);
|
395
|
-
/**
|
396
|
-
* Get oboe_metric_tag_t function
|
397
|
-
* Please note that SWIG doesn't have the definition of
|
398
|
-
* oboe_metric_tag_t.
|
399
|
-
* Ruby and Python should not call this method
|
400
|
-
*
|
401
|
-
* Return tags as pointer.
|
402
|
-
* No object ownership changed via SWIG
|
403
|
-
* @return oboe_metric_tag_t*
|
404
|
-
*/
|
405
|
-
oboe_metric_tag_t *get() const;
|
406
|
-
private:
|
407
|
-
oboe_metric_tag_t *tags;
|
408
|
-
size_t size;
|
409
|
-
};
|
410
|
-
|
411
|
-
class CustomMetrics {
|
412
|
-
public:
|
413
|
-
static int summary(const char *name, const double value, const int count, const int host_tag,
|
414
|
-
const char *service_name, const MetricTags *tags, size_t tags_count);
|
415
|
-
|
416
|
-
static int increment(const char *name, const int count, const int host_tag,
|
417
|
-
const char *service_name, const MetricTags *tags, size_t tags_count);
|
418
|
-
};
|
419
|
-
|
420
|
-
#ifndef SWIG // for profiling only used by Ruby gem c++-code
|
421
|
-
class OboeProfiling {
|
422
|
-
public:
|
423
|
-
static int get_interval();
|
424
|
-
};
|
425
|
-
#endif
|
426
|
-
|
427
|
-
class Reporter : private oboe_reporter_t {
|
428
|
-
friend class Context; // Access to the private oboe_reporter_t base structure.
|
429
|
-
public:
|
430
|
-
int init_status;
|
431
|
-
|
432
|
-
/**
|
433
|
-
* Initialize a reporter structure.
|
434
|
-
*
|
435
|
-
* See the wrapped Context::init for more details.
|
436
|
-
*
|
437
|
-
* @params these correspond to the keys of the oboe_init_options struct
|
438
|
-
*/
|
439
|
-
Reporter(
|
440
|
-
std::string hostname_alias, // optional hostname alias
|
441
|
-
int log_level, // level at which log messages will be written to log file (0-6)
|
442
|
-
std::string log_file_path, // file name including path for log file
|
443
|
-
|
444
|
-
int max_transactions, // maximum number of transaction names to track
|
445
|
-
int max_flush_wait_time, // maximum wait time for flushing data before terminating in milli seconds
|
446
|
-
int events_flush_interval, // events flush timeout in seconds (threshold for batching messages before sending off)
|
447
|
-
int max_request_size_bytes, // events flush batch size in KB (threshold for batching messages before sending off)
|
448
|
-
|
449
|
-
std::string reporter, // the reporter to be used ("ssl", "upd", "file", "null")
|
450
|
-
std::string host, // collector endpoint (reporter=ssl), udp address (reporter=udp), or file path (reporter=file)
|
451
|
-
std::string service_key, // the service key (also known as access_key)
|
452
|
-
std::string certificates, // content of SSL certificates, passed to gRPC::SslCredentialsOptions() for collector connection verification
|
453
|
-
|
454
|
-
int buffer_size, // size of the message buffer
|
455
|
-
int trace_metrics, // flag indicating if trace metrics reporting should be enabled (default) or disabled
|
456
|
-
int histogram_precision, // the histogram precision (only for ssl)
|
457
|
-
double token_bucket_capacity, // custom token bucket capacity
|
458
|
-
double token_bucket_rate, // custom token bucket rate
|
459
|
-
int file_single, // use single files in file reporter for each event
|
460
|
-
|
461
|
-
int ec2_metadata_timeout, // the timeout (milli seconds) for retrieving EC2 metadata
|
462
|
-
std::string grpc_proxy, // HTTP proxy address and port to be used for the gRPC connection
|
463
|
-
int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
|
464
|
-
// only used in lambda reporter (off=0, on=1, default off)
|
465
|
-
int metric_format, // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
|
466
|
-
int log_type, // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
|
467
|
-
int defer_init // defer init (0 = disable; 1 = enabled, parent process will not init oboe but fork child process will init oboe; default = 0)
|
468
|
-
);
|
469
|
-
|
470
|
-
~Reporter();
|
471
|
-
|
472
|
-
bool sendReport(Event *evt, bool with_system_timestamp = true);
|
473
|
-
bool sendReport(Event *evt, oboe_metadata_t *md, bool with_system_timestamp = true);
|
474
|
-
bool sendStatus(Event *evt, bool with_system_timestamp = true);
|
475
|
-
bool sendStatus(Event *evt, oboe_metadata_t *md, bool with_system_timestamp = true);
|
476
|
-
void flush();
|
477
|
-
std::string getType();
|
478
|
-
};
|
479
|
-
|
480
|
-
class Config {
|
481
|
-
public:
|
482
|
-
/**
|
483
|
-
* Check if the Oboe library is compatible with a given version.revision.
|
484
|
-
*
|
485
|
-
* This will succeed if the library is at least as recent as specified and if no
|
486
|
-
* definitions have been removed since that revision.
|
487
|
-
*
|
488
|
-
* @param version The library's version number which increments every time the API changes.
|
489
|
-
* @param revision The revision of the current version of the library.
|
490
|
-
* @return Non-zero if the Oboe library is considered compatible with the specified revision.
|
491
|
-
*/
|
492
|
-
static bool checkVersion(int version, int revision);
|
493
|
-
|
494
|
-
/**
|
495
|
-
* Get the complete Oboe library version number as a string, e.g. '10.0.3'
|
496
|
-
*
|
497
|
-
* @return The library's version string
|
498
|
-
*/
|
499
|
-
static std::string getVersionString();
|
500
|
-
};
|
501
|
-
|
502
|
-
struct LoggingOptions {
|
503
|
-
LoggingOptions() : level(2), type(0) {
|
504
|
-
}
|
505
|
-
int level;
|
506
|
-
int type;
|
507
|
-
};
|
508
|
-
|
509
|
-
struct OboeAPIOptions {
|
510
|
-
LoggingOptions logging_options;
|
511
|
-
};
|
512
|
-
|
513
|
-
class OboeAPI {
|
514
|
-
public:
|
515
|
-
OboeAPI(const OboeAPIOptions& options = OboeAPIOptions());
|
516
|
-
~OboeAPI();
|
517
|
-
/**
|
518
|
-
* Get tracing decision
|
519
|
-
* @param do_metrics
|
520
|
-
* @param do_sample
|
521
|
-
* @param sample_rate
|
522
|
-
* @param sample_source
|
523
|
-
* @param bucket_rate
|
524
|
-
* @param bucket_cap
|
525
|
-
* @param type
|
526
|
-
* @param auth
|
527
|
-
* @param status_msg
|
528
|
-
* @param auth_msg
|
529
|
-
* @param status
|
530
|
-
* @param in_xtrace
|
531
|
-
* @param tracestate
|
532
|
-
* @param custom_tracing_mode
|
533
|
-
* @param custom_sample_rate
|
534
|
-
* @param request_type
|
535
|
-
* @param custom_trigger_mode
|
536
|
-
* @param header_options
|
537
|
-
* @param header_signature
|
538
|
-
* @param header_timestamp
|
539
|
-
*/
|
540
|
-
void getTracingDecision(
|
541
|
-
// SWIG output
|
542
|
-
int *do_metrics,
|
543
|
-
int *do_sample,
|
544
|
-
int *sample_rate,
|
545
|
-
int *sample_source,
|
546
|
-
double *bucket_rate,
|
547
|
-
double *bucket_cap,
|
548
|
-
int *type,
|
549
|
-
int *auth,
|
550
|
-
std::string *status_msg,
|
551
|
-
std::string *auth_msg,
|
552
|
-
int *status,
|
553
|
-
// SWIG input
|
554
|
-
const char *in_xtrace = NULL,
|
555
|
-
const char *tracestate = NULL,
|
556
|
-
int custom_tracing_mode = OBOE_SETTINGS_UNSET,
|
557
|
-
int custom_sample_rate = OBOE_SETTINGS_UNSET,
|
558
|
-
int request_type = 0,
|
559
|
-
int custom_trigger_mode = 0,
|
560
|
-
const char *header_options = NULL,
|
561
|
-
const char *header_signature = NULL,
|
562
|
-
long header_timestamp = 0);
|
563
|
-
/**
|
564
|
-
* Consume request count
|
565
|
-
* Check the return bool before using the counter, also consumeRequestCount will set the internal counter to 0 after referencing it
|
566
|
-
* @param counter
|
567
|
-
* @return bool
|
568
|
-
*/
|
569
|
-
bool consumeRequestCount(unsigned int& counter);
|
570
|
-
/**
|
571
|
-
* Consume token bucket exhaustion count
|
572
|
-
* Check the return bool before using the counter, also consumeTokenBucketExhaustionCount will set the internal counter to 0 after referencing it
|
573
|
-
* @param counter
|
574
|
-
* @return bool
|
575
|
-
*/
|
576
|
-
bool consumeTokenBucketExhaustionCount(unsigned int& counter);
|
577
|
-
/**
|
578
|
-
* Consume trace count
|
579
|
-
* Check the return bool before using the counter, also consumeTraceCount will set the internal counter to 0 after referencing it
|
580
|
-
* @param counter
|
581
|
-
* @return bool
|
582
|
-
*/
|
583
|
-
bool consumeTraceCount(unsigned int& counter);
|
584
|
-
/**
|
585
|
-
* Consume sample count
|
586
|
-
* Check the return bool before using the counter, also consumeSampleCount will set the internal counter to 0 after referencing it
|
587
|
-
* @param counter
|
588
|
-
* @return bool
|
589
|
-
*/
|
590
|
-
bool consumeSampleCount(unsigned int& counter);
|
591
|
-
/**
|
592
|
-
* Consume through trace count
|
593
|
-
* Check the return bool before using the counter, also consumeThroughTraceCount will set the internal counter to 0 after referencing it
|
594
|
-
* @param counter
|
595
|
-
* @return bool
|
596
|
-
*/
|
597
|
-
bool consumeThroughTraceCount(unsigned int& counter);
|
598
|
-
/**
|
599
|
-
* Consume triggered trace count
|
600
|
-
* Check the return bool before using the counter, also consumeTriggeredTraceCount will set the internal counter to 0 after referencing it
|
601
|
-
* @param counter
|
602
|
-
* @return bool
|
603
|
-
*/
|
604
|
-
bool consumeTriggeredTraceCount(unsigned int& counter);
|
605
|
-
/**
|
606
|
-
* Get last used sample rate
|
607
|
-
* Check the return bool before using the rate
|
608
|
-
* @param rate
|
609
|
-
* @return bool
|
610
|
-
*/
|
611
|
-
bool getLastUsedSampleRate(unsigned int& rate);
|
612
|
-
/**
|
613
|
-
* Get last used sample source
|
614
|
-
* Check the return bool before using the source
|
615
|
-
* @param source
|
616
|
-
* @return bool
|
617
|
-
*/
|
618
|
-
bool getLastUsedSampleSource(unsigned int& source);
|
619
|
-
};
|
620
|
-
|
621
|
-
#endif // OBOE_API_H
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#ifndef _OBOE_DEBUG_H
|
2
|
-
#define _OBOE_DEBUG_H
|
3
|
-
|
4
|
-
#ifdef __cplusplus
|
5
|
-
extern "C" {
|
6
|
-
#endif
|
7
|
-
|
8
|
-
typedef void (*OboeDebugLoggerFcn)(void *context, int level, const char *source_name, int source_lineno, const char *msg);
|
9
|
-
|
10
|
-
// Add or update a callback function to get log details
|
11
|
-
int oboe_debug_log_add(OboeDebugLoggerFcn newLogger, void *context);
|
12
|
-
|
13
|
-
#ifdef __cplusplus
|
14
|
-
} // extern "C"
|
15
|
-
#endif
|
16
|
-
|
17
|
-
#endif // _OBOE_DEBUG_H
|