solarwinds_apm 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +5 -0
  3. data/.github/ISSUE_TEMPLATE/bug-or-feature-request.md +16 -0
  4. data/.github/workflows/build_and_release_gem.yml +112 -0
  5. data/.github/workflows/build_for_packagecloud.yml +70 -0
  6. data/.github/workflows/docker-images.yml +47 -0
  7. data/.github/workflows/run_cpluplus_tests.yml +73 -0
  8. data/.github/workflows/run_tests.yml +155 -0
  9. data/.github/workflows/scripts/test_install.rb +23 -0
  10. data/.github/workflows/swig/swig-v4.0.2.tar.gz +0 -0
  11. data/.github/workflows/test_on_4_linux.yml +161 -0
  12. data/.gitignore +39 -0
  13. data/.rubocop.yml +29 -0
  14. data/.yardopts +7 -0
  15. data/CHANGELOG.md +769 -0
  16. data/CONFIG.md +31 -0
  17. data/Gemfile +14 -0
  18. data/LICENSE +202 -0
  19. data/README.md +383 -0
  20. data/bin/solarwinds_apm_config +15 -0
  21. data/examples/prepend.rb +13 -0
  22. data/examples/sdk_examples.rb +158 -0
  23. data/ext/oboe_metal/README.md +69 -0
  24. data/ext/oboe_metal/extconf.rb +141 -0
  25. data/ext/oboe_metal/extconf_local.rb +75 -0
  26. data/ext/oboe_metal/lib/.keep +0 -0
  27. data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.0.0.0.sha256 +1 -0
  28. data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.0.0.0.sha256 +1 -0
  29. data/ext/oboe_metal/noop/noop.c +8 -0
  30. data/ext/oboe_metal/src/README.md +6 -0
  31. data/ext/oboe_metal/src/VERSION +2 -0
  32. data/ext/oboe_metal/src/bson/bson.h +220 -0
  33. data/ext/oboe_metal/src/bson/platform_hacks.h +91 -0
  34. data/ext/oboe_metal/src/frames.cc +247 -0
  35. data/ext/oboe_metal/src/frames.h +40 -0
  36. data/ext/oboe_metal/src/init_solarwinds_apm.cc +21 -0
  37. data/ext/oboe_metal/src/logging.cc +95 -0
  38. data/ext/oboe_metal/src/logging.h +35 -0
  39. data/ext/oboe_metal/src/oboe.h +1169 -0
  40. data/ext/oboe_metal/src/oboe_api.cpp +658 -0
  41. data/ext/oboe_metal/src/oboe_api.hpp +433 -0
  42. data/ext/oboe_metal/src/oboe_debug.h +59 -0
  43. data/ext/oboe_metal/src/oboe_swig_wrap.cc +7562 -0
  44. data/ext/oboe_metal/src/profiling.cc +435 -0
  45. data/ext/oboe_metal/src/profiling.h +78 -0
  46. data/ext/oboe_metal/test/CMakeLists.txt +53 -0
  47. data/ext/oboe_metal/test/FindGMock.cmake +43 -0
  48. data/ext/oboe_metal/test/README.md +56 -0
  49. data/ext/oboe_metal/test/frames_test.cc +164 -0
  50. data/ext/oboe_metal/test/profiling_test.cc +93 -0
  51. data/ext/oboe_metal/test/ruby_inc_dir.rb +8 -0
  52. data/ext/oboe_metal/test/ruby_prefix.rb +8 -0
  53. data/ext/oboe_metal/test/ruby_test_helper.rb +67 -0
  54. data/ext/oboe_metal/test/test.h +11 -0
  55. data/ext/oboe_metal/test/test_main.cc +32 -0
  56. data/init.rb +4 -0
  57. data/lib/oboe.rb +7 -0
  58. data/lib/oboe_metal.rb +172 -0
  59. data/lib/rails/generators/solarwinds_apm/install_generator.rb +47 -0
  60. data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +424 -0
  61. data/lib/solarwinds_apm/api/layerinit.rb +41 -0
  62. data/lib/solarwinds_apm/api/logging.rb +356 -0
  63. data/lib/solarwinds_apm/api/memcache.rb +37 -0
  64. data/lib/solarwinds_apm/api/metrics.rb +63 -0
  65. data/lib/solarwinds_apm/api/util.rb +98 -0
  66. data/lib/solarwinds_apm/api.rb +21 -0
  67. data/lib/solarwinds_apm/base.rb +160 -0
  68. data/lib/solarwinds_apm/config.rb +301 -0
  69. data/lib/solarwinds_apm/frameworks/grape.rb +96 -0
  70. data/lib/solarwinds_apm/frameworks/padrino.rb +78 -0
  71. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller.rb +100 -0
  72. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller5.rb +50 -0
  73. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller_api.rb +50 -0
  74. data/lib/solarwinds_apm/frameworks/rails/inst/action_view.rb +88 -0
  75. data/lib/solarwinds_apm/frameworks/rails/inst/active_record.rb +26 -0
  76. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/mysql2.rb +29 -0
  77. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/postgresql.rb +22 -0
  78. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +103 -0
  79. data/lib/solarwinds_apm/frameworks/rails/inst/logger_formatters.rb +14 -0
  80. data/lib/solarwinds_apm/frameworks/rails.rb +100 -0
  81. data/lib/solarwinds_apm/frameworks/sinatra.rb +96 -0
  82. data/lib/solarwinds_apm/inst/bunny-client.rb +157 -0
  83. data/lib/solarwinds_apm/inst/bunny-consumer.rb +102 -0
  84. data/lib/solarwinds_apm/inst/curb.rb +288 -0
  85. data/lib/solarwinds_apm/inst/dalli.rb +89 -0
  86. data/lib/solarwinds_apm/inst/delayed_job.rb +100 -0
  87. data/lib/solarwinds_apm/inst/excon.rb +113 -0
  88. data/lib/solarwinds_apm/inst/faraday.rb +96 -0
  89. data/lib/solarwinds_apm/inst/graphql.rb +206 -0
  90. data/lib/solarwinds_apm/inst/grpc_client.rb +147 -0
  91. data/lib/solarwinds_apm/inst/grpc_server.rb +119 -0
  92. data/lib/solarwinds_apm/inst/httpclient.rb +181 -0
  93. data/lib/solarwinds_apm/inst/logger_formatter.rb +46 -0
  94. data/lib/solarwinds_apm/inst/logging_log_event.rb +24 -0
  95. data/lib/solarwinds_apm/inst/lumberjack_formatter.rb +9 -0
  96. data/lib/solarwinds_apm/inst/memcached.rb +86 -0
  97. data/lib/solarwinds_apm/inst/mongo.rb +246 -0
  98. data/lib/solarwinds_apm/inst/mongo2.rb +225 -0
  99. data/lib/solarwinds_apm/inst/moped.rb +466 -0
  100. data/lib/solarwinds_apm/inst/net_http.rb +60 -0
  101. data/lib/solarwinds_apm/inst/rack.rb +217 -0
  102. data/lib/solarwinds_apm/inst/rack_cache.rb +35 -0
  103. data/lib/solarwinds_apm/inst/redis.rb +273 -0
  104. data/lib/solarwinds_apm/inst/resque.rb +129 -0
  105. data/lib/solarwinds_apm/inst/rest-client.rb +43 -0
  106. data/lib/solarwinds_apm/inst/sequel.rb +241 -0
  107. data/lib/solarwinds_apm/inst/sidekiq-client.rb +63 -0
  108. data/lib/solarwinds_apm/inst/sidekiq-worker.rb +64 -0
  109. data/lib/solarwinds_apm/inst/typhoeus.rb +90 -0
  110. data/lib/solarwinds_apm/instrumentation.rb +22 -0
  111. data/lib/solarwinds_apm/loading.rb +65 -0
  112. data/lib/solarwinds_apm/logger.rb +14 -0
  113. data/lib/solarwinds_apm/noop/README.md +9 -0
  114. data/lib/solarwinds_apm/noop/context.rb +26 -0
  115. data/lib/solarwinds_apm/noop/metadata.rb +25 -0
  116. data/lib/solarwinds_apm/noop/profiling.rb +21 -0
  117. data/lib/solarwinds_apm/oboe_init_options.rb +191 -0
  118. data/lib/solarwinds_apm/ruby.rb +35 -0
  119. data/lib/solarwinds_apm/sdk/current_trace_info.rb +123 -0
  120. data/lib/solarwinds_apm/sdk/custom_metrics.rb +94 -0
  121. data/lib/solarwinds_apm/sdk/logging.rb +37 -0
  122. data/lib/solarwinds_apm/sdk/trace_context_headers.rb +69 -0
  123. data/lib/solarwinds_apm/sdk/tracing.rb +432 -0
  124. data/lib/solarwinds_apm/support/profiling.rb +22 -0
  125. data/lib/solarwinds_apm/support/trace_context.rb +53 -0
  126. data/lib/solarwinds_apm/support/trace_state.rb +69 -0
  127. data/lib/solarwinds_apm/support/trace_string.rb +89 -0
  128. data/lib/solarwinds_apm/support/transaction_metrics.rb +67 -0
  129. data/lib/solarwinds_apm/support/transaction_settings.rb +233 -0
  130. data/lib/solarwinds_apm/support/x_trace_options.rb +113 -0
  131. data/lib/solarwinds_apm/support.rb +12 -0
  132. data/lib/solarwinds_apm/support_report.rb +113 -0
  133. data/lib/solarwinds_apm/test.rb +165 -0
  134. data/lib/solarwinds_apm/thread_local.rb +26 -0
  135. data/lib/solarwinds_apm/util.rb +334 -0
  136. data/lib/solarwinds_apm/version.rb +17 -0
  137. data/lib/solarwinds_apm.rb +72 -0
  138. data/log/.keep +0 -0
  139. data/log/postgresql/.keep +0 -0
  140. data/solarwinds_apm.gemspec +52 -0
  141. data/yardoc_frontpage.md +24 -0
  142. metadata +228 -0
@@ -0,0 +1,433 @@
1
+ /**
2
+ * @file oboe_api.hpp - C++ liboboe wrapper primarily for generating SWIG interfaces
3
+ * and used by Ruby c++ extension for profiling
4
+ *
5
+ * TODO: This doc is outdated
6
+ * This API should follow https://github.com/tracelytics/tracelons/wiki/Instrumentation-API
7
+ */
8
+
9
+ #ifndef OBOE_API_HPP
10
+ #define OBOE_API_HPP
11
+
12
+ #include <unistd.h>
13
+ #include <cstdlib>
14
+ #include <cstring>
15
+ #include <iostream>
16
+ #include <string>
17
+ #include <vector>
18
+
19
+ #include "oboe.h"
20
+
21
+ class Event;
22
+ class Reporter;
23
+ class Context;
24
+
25
+ // exclude some stuff that unnecessarily bloats the swig interface
26
+ #ifndef SWIG
27
+ // FrameData is for profiling and only used via Ruby directly compiled c++ code
28
+ typedef struct frame_data {
29
+ std::string klass;
30
+ std::string method;
31
+ std::string file;
32
+ int lineno = 0;
33
+ } FrameData;
34
+ #endif // SWIG exclusion
35
+
36
+ /**
37
+ * Metadata is the X-Trace identifier and the information needed to work with it.
38
+ */
39
+ class Metadata : private oboe_metadata_t {
40
+ friend class Reporter;
41
+ friend class Context;
42
+
43
+ public:
44
+ Metadata(const oboe_metadata_t *md);
45
+ ~Metadata();
46
+
47
+ // these new objects are managed by SWIG %newobject
48
+ /**
49
+ * Create a new event object using this Metadata's context.
50
+ *
51
+ * NOTE: The returned object must be "delete"d.
52
+ */
53
+ Event *createEvent();
54
+
55
+ Metadata *copy();
56
+ bool isValid();
57
+ bool isSampled();
58
+
59
+ static Metadata *makeRandom(bool sampled = true);
60
+ static Metadata *fromString(std::string s);
61
+
62
+ oboe_metadata_t *metadata();
63
+
64
+ #ifdef SWIGJAVA
65
+ std::string toStr();
66
+ #else
67
+ std::string toString();
68
+ #endif
69
+ };
70
+
71
+ /**
72
+ * The Context class manages the metadata and the settings configuration.
73
+ *
74
+ * The metadata includes the X-Trace identifier fields and the information work working with it.
75
+ * The metadata is needed before any trace messages can be sent and must either be generated for
76
+ * new traces or derived from the X-Trace header of an existing trace.
77
+ *
78
+ * The settings information is used primarily to determine when a new request should be traced.
79
+ * The information begins with configuration values for tracing_mode and sample_rate and then
80
+ * updates are received periodically from the collector to adjust the rate at which traces
81
+ * are generated.
82
+ */
83
+ class Context {
84
+ public:
85
+ /**
86
+ * Set the tracing mode.
87
+ *
88
+ * @param newMode One of
89
+ * - OBOE_TRACE_DISABLED(0) to disable tracing,
90
+ * - OBOE_TRACE_ENABLED(1) to start a new trace if needed, or
91
+ * - OBOE_TRACE_THROUGH(2) to only add to an existing trace.
92
+ */
93
+ static void setTracingMode(int newMode);
94
+
95
+ /**
96
+ * Set the default sample rate.
97
+ *
98
+ * This rate is used until overridden by the AppOptics servers. If not set then the
99
+ * value comes from settings records downloaded from AppOptics.
100
+ *
101
+ * The rate is interpreted as a ratio out of OBOE_SAMPLE_RESOLUTION (currently 1,000,000).
102
+ *
103
+ * @param newRate A number between 0 (none) and OBOE_SAMPLE_RESOLUTION (a million)
104
+ */
105
+ static void setDefaultSampleRate(int newRate);
106
+
107
+ /**
108
+ * Ask the collector for the final tracing decisions
109
+ *
110
+ * call once per request
111
+ *
112
+ * when compiled via SWIG this function takes 0-8 input argss and returns 9 output args
113
+ *
114
+ * inputs (0-8, all optional):
115
+ * @param in_xtrace, a valid xtrace string
116
+ * @param tracestate, value of sw member in tracestate, ignored when not in w3c mode
117
+ * @param custom_sample_rate, 0-1000000
118
+ * @param custom_tracing_mode, 0(disabled) or 1(enabled)
119
+ * @param request_type, 0 normal sampling, 1 trigger trace
120
+ * @param custom_custom_trigger_mode, 0(disabled) or 1(enabled)
121
+ * @param header_options, the string from the X-Trace-Options header
122
+ * @param header_signature, the string from the X-Trace-Options-Signature header
123
+ * @param header_timestamp, the timestamp inside the X-Trace-Options header
124
+ *
125
+ * returns:
126
+ * @param do_metrics, ignore when using SWIG, it will be mapped to the first return value
127
+ * @param do_sample, ignore when using SWIG, it will be mapped to the second return value
128
+ * @param sample_rate, ignore when using SWIG, it will be mapped to the third return value
129
+ * @param sample_source, ignore when using SWIG, it will be mapped to the forth return value
130
+ * @param type, 0 normal sampling, 1 - trigger trace
131
+ * @param auth, 0 success, 1 failure, -1 not requested
132
+ * @param status_msg, message describing the trigger tracing decision
133
+ * @param auth_msg, message describing the success/failure of the authorization
134
+ *
135
+ * @status one of the OBOE_TRACING_DECISION_* codes
136
+ */
137
+
138
+ static void getDecisions(
139
+ // output
140
+ int *do_metrics,
141
+ int *do_sample,
142
+ int *sample_rate,
143
+ int *sample_source,
144
+ double *bucket_rate,
145
+ double *bucket_cap,
146
+ int *type,
147
+ int *auth,
148
+ std::string *status_msg,
149
+ std::string *auth_msg,
150
+ int *status,
151
+ // input
152
+ const char *in_xtrace = NULL,
153
+ const char *tracestate = NULL,
154
+ int custom_tracing_mode = OBOE_SETTINGS_UNSET,
155
+ int custom_sample_rate = OBOE_SETTINGS_UNSET,
156
+ int request_type = 0,
157
+ int custom_trigger_mode = 0,
158
+ const char *header_options = NULL,
159
+ const char *header_signature = NULL,
160
+ long header_timestamp = 0);
161
+
162
+ /**
163
+ * Get a pointer to the current context (from thread-local storage)
164
+ */
165
+ static oboe_metadata_t *get();
166
+
167
+ /**
168
+ * Get the current context as a printable string.
169
+ */
170
+ #ifdef SWIGJAVA
171
+ static std::string toStr();
172
+ #else
173
+ static std::string toString();
174
+ #endif
175
+
176
+ /**
177
+ * Set the current context (this updates thread-local storage).
178
+ */
179
+ static void set(oboe_metadata_t *md);
180
+
181
+ /**
182
+ * Set the current context from a string.
183
+ */
184
+ static void fromString(std::string s);
185
+
186
+ // this new object is managed by SWIG %newobject
187
+ static Metadata *copy();
188
+
189
+ static void setSampledFlag();
190
+
191
+ static void clear();
192
+
193
+ static bool isValid();
194
+
195
+ static bool isSampled();
196
+
197
+ /**
198
+ * Perform validation and replacement of invalid characters on the given service key.
199
+ */
200
+ static std::string validateTransformServiceName(std::string service_key);
201
+
202
+ /**
203
+ * Shut down the Oboe library.
204
+ *
205
+ * This releases any resources held by the library which may include terminating
206
+ * child threads.
207
+ */
208
+ static void shutdown();
209
+
210
+ /**
211
+ * check if oboe is ready for tracing
212
+ *
213
+ * @param timeout an optional timeout (in milli seconds) to block this function until ready
214
+ * @return one of the return codes (see oboe.h):
215
+ * - OBOE_SERVER_RESPONSE_UNKNOWN
216
+ * - OBOE_SERVER_RESPONSE_OK
217
+ * - OBOE_SERVER_RESPONSE_TRY_LATER
218
+ * - OBOE_SERVER_RESPONSE_LIMIT_EXCEEDED
219
+ * - OBOE_SERVER_RESPONSE_INVALID_API_KEY
220
+ * - OBOE_SERVER_RESPONSE_CONNECT_ERROR
221
+ */
222
+ static int isReady(unsigned int timeout);
223
+
224
+ /**
225
+ * check if oboe is running in a AWS Lambda environment
226
+ */
227
+ static bool isLambda();
228
+
229
+ // these new objects are managed by SWIG %newobject
230
+ /**
231
+ * Create a new event object using the thread's context.
232
+ *
233
+ * NOTE: The returned object must be "delete"d.
234
+ */
235
+ static Event *createEvent();
236
+ static Event *startTrace();
237
+ };
238
+
239
+ class Event : private oboe_event_t {
240
+ friend class Reporter;
241
+ friend class Context;
242
+ friend class Metadata;
243
+
244
+ private:
245
+ Event();
246
+ Event(const oboe_metadata_t *md, bool addEdge = true);
247
+
248
+ public:
249
+ ~Event();
250
+
251
+ // called e.g. from Python e.addInfo("Key", None) & Ruby e.addInfo("Key", nil)
252
+ bool addInfo(char *key, void *val);
253
+ bool addInfo(char *key, const std::string &val);
254
+ bool addInfo(char *key, long val);
255
+ bool addInfo(char *key, double val);
256
+ bool addInfo(char *key, bool val);
257
+ bool addInfo(char *key, const long *vals, int num);
258
+
259
+ #ifndef SWIG // for profiling only used by Ruby gem cpp-code
260
+ bool addInfo(char *key, const std::vector<FrameData> &vals);
261
+ #endif
262
+
263
+ bool addEdge(oboe_metadata_t *md);
264
+ bool addContextOpId(const oboe_metadata_t *md);
265
+
266
+ bool addHostname();
267
+
268
+ /**
269
+ * Get a new copy of this metadata.
270
+ *
271
+ * NOTE: The returned object must be "delete"d.
272
+ */
273
+ Metadata *getMetadata();
274
+ std::string metadataString();
275
+ std::string opIdString();
276
+
277
+ /**
278
+ * Report this event.
279
+ *
280
+ * This sends the event using the default reporter.
281
+ *
282
+ * @return True on success; otherwise an error message is logged.
283
+ */
284
+ bool send();
285
+
286
+ /**
287
+ * Report a profiling event
288
+ *
289
+ * This sends the event using the default reporter
290
+ * It doesn't add a timestamp
291
+ * The timestamp needs to be precise for profiling and therefore
292
+ * needs to be added by the agent when the snapshot is taken
293
+ */
294
+ bool sendProfiling();
295
+
296
+ bool addSpanRef(const oboe_metadata_t *md);
297
+ bool addProfileEdge(std::string id);
298
+
299
+ /**
300
+ * Create a new event object using the given metadata context.
301
+ *
302
+ * NOTE: The metadata context must be unique to the new trace.
303
+ *
304
+ * NOTE: The returned object must be "delete"d.
305
+ *
306
+ * @param md The metadata object to use when creating the new event.
307
+ */
308
+ static Event *startTrace(const oboe_metadata_t *md);
309
+ };
310
+
311
+ class Span {
312
+ public:
313
+ /**
314
+ * these functions return the final transaction name
315
+ * to be used in the exit event of the trace
316
+ */
317
+ static std::string createSpan(const char *transaction, const char *domain, const int64_t duration, const int has_error, const char *service_name = NULL);
318
+
319
+ static std::string createHttpSpan(const char *transaction, const char *url, const char *domain, const int64_t duration,
320
+ const int status, const char *method, const int has_error, const char *service_name = NULL);
321
+ };
322
+
323
+ class MetricTags {
324
+ friend class CustomMetrics;
325
+
326
+ public:
327
+ MetricTags(size_t count);
328
+ ~MetricTags();
329
+ bool add(size_t index, const char *k, const char *v);
330
+ /**
331
+ * Get oboe_metric_tag_t function
332
+ * Please note that SWIG doesn't have the definition of
333
+ * oboe_metric_tag_t.
334
+ * Ruby and Python should not call this method
335
+ * @return oboe_metric_tag_t*
336
+ */
337
+ oboe_metric_tag_t *get() const;
338
+ private:
339
+ oboe_metric_tag_t *tags;
340
+ size_t size;
341
+ };
342
+
343
+ class CustomMetrics {
344
+ public:
345
+ static int summary(const char *name, const double value, const int count, const int host_tag,
346
+ const char *service_name, const MetricTags *tags, size_t tags_count);
347
+
348
+ static int increment(const char *name, const int count, const int host_tag,
349
+ const char *service_name, const MetricTags *tags, size_t tags_count);
350
+ };
351
+
352
+ #ifndef SWIG // for profiling only used by Ruby gem c++-code
353
+ class OboeProfiling {
354
+ public:
355
+ static int get_interval();
356
+ };
357
+ #endif
358
+
359
+ class Reporter : private oboe_reporter_t {
360
+ friend class Context; // Access to the private oboe_reporter_t base structure.
361
+ public:
362
+ int init_status;
363
+
364
+ /**
365
+ * Initialize a reporter structure.
366
+ *
367
+ * See the wrapped Context::init for more details.
368
+ *
369
+ * @params these correspond to the keys of the oboe_init_options struct
370
+ */
371
+ Reporter(
372
+ std::string hostname_alias, // optional hostname alias
373
+ int log_level, // level at which log messages will be written to log file (0-6)
374
+ std::string log_file_path, // file name including path for log file
375
+
376
+ int max_transactions, // maximum number of transaction names to track
377
+ int max_flush_wait_time, // maximum wait time for flushing data before terminating in milli seconds
378
+ int events_flush_interval, // events flush timeout in seconds (threshold for batching messages before sending off)
379
+ int max_request_size_bytes, // events flush batch size in KB (threshold for batching messages before sending off)
380
+
381
+ std::string reporter, // the reporter to be used ("ssl", "upd", "file", "null")
382
+ std::string host, // collector endpoint (reporter=ssl), udp address (reporter=udp), or file path (reporter=file)
383
+ std::string service_key, // the service key (also known as access_key)
384
+ std::string trusted_path, // path to the SSL certificate (only for ssl)
385
+
386
+ int buffer_size, // size of the message buffer
387
+ int trace_metrics, // flag indicating if trace metrics reporting should be enabled (default) or disabled
388
+ int histogram_precision, // the histogram precision (only for ssl)
389
+ double token_bucket_capacity, // custom token bucket capacity
390
+ double token_bucket_rate, // custom token bucket rate
391
+ int file_single, // use single files in file reporter for each event
392
+
393
+ int ec2_metadata_timeout, // the timeout (milli seconds) for retrieving EC2 metadata
394
+ std::string grpc_proxy, // HTTP proxy address and port to be used for the gRPC connection
395
+ int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
396
+ // only used in lambda reporter (off=0, on=1, default off)
397
+ int is_grpc_clean_hack_enabled, // flag indicating if custom grpc clean hack enabled (default 0)
398
+ int w3c_trace_format // tag indicating trace id format (0 - legacy Xtrace, 1 - w3c)
399
+ );
400
+
401
+ ~Reporter();
402
+
403
+ bool sendReport(Event *evt);
404
+ bool sendReport(Event *evt, oboe_metadata_t *md);
405
+ bool sendStatus(Event *evt);
406
+ bool sendStatus(Event *evt, oboe_metadata_t *md);
407
+ void flush();
408
+ std::string getType();
409
+ };
410
+
411
+ class Config {
412
+ public:
413
+ /**
414
+ * Check if the Oboe library is compatible with a given version.revision.
415
+ *
416
+ * This will succeed if the library is at least as recent as specified and if no
417
+ * definitions have been removed since that revision.
418
+ *
419
+ * @param version The library's version number which increments every time the API changes.
420
+ * @param revision The revision of the current version of the library.
421
+ * @return Non-zero if the Oboe library is considered compatible with the specified revision.
422
+ */
423
+ static bool checkVersion(int version, int revision);
424
+
425
+ /**
426
+ * Get the complete Oboe library version number as a string, e.g. '10.0.3'
427
+ *
428
+ * @return The library's version string
429
+ */
430
+ static std::string getVersionString();
431
+ };
432
+
433
+ #endif // OBOE_API_HPP
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @file: debug.h - Diagnostic logging functions for liboboe.
3
+ *
4
+ * Most of the diagnostics logging interface is defined in oboe.h but we
5
+ * separate some of it out here for special handling when generating
6
+ * SWIG interfaces.
7
+ */
8
+
9
+ #ifndef _OBOE_DEBUG_H
10
+ #define _OBOE_DEBUG_H
11
+
12
+ #ifdef __cplusplus
13
+ extern "C" {
14
+ #endif
15
+
16
+ /**
17
+ * Defined diagnostic log detail levels.
18
+ */
19
+ enum OBOE_DEBUG_LOG_LEVEL {
20
+ OBOE_DEBUG_DISABLED = -1,
21
+ OBOE_DEBUG_FATAL = 0,
22
+ OBOE_DEBUG_ERROR = 1,
23
+ OBOE_DEBUG_WARNING = 2,
24
+ OBOE_DEBUG_INFO = 3,
25
+ OBOE_DEBUG_LOW = 4,
26
+ OBOE_DEBUG_MEDIUM = 5,
27
+ OBOE_DEBUG_HIGH = 6
28
+ };
29
+
30
+ /**
31
+ * Defined modules that do diagnostic logging.
32
+ */
33
+ enum OBOE_DEBUG_MODULE {
34
+ OBOE_MODULE_ALL = -1, /*!< Pseudo module to refer to ALL modules - used for configuring generic settings */
35
+ OBOE_MODULE_UNDEF = 0, /*!< Generic (undefined) module */
36
+ OBOE_MODULE_LIBOBOE, /*!< The core Oboe library */
37
+ OBOE_MODULE_SETTINGS, /*!< The Oboe settings functionality */
38
+ OBOE_MODULE_REPORTER_FILE, /*!< File reporter */
39
+ OBOE_MODULE_REPORTER_UDP, /*!< UDP (Tracelyzer) reporter */
40
+ OBOE_MODULE_REPORTER_SSL, /*!< SSL reporter */
41
+ OBOE_MODULE_REPORTER_LAMBDA, /*!< lambda wrapper */
42
+ OBOE_MODULE_APACHE, /*!< Apache webserver */
43
+ OBOE_MODULE_NGINX, /*!< Nginx webserver */
44
+ OBOE_MODULE_PHP, /*!< PHP interpreter */
45
+ OBOE_MODULE_DOTNET, /*!< dotnet wrapper */
46
+ OBOE_MODULE_RUBY, /*!< ruby c++ extension */
47
+ };
48
+
49
+ /**
50
+ * Initial debug log detail level.
51
+ *
52
+ */
53
+ #define LOGLEVEL_DEFAULT OBOE_DEBUG_INFO
54
+
55
+ #ifdef __cplusplus
56
+ } // extern "C"
57
+ #endif
58
+
59
+ #endif // _OBOE_DEBUG_H