appoptics_apm-zearn 4.13.1

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.
Files changed (145) 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 +103 -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 +168 -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 +159 -0
  12. data/.gitignore +36 -0
  13. data/.rubocop.yml +29 -0
  14. data/.travis.yml +130 -0
  15. data/.yardopts +6 -0
  16. data/CHANGELOG.md +769 -0
  17. data/CONFIG.md +33 -0
  18. data/Gemfile +14 -0
  19. data/LICENSE +202 -0
  20. data/README.md +393 -0
  21. data/appoptics_apm.gemspec +70 -0
  22. data/bin/appoptics_apm_config +15 -0
  23. data/examples/prepend.rb +13 -0
  24. data/examples/sdk_examples.rb +158 -0
  25. data/ext/oboe_metal/README.md +69 -0
  26. data/ext/oboe_metal/extconf.rb +151 -0
  27. data/ext/oboe_metal/lib/.keep +0 -0
  28. data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.0.0.0.sha256 +1 -0
  29. data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.0.0.0.sha256 +1 -0
  30. data/ext/oboe_metal/noop/noop.c +8 -0
  31. data/ext/oboe_metal/src/README.md +6 -0
  32. data/ext/oboe_metal/src/VERSION +2 -0
  33. data/ext/oboe_metal/src/bson/bson.h +220 -0
  34. data/ext/oboe_metal/src/bson/platform_hacks.h +91 -0
  35. data/ext/oboe_metal/src/frames.cc +246 -0
  36. data/ext/oboe_metal/src/frames.h +40 -0
  37. data/ext/oboe_metal/src/init_appoptics_apm.cc +21 -0
  38. data/ext/oboe_metal/src/logging.cc +95 -0
  39. data/ext/oboe_metal/src/logging.h +35 -0
  40. data/ext/oboe_metal/src/oboe.h +1156 -0
  41. data/ext/oboe_metal/src/oboe_api.cpp +652 -0
  42. data/ext/oboe_metal/src/oboe_api.hpp +431 -0
  43. data/ext/oboe_metal/src/oboe_debug.h +59 -0
  44. data/ext/oboe_metal/src/oboe_swig_wrap.cc +7329 -0
  45. data/ext/oboe_metal/src/profiling.cc +435 -0
  46. data/ext/oboe_metal/src/profiling.h +78 -0
  47. data/ext/oboe_metal/test/CMakeLists.txt +53 -0
  48. data/ext/oboe_metal/test/FindGMock.cmake +43 -0
  49. data/ext/oboe_metal/test/README.md +56 -0
  50. data/ext/oboe_metal/test/frames_test.cc +164 -0
  51. data/ext/oboe_metal/test/profiling_test.cc +93 -0
  52. data/ext/oboe_metal/test/ruby_inc_dir.rb +8 -0
  53. data/ext/oboe_metal/test/ruby_prefix.rb +8 -0
  54. data/ext/oboe_metal/test/ruby_test_helper.rb +67 -0
  55. data/ext/oboe_metal/test/test.h +11 -0
  56. data/ext/oboe_metal/test/test_main.cc +32 -0
  57. data/init.rb +4 -0
  58. data/lib/appoptics_apm/api/layerinit.rb +41 -0
  59. data/lib/appoptics_apm/api/logging.rb +381 -0
  60. data/lib/appoptics_apm/api/memcache.rb +37 -0
  61. data/lib/appoptics_apm/api/metrics.rb +63 -0
  62. data/lib/appoptics_apm/api/tracing.rb +57 -0
  63. data/lib/appoptics_apm/api/util.rb +120 -0
  64. data/lib/appoptics_apm/api.rb +21 -0
  65. data/lib/appoptics_apm/base.rb +231 -0
  66. data/lib/appoptics_apm/config.rb +299 -0
  67. data/lib/appoptics_apm/frameworks/grape.rb +98 -0
  68. data/lib/appoptics_apm/frameworks/padrino.rb +78 -0
  69. data/lib/appoptics_apm/frameworks/rails/inst/action_controller.rb +104 -0
  70. data/lib/appoptics_apm/frameworks/rails/inst/action_controller4.rb +48 -0
  71. data/lib/appoptics_apm/frameworks/rails/inst/action_controller5.rb +50 -0
  72. data/lib/appoptics_apm/frameworks/rails/inst/action_controller6.rb +50 -0
  73. data/lib/appoptics_apm/frameworks/rails/inst/action_controller_api.rb +50 -0
  74. data/lib/appoptics_apm/frameworks/rails/inst/action_view.rb +88 -0
  75. data/lib/appoptics_apm/frameworks/rails/inst/active_record.rb +27 -0
  76. data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql.rb +43 -0
  77. data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/mysql2.rb +29 -0
  78. data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/postgresql.rb +31 -0
  79. data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils.rb +119 -0
  80. data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +114 -0
  81. data/lib/appoptics_apm/frameworks/rails/inst/logger_formatters.rb +27 -0
  82. data/lib/appoptics_apm/frameworks/rails.rb +100 -0
  83. data/lib/appoptics_apm/frameworks/sinatra.rb +96 -0
  84. data/lib/appoptics_apm/inst/bunny-client.rb +148 -0
  85. data/lib/appoptics_apm/inst/bunny-consumer.rb +89 -0
  86. data/lib/appoptics_apm/inst/curb.rb +332 -0
  87. data/lib/appoptics_apm/inst/dalli.rb +85 -0
  88. data/lib/appoptics_apm/inst/delayed_job.rb +92 -0
  89. data/lib/appoptics_apm/inst/em-http-request.rb +101 -0
  90. data/lib/appoptics_apm/inst/excon.rb +125 -0
  91. data/lib/appoptics_apm/inst/faraday.rb +106 -0
  92. data/lib/appoptics_apm/inst/graphql.rb +240 -0
  93. data/lib/appoptics_apm/inst/grpc_client.rb +159 -0
  94. data/lib/appoptics_apm/inst/grpc_server.rb +120 -0
  95. data/lib/appoptics_apm/inst/http.rb +81 -0
  96. data/lib/appoptics_apm/inst/httpclient.rb +174 -0
  97. data/lib/appoptics_apm/inst/logger_formatter.rb +50 -0
  98. data/lib/appoptics_apm/inst/logging_log_event.rb +28 -0
  99. data/lib/appoptics_apm/inst/lumberjack_formatter.rb +13 -0
  100. data/lib/appoptics_apm/inst/memcached.rb +86 -0
  101. data/lib/appoptics_apm/inst/mongo.rb +246 -0
  102. data/lib/appoptics_apm/inst/mongo2.rb +225 -0
  103. data/lib/appoptics_apm/inst/moped.rb +466 -0
  104. data/lib/appoptics_apm/inst/rack.rb +182 -0
  105. data/lib/appoptics_apm/inst/rack_cache.rb +35 -0
  106. data/lib/appoptics_apm/inst/redis.rb +274 -0
  107. data/lib/appoptics_apm/inst/resque.rb +151 -0
  108. data/lib/appoptics_apm/inst/rest-client.rb +48 -0
  109. data/lib/appoptics_apm/inst/sequel.rb +178 -0
  110. data/lib/appoptics_apm/inst/sidekiq-client.rb +55 -0
  111. data/lib/appoptics_apm/inst/sidekiq-worker.rb +66 -0
  112. data/lib/appoptics_apm/inst/twitter-cassandra.rb +294 -0
  113. data/lib/appoptics_apm/inst/typhoeus.rb +108 -0
  114. data/lib/appoptics_apm/instrumentation.rb +22 -0
  115. data/lib/appoptics_apm/loading.rb +65 -0
  116. data/lib/appoptics_apm/logger.rb +14 -0
  117. data/lib/appoptics_apm/noop/README.md +9 -0
  118. data/lib/appoptics_apm/noop/context.rb +27 -0
  119. data/lib/appoptics_apm/noop/metadata.rb +25 -0
  120. data/lib/appoptics_apm/noop/profiling.rb +21 -0
  121. data/lib/appoptics_apm/oboe_init_options.rb +211 -0
  122. data/lib/appoptics_apm/ruby.rb +35 -0
  123. data/lib/appoptics_apm/sdk/current_trace.rb +77 -0
  124. data/lib/appoptics_apm/sdk/custom_metrics.rb +94 -0
  125. data/lib/appoptics_apm/sdk/logging.rb +37 -0
  126. data/lib/appoptics_apm/sdk/tracing.rb +434 -0
  127. data/lib/appoptics_apm/support/profiling.rb +18 -0
  128. data/lib/appoptics_apm/support/transaction_metrics.rb +67 -0
  129. data/lib/appoptics_apm/support/transaction_settings.rb +219 -0
  130. data/lib/appoptics_apm/support/x_trace_options.rb +110 -0
  131. data/lib/appoptics_apm/support_report.rb +119 -0
  132. data/lib/appoptics_apm/test.rb +95 -0
  133. data/lib/appoptics_apm/thread_local.rb +26 -0
  134. data/lib/appoptics_apm/util.rb +326 -0
  135. data/lib/appoptics_apm/version.rb +16 -0
  136. data/lib/appoptics_apm/xtrace.rb +115 -0
  137. data/lib/appoptics_apm.rb +77 -0
  138. data/lib/joboe_metal.rb +212 -0
  139. data/lib/oboe.rb +7 -0
  140. data/lib/oboe_metal.rb +172 -0
  141. data/lib/rails/generators/appoptics_apm/install_generator.rb +47 -0
  142. data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +425 -0
  143. data/log/.keep +0 -0
  144. data/yardoc_frontpage.md +26 -0
  145. metadata +231 -0
@@ -0,0 +1,431 @@
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 custom_sample_rate, 0-1000000
117
+ * @param custom_tracing_mode, 0(disabled) or 1(enabled)
118
+ * @param request_type, 0 normal sampling, 1 trigger trace
119
+ * @param custom_custom_trigger_mode, 0(disabled) or 1(enabled)
120
+ * @param header_options, the string from the X-Trace-Options header
121
+ * @param header_signature, the string from the X-Trace-Options-Signature header
122
+ * @param header_timestamp, the timestamp inside the X-Trace-Options header
123
+ *
124
+ * returns:
125
+ * @param do_metrics, ignore when using SWIG, it will be mapped to the first return value
126
+ * @param do_sample, ignore when using SWIG, it will be mapped to the second return value
127
+ * @param sample_rate, ignore when using SWIG, it will be mapped to the third return value
128
+ * @param sample_source, ignore when using SWIG, it will be mapped to the forth return value
129
+ * @param type, 0 normal sampling, 1 - trigger trace
130
+ * @param auth, 0 success, 1 failure, -1 not requested
131
+ * @param status_msg, message describing the trigger tracing decision
132
+ * @param auth_msg, message describing the success/failure of the authorization
133
+ *
134
+ * @status one of the OBOE_TRACING_DECISION_* codes
135
+ */
136
+
137
+ static void getDecisions(
138
+ // output
139
+ int *do_metrics,
140
+ int *do_sample,
141
+ int *sample_rate,
142
+ int *sample_source,
143
+ double *bucket_rate,
144
+ double *bucket_cap,
145
+ int *type,
146
+ int *auth,
147
+ std::string *status_msg,
148
+ std::string *auth_msg,
149
+ int *status,
150
+ // input
151
+ const char *in_xtrace = NULL,
152
+ int custom_tracing_mode = OBOE_SETTINGS_UNSET,
153
+ int custom_sample_rate = OBOE_SETTINGS_UNSET,
154
+ int request_type = 0,
155
+ int custom_trigger_mode = 0,
156
+ const char *header_options = NULL,
157
+ const char *header_signature = NULL,
158
+ long header_timestamp = 0);
159
+
160
+ /**
161
+ * Get a pointer to the current context (from thread-local storage)
162
+ */
163
+ static oboe_metadata_t *get();
164
+
165
+ /**
166
+ * Get the current context as a printable string.
167
+ */
168
+ #ifdef SWIGJAVA
169
+ static std::string toStr();
170
+ #else
171
+ static std::string toString();
172
+ #endif
173
+
174
+ /**
175
+ * Set the current context (this updates thread-local storage).
176
+ */
177
+ static void set(oboe_metadata_t *md);
178
+
179
+ /**
180
+ * Set the current context from a string.
181
+ */
182
+ static void fromString(std::string s);
183
+
184
+ // this new object is managed by SWIG %newobject
185
+ static Metadata *copy();
186
+
187
+ static void setSampledFlag();
188
+
189
+ static void clear();
190
+
191
+ static bool isValid();
192
+
193
+ static bool isSampled();
194
+
195
+ /**
196
+ * Perform validation and replacement of invalid characters on the given service key.
197
+ */
198
+ static std::string validateTransformServiceName(std::string service_key);
199
+
200
+ /**
201
+ * Shut down the Oboe library.
202
+ *
203
+ * This releases any resources held by the library which may include terminating
204
+ * child threads.
205
+ */
206
+ static void shutdown();
207
+
208
+ /**
209
+ * check if oboe is ready for tracing
210
+ *
211
+ * @param timeout an optional timeout (in milli seconds) to block this function until ready
212
+ * @return one of the return codes (see oboe.h):
213
+ * - OBOE_SERVER_RESPONSE_UNKNOWN
214
+ * - OBOE_SERVER_RESPONSE_OK
215
+ * - OBOE_SERVER_RESPONSE_TRY_LATER
216
+ * - OBOE_SERVER_RESPONSE_LIMIT_EXCEEDED
217
+ * - OBOE_SERVER_RESPONSE_INVALID_API_KEY
218
+ * - OBOE_SERVER_RESPONSE_CONNECT_ERROR
219
+ */
220
+ static int isReady(unsigned int timeout);
221
+
222
+ /**
223
+ * check if oboe is running in a AWS Lambda environment
224
+ */
225
+ static bool isLambda();
226
+
227
+ // these new objects are managed by SWIG %newobject
228
+ /**
229
+ * Create a new event object using the thread's context.
230
+ *
231
+ * NOTE: The returned object must be "delete"d.
232
+ */
233
+ static Event *createEvent();
234
+ static Event *startTrace();
235
+ };
236
+
237
+ class Event : private oboe_event_t {
238
+ friend class Reporter;
239
+ friend class Context;
240
+ friend class Metadata;
241
+
242
+ private:
243
+ Event();
244
+ Event(const oboe_metadata_t *md, bool addEdge = true);
245
+
246
+ public:
247
+ ~Event();
248
+
249
+ // called e.g. from Python e.addInfo("Key", None) & Ruby e.addInfo("Key", nil)
250
+ bool addInfo(char *key, void *val);
251
+ bool addInfo(char *key, const std::string &val);
252
+ bool addInfo(char *key, long val);
253
+ bool addInfo(char *key, double val);
254
+ bool addInfo(char *key, bool val);
255
+ bool addInfo(char *key, const long *vals, int num);
256
+
257
+ #ifndef SWIG // for profiling only used by Ruby gem cpp-code
258
+ bool addInfo(char *key, const std::vector<FrameData> &vals);
259
+ #endif
260
+
261
+ bool addEdge(oboe_metadata_t *md);
262
+ bool addEdgeStr(const std::string &val);
263
+ bool addContextOpId(const oboe_metadata_t *md);
264
+
265
+ bool addHostname();
266
+
267
+ /**
268
+ * Get a new copy of this metadata.
269
+ *
270
+ * NOTE: The returned object must be "delete"d.
271
+ */
272
+ Metadata *getMetadata();
273
+ std::string metadataString();
274
+ std::string opIdString();
275
+
276
+ /**
277
+ * Report this event.
278
+ *
279
+ * This sends the event using the default reporter.
280
+ *
281
+ * @return True on success; otherwise an error message is logged.
282
+ */
283
+ bool send();
284
+
285
+ /**
286
+ * Report a profiling event
287
+ *
288
+ * This sends the event using the dafault reporter
289
+ * It doesn't add a timestamp
290
+ * The timestamp needs to be precise for profiling and therefor
291
+ * needs to be added by the agent when the snapshot is taken
292
+ */
293
+ bool sendProfiling();
294
+
295
+ bool addSpanRef(const oboe_metadata_t *md);
296
+ bool addProfileEdge(std::string id);
297
+
298
+ /**
299
+ * Create a new event object using the given metadata context.
300
+ *
301
+ * NOTE: The metadata context must be unique to the new trace.
302
+ *
303
+ * NOTE: The returned object must be "delete"d.
304
+ *
305
+ * @param md The metadata object to use when creating the new event.
306
+ */
307
+ static Event *startTrace(const oboe_metadata_t *md);
308
+ };
309
+
310
+ class Span {
311
+ public:
312
+ /**
313
+ * these functions return the final transaction name
314
+ * to be used in the exit event of the trace
315
+ */
316
+ static std::string createSpan(const char *transaction, const char *domain, const int64_t duration, const int has_error, const char *service_name = NULL);
317
+
318
+ static std::string createHttpSpan(const char *transaction, const char *url, const char *domain, const int64_t duration,
319
+ const int status, const char *method, const int has_error, const char *service_name = NULL);
320
+ };
321
+
322
+ class MetricTags {
323
+ friend class CustomMetrics;
324
+
325
+ public:
326
+ MetricTags(size_t count);
327
+ ~MetricTags();
328
+ bool add(size_t index, const char *k, const char *v);
329
+ /**
330
+ * Get oboe_metric_tag_t function
331
+ * Please note that SWIG doesn't have the definition of
332
+ * oboe_metric_tag_t.
333
+ * Ruby and Python should not call this method
334
+ * @return oboe_metric_tag_t*
335
+ */
336
+ oboe_metric_tag_t *get() const;
337
+ private:
338
+ oboe_metric_tag_t *tags;
339
+ size_t size;
340
+ };
341
+
342
+ class CustomMetrics {
343
+ public:
344
+ static int summary(const char *name, const double value, const int count, const int host_tag,
345
+ const char *service_name, const MetricTags *tags, size_t tags_count);
346
+
347
+ static int increment(const char *name, const int count, const int host_tag,
348
+ const char *service_name, const MetricTags *tags, size_t tags_count);
349
+ };
350
+
351
+ #ifndef SWIG // for profiling only used by Ruby gem c++-code
352
+ class OboeProfiling {
353
+ public:
354
+ static int get_interval();
355
+ };
356
+ #endif
357
+
358
+ class Reporter : private oboe_reporter_t {
359
+ friend class Context; // Access to the private oboe_reporter_t base structure.
360
+ public:
361
+ int init_status;
362
+
363
+ /**
364
+ * Initialize a reporter structure.
365
+ *
366
+ * See the wrapped Context::init for more details.
367
+ *
368
+ * @params these correspond to the keys of the oboe_init_options struct
369
+ */
370
+ Reporter(
371
+ std::string hostname_alias, // optional hostname alias
372
+ int log_level, // level at which log messages will be written to log file (0-6)
373
+ std::string log_file_path, // file name including path for log file
374
+
375
+ int max_transactions, // maximum number of transaction names to track
376
+ int max_flush_wait_time, // maximum wait time for flushing data before terminating in milli seconds
377
+ int events_flush_interval, // events flush timeout in seconds (threshold for batching messages before sending off)
378
+ int max_request_size_bytes, // events flush batch size in KB (threshold for batching messages before sending off)
379
+
380
+ std::string reporter, // the reporter to be used ("ssl", "upd", "file", "null")
381
+ std::string host, // collector endpoint (reporter=ssl), udp address (reporter=udp), or file path (reporter=file)
382
+ std::string service_key, // the service key (also known as access_key)
383
+ std::string trusted_path, // path to the SSL certificate (only for ssl)
384
+
385
+ int buffer_size, // size of the message buffer
386
+ int trace_metrics, // flag indicating if trace metrics reporting should be enabled (default) or disabled
387
+ int histogram_precision, // the histogram precision (only for ssl)
388
+ double token_bucket_capacity, // custom token bucket capacity
389
+ double token_bucket_rate, // custom token bucket rate
390
+ int file_single, // use single files in file reporter for each event
391
+
392
+ int ec2_metadata_timeout, // the timeout (milli seconds) for retrieving EC2 metadata
393
+ std::string grpc_proxy, // HTTP proxy address and port to be used for the gRPC connection
394
+ int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
395
+ // only used in lambda reporter (off=0, on=1, default off)
396
+ int is_grpc_clean_hack_enabled // flag indicating if custom grpc clean hack enabled (default 0)
397
+ );
398
+
399
+ ~Reporter();
400
+
401
+ bool sendReport(Event *evt);
402
+ bool sendReport(Event *evt, oboe_metadata_t *md);
403
+ bool sendStatus(Event *evt);
404
+ bool sendStatus(Event *evt, oboe_metadata_t *md);
405
+ void flush();
406
+ std::string getType();
407
+ };
408
+
409
+ class Config {
410
+ public:
411
+ /**
412
+ * Check if the Oboe library is compatible with a given version.revision.
413
+ *
414
+ * This will succeed if the library is at least as recent as specified and if no
415
+ * definitions have been removed since that revision.
416
+ *
417
+ * @param version The library's version number which increments every time the API changes.
418
+ * @param revision The revision of the current version of the library.
419
+ * @return Non-zero if the Oboe library is considered compatible with the specified revision.
420
+ */
421
+ static bool checkVersion(int version, int revision);
422
+
423
+ /**
424
+ * Get the complete Oboe library version number as a string, e.g. '10.0.3'
425
+ *
426
+ * @return The library's version string
427
+ */
428
+ static std::string getVersionString();
429
+ };
430
+
431
+ #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