appoptics_apm 4.12.2 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build_and_release_gem.yml +103 -0
  3. data/.github/workflows/build_for_packagecloud.yml +70 -0
  4. data/.github/workflows/docker-images.yml +47 -0
  5. data/.github/workflows/run_cpluplus_tests.yml +73 -0
  6. data/.github/workflows/run_tests.yml +168 -0
  7. data/.github/workflows/scripts/test_install.rb +23 -0
  8. data/.github/workflows/swig/swig-v4.0.2.tar.gz +0 -0
  9. data/.github/workflows/test_on_4_linux.yml +159 -0
  10. data/.gitignore +17 -25
  11. data/.travis.yml +17 -14
  12. data/Gemfile +1 -25
  13. data/README.md +4 -6
  14. data/appoptics_apm.gemspec +11 -5
  15. data/examples/prepend.rb +13 -0
  16. data/examples/sdk_examples.rb +16 -0
  17. data/ext/oboe_metal/extconf.rb +25 -31
  18. data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.0.0.0.sha256 +1 -0
  19. data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.0.0.0.sha256 +1 -0
  20. data/ext/oboe_metal/src/README.md +6 -0
  21. data/ext/oboe_metal/src/VERSION +2 -1
  22. data/ext/oboe_metal/src/frames.cc +246 -0
  23. data/ext/oboe_metal/src/frames.h +40 -0
  24. data/ext/oboe_metal/src/init_appoptics_apm.cc +5 -4
  25. data/ext/oboe_metal/src/logging.cc +95 -0
  26. data/ext/oboe_metal/src/logging.h +35 -0
  27. data/ext/oboe_metal/src/oboe.h +8 -5
  28. data/ext/oboe_metal/src/oboe_api.cpp +40 -14
  29. data/ext/oboe_metal/src/oboe_api.hpp +29 -8
  30. data/ext/oboe_metal/src/oboe_debug.h +1 -0
  31. data/ext/oboe_metal/src/oboe_swig_wrap.cc +85 -21
  32. data/ext/oboe_metal/src/profiling.cc +435 -0
  33. data/ext/oboe_metal/src/profiling.h +78 -0
  34. data/ext/oboe_metal/test/CMakeLists.txt +53 -0
  35. data/ext/oboe_metal/test/FindGMock.cmake +43 -0
  36. data/ext/oboe_metal/test/README.md +56 -0
  37. data/ext/oboe_metal/test/frames_test.cc +164 -0
  38. data/ext/oboe_metal/test/profiling_test.cc +93 -0
  39. data/ext/oboe_metal/test/ruby_inc_dir.rb +8 -0
  40. data/ext/oboe_metal/test/ruby_prefix.rb +8 -0
  41. data/ext/oboe_metal/test/ruby_test_helper.rb +67 -0
  42. data/ext/oboe_metal/test/test.h +11 -0
  43. data/ext/oboe_metal/test/test_main.cc +32 -0
  44. data/lib/appoptics_apm/api/metrics.rb +3 -0
  45. data/lib/appoptics_apm/base.rb +1 -1
  46. data/lib/appoptics_apm/config.rb +11 -2
  47. data/lib/appoptics_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +7 -1
  48. data/lib/appoptics_apm/inst/rack.rb +13 -6
  49. data/lib/appoptics_apm/inst/redis.rb +1 -2
  50. data/lib/appoptics_apm/noop/context.rb +3 -0
  51. data/lib/appoptics_apm/noop/metadata.rb +4 -1
  52. data/lib/appoptics_apm/noop/profiling.rb +21 -0
  53. data/lib/appoptics_apm/oboe_init_options.rb +26 -22
  54. data/lib/appoptics_apm/support/profiling.rb +18 -0
  55. data/lib/appoptics_apm/support/transaction_metrics.rb +1 -1
  56. data/lib/appoptics_apm/support/transaction_settings.rb +2 -2
  57. data/lib/appoptics_apm/support/x_trace_options.rb +2 -2
  58. data/lib/appoptics_apm/support_report.rb +2 -2
  59. data/lib/appoptics_apm/test.rb +4 -3
  60. data/lib/appoptics_apm/util.rb +1 -1
  61. data/lib/appoptics_apm/version.rb +3 -3
  62. data/lib/appoptics_apm/xtrace.rb +1 -1
  63. data/lib/appoptics_apm.rb +3 -1
  64. data/lib/oboe_metal.rb +2 -2
  65. data/lib/rails/generators/appoptics_apm/templates/appoptics_apm_initializer.rb +24 -0
  66. data/log/.keep +0 -0
  67. metadata +46 -16
  68. data/.travis/bundle.sh +0 -9
@@ -0,0 +1,95 @@
1
+ // Copyright (c) 2021 SolarWinds, LLC.
2
+ // All rights reserved.
3
+
4
+ #include "logging.h"
5
+
6
+ using namespace std;
7
+
8
+ const string Logging::profiling = "profiling";
9
+ const string Logging::ruby = "ruby";
10
+ const string Logging::entry = "entry";
11
+ const string Logging::info = "info";
12
+ const string Logging::exit = "exit";
13
+
14
+ Event *Logging::createEvent(Metadata &md, string &prof_op_id, bool entry_event) {
15
+ // startTrace does not add "Edge", for profiling we need to keep track of edges
16
+ // separately from the main trace metadata
17
+
18
+ oboe_metadata_t *md_t = md.metadata();
19
+ Event *event = Event::startTrace(md_t);
20
+
21
+ if (entry_event) {
22
+ event->addSpanRef(md_t);
23
+ } else {
24
+ event->addProfileEdge(prof_op_id);
25
+ event->addContextOpId(md_t);
26
+ }
27
+ prof_op_id.assign(event->opIdString());
28
+
29
+ return event;
30
+ }
31
+
32
+ bool Logging::log_profile_entry(Metadata &md, string &prof_op_id, pid_t tid, long interval) {
33
+ Event *event = Logging::createEvent(md, prof_op_id, true);
34
+ event->addInfo((char *)"Label", Logging::entry);
35
+ event->addInfo((char *)"Language", Logging::ruby);
36
+ event->addInfo((char *)"TID", (long)tid);
37
+ event->addInfo((char *)"Interval", interval);
38
+
39
+ struct timeval tv;
40
+ oboe_gettimeofday(&tv);
41
+ event->addInfo((char *)"Timestamp_u", (long)tv.tv_sec * 1000000 + (long)tv.tv_usec);
42
+
43
+ return Logging::log_profile_event(event);
44
+ }
45
+
46
+ bool Logging::log_profile_exit(Metadata &md, string &prof_op_id, pid_t tid,
47
+ long *omitted, int num_omitted) {
48
+ Event *event = Logging::createEvent(md, prof_op_id);
49
+ event->addInfo((char *)"Label", Logging::exit);
50
+ event->addInfo((char *)"TID", (long)tid);
51
+ event->addInfo((char *)"SnapshotsOmitted", omitted, num_omitted);
52
+
53
+ struct timeval tv;
54
+ oboe_gettimeofday(&tv);
55
+ event->addInfo((char *)"Timestamp_u", (long)tv.tv_sec * 1000000 + (long)tv.tv_usec);
56
+
57
+ return Logging::log_profile_event(event);
58
+ }
59
+
60
+ bool Logging::log_profile_snapshot(Metadata &md,
61
+ string &prof_op_id,
62
+ long timestamp,
63
+ std::vector<FrameData> const &new_frames,
64
+ long exited_frames,
65
+ long total_frames,
66
+ long *omitted,
67
+ int num_omitted,
68
+ pid_t tid) {
69
+
70
+ Event *event = Logging::createEvent(md, prof_op_id);
71
+ event->addInfo((char *)"Timestamp_u", timestamp);
72
+ event->addInfo((char *)"Label", Logging::info);
73
+
74
+ event->addInfo((char *)"SnapshotsOmitted", omitted, num_omitted);
75
+ event->addInfo((char *)"NewFrames", new_frames);
76
+ event->addInfo((char *)"FramesExited", exited_frames);
77
+ event->addInfo((char *)"FramesCount", total_frames);
78
+ event->addInfo((char *)"TID", (long)tid);
79
+
80
+ return Logging::log_profile_event(event);
81
+ }
82
+
83
+ bool Logging::log_profile_event(Event *event) {
84
+ event->addInfo((char *)"Spec", Logging::profiling);
85
+ event->addHostname();
86
+ event->addInfo((char *)"PID", (long)AO_GETPID());
87
+ event->addInfo((char *)"X-Trace", event->metadataString());
88
+ event->sendProfiling();
89
+
90
+ // see comment in oboe_api.cpp:
91
+ // "event needs to be deleted, it is managed by swig %newobject"
92
+ // !!! It needs to be deleted, I tested it !!!
93
+ delete event;
94
+ return true;
95
+ }
@@ -0,0 +1,35 @@
1
+ // Copyright (c) 2021 SolarWinds, LLC.
2
+ // All rights reserved.
3
+
4
+ #ifndef LOGGING_H
5
+ #define LOGGING_H
6
+
7
+ #include "oboe_api.hpp"
8
+
9
+ using namespace std;
10
+
11
+ extern "C" int oboe_gettimeofday(struct timeval *tv);
12
+
13
+
14
+ class Logging {
15
+ public:
16
+ static const string profiling, ruby, entry, info, exit;
17
+ static bool log_profile_entry(Metadata &md, string &prof_op_id, pid_t tid, long interval);
18
+ static bool log_profile_exit(Metadata &md, string &prof_op_id, pid_t tid,
19
+ long *omitted, int num_omitted);
20
+ static bool log_profile_snapshot(Metadata &md,
21
+ string &prof_op_id,
22
+ long timestamp,
23
+ std::vector<FrameData> const &new_frames,
24
+ long exited_frames,
25
+ long total_frames,
26
+ long *omitted,
27
+ int num_omitted,
28
+ pid_t tid);
29
+
30
+ private:
31
+ static Event *createEvent(Metadata &md, string &prof_op_id, bool entry_event = false);
32
+ static bool log_profile_event(Event *event);
33
+ };
34
+
35
+ #endif //LOGGING_H
@@ -161,7 +161,7 @@ typedef struct oboe_metric_tag {
161
161
  } oboe_metric_tag_t;
162
162
 
163
163
  typedef struct oboe_init_options {
164
- int version; // the version of this structure
164
+ int version; // the version of this structure (currently on version 12)
165
165
  const char *hostname_alias; // optional hostname alias
166
166
  int log_level; // level at which log messages will be written to log file (0-6)
167
167
  // use LOGLEVEL_DEFAULT for default log level
@@ -184,6 +184,9 @@ typedef struct oboe_init_options {
184
184
 
185
185
  int ec2_metadata_timeout; // EC2 metadata timeout in milliseconds
186
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 is_grpc_clean_hack_enabled; // flag indicating if custom grpc clean hack enabled (default 0)
187
190
  } oboe_init_options_t;
188
191
 
189
192
  typedef struct oboe_span_params {
@@ -265,9 +268,9 @@ int oboe_metadata_destroy (oboe_metadata_t *);
265
268
 
266
269
  int oboe_metadata_is_valid (const oboe_metadata_t *);
267
270
 
268
- void oboe_metadata_copy (oboe_metadata_t *, const oboe_metadata_t *);
271
+ int oboe_metadata_copy (oboe_metadata_t *, const oboe_metadata_t *);
269
272
 
270
- void oboe_metadata_random (oboe_metadata_t *);
273
+ int oboe_metadata_random (oboe_metadata_t *);
271
274
 
272
275
  int oboe_metadata_set_lengths (oboe_metadata_t *, size_t, size_t);
273
276
  int oboe_metadata_create_event (const oboe_metadata_t *, oboe_event_t *);
@@ -311,10 +314,10 @@ int oboe_event_send(int channel, oboe_event_t *evt, oboe_metadata_t *md);
311
314
  // oboe_context
312
315
 
313
316
  oboe_metadata_t *oboe_context_get();
314
- void oboe_context_set(oboe_metadata_t *);
317
+ int oboe_context_set(oboe_metadata_t *);
315
318
  int oboe_context_set_fromstr(const char *, size_t);
316
319
 
317
- void oboe_context_clear();
320
+ int oboe_context_clear();
318
321
 
319
322
  int oboe_context_is_valid();
320
323
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  /////// Metatdata ///////
12
12
 
13
- Metadata::Metadata(oboe_metadata_t *md) {
13
+ Metadata::Metadata(const oboe_metadata_t *md) {
14
14
  oboe_metadata_copy(this, md);
15
15
  }
16
16
 
@@ -80,9 +80,9 @@ void Context::setDefaultSampleRate(int newRate) {
80
80
  }
81
81
 
82
82
  void Context::getDecisions(
83
- // this paramter list is too long, but other forms of sending info
83
+ // this paramter list is too long, but other forms of sending info
84
84
  // between python/ruby and c++ would require extra roudn trips
85
- // and may be less efficient.
85
+ // and may be less efficient.
86
86
  // TODO: benchmark this assumption
87
87
 
88
88
  // output
@@ -214,6 +214,10 @@ int Context::isReady(unsigned int timeout) {
214
214
  return oboe_is_ready(timeout);
215
215
  }
216
216
 
217
+ bool Context::isLambda() {
218
+ return (bool) oboe_is_lambda();
219
+ }
220
+
217
221
  /**
218
222
  * Create a new event object that continues the trace context.
219
223
  *
@@ -289,7 +293,7 @@ bool Event::addInfo(char *key, bool val) {
289
293
  }
290
294
 
291
295
  /*
292
- * this function was added for profiling
296
+ * this function was added for profiling
293
297
  * to report the timestamps of omitted snapshots
294
298
  */
295
299
  bool Event::addInfo(char *key, const long *vals, int num) {
@@ -324,7 +328,7 @@ bool Event::addInfo(char *key, const std::vector<FrameData> &vals) {
324
328
  oboe_bson_append_string(&(this->bbuf), "C", (val.klass).c_str());
325
329
  if (val.file != "")
326
330
  oboe_bson_append_string(&(this->bbuf), "F", (val.file).c_str());
327
- if (val.lineno != 0)
331
+ if (val.lineno > 0)
328
332
  oboe_bson_append_long(&(this->bbuf), "L", (int64_t)val.lineno);
329
333
 
330
334
  oboe_bson_append_finish_object(&(this->bbuf));
@@ -357,7 +361,7 @@ bool Event::addHostname() {
357
361
  return oboe_event_add_info(this, "Hostname", oboe_hostname) == 0;
358
362
  }
359
363
 
360
- bool Event::addContextOpId(oboe_metadata_t *md) {
364
+ bool Event::addContextOpId(const oboe_metadata_t *md) {
361
365
  char buf[OBOE_MAX_METADATA_PACK_LEN]; // Flawfinder: ignore
362
366
  oboe_metadata_tostr(md, buf, OBOE_MAX_METADATA_PACK_LEN);
363
367
  buf[58] = '\0';
@@ -365,7 +369,7 @@ bool Event::addContextOpId(oboe_metadata_t *md) {
365
369
  return oboe_event_add_info(this, "ContextOpId", &buf[42]);
366
370
  }
367
371
 
368
- bool Event::addSpanRef(oboe_metadata_t *md) {
372
+ bool Event::addSpanRef(const oboe_metadata_t *md) {
369
373
  char buf[OBOE_MAX_METADATA_PACK_LEN]; // Flawfinder: ignore
370
374
  oboe_metadata_tostr(md, buf, OBOE_MAX_METADATA_PACK_LEN);
371
375
  buf[58] = '\0';
@@ -483,18 +487,26 @@ std::string Span::createHttpSpan(const char *transaction, const char *url, const
483
487
 
484
488
  MetricTags::MetricTags(size_t count) {
485
489
  tags = new oboe_metric_tag_t[count];
490
+ for (size_t i = 0; i < count; i++) {
491
+ tags[i].key = nullptr;
492
+ tags[i].value = nullptr;
493
+ }
486
494
  size = count;
487
495
  }
488
496
 
489
497
  MetricTags::~MetricTags() {
498
+ for (size_t i = 0; i < size; i++) {
499
+ delete tags[i].key; tags[i].key = nullptr;
500
+ delete tags[i].value; tags[i].value = nullptr;
501
+ }
490
502
  delete[] tags;
491
503
  }
492
504
 
493
- bool MetricTags::add(size_t index, char *k, char *v) {
505
+ bool MetricTags::add(size_t index, const char *k, const char *v) {
494
506
  if (index < size) {
495
- tags[index].key = k;
496
- tags[index].value = v;
497
- return true;
507
+ tags[index].key = strdup(k);
508
+ tags[index].value = strdup(v);
509
+ return (tags[index].key != nullptr && tags[index].value != nullptr);
498
510
  }
499
511
  return false;
500
512
  }
@@ -520,6 +532,15 @@ int CustomMetrics::increment(const char *name, const int count, const int host_t
520
532
  return oboe_custom_metric_increment(name, count, host_tag, service_name, tags->get(), tags_count);
521
533
  }
522
534
 
535
+ /////// Profiling ///////
536
+
537
+ // adding this to have a proper interface, even though it just
538
+ // returns the return value of the oboe function
539
+ // 0 indicates not to profile, returns -1 if the collector hasn't sent anything
540
+ int OboeProfiling::get_interval() {
541
+ return oboe_get_profiling_interval();
542
+ }
543
+
523
544
  /////// Reporter ///////
524
545
 
525
546
  Reporter::Reporter(
@@ -544,12 +565,15 @@ Reporter::Reporter(
544
565
  double token_bucket_rate, // custom token bucket rate
545
566
  int file_single, // use single files in file reporter for each event
546
567
 
547
- int ec2_metadata_timeout, // the timeout (milli seconds) for retrieving EC2 metadata
548
- std::string grpc_proxy // HTTP proxy address and port to be used for the gRPC connection
568
+ int ec2_metadata_timeout, // the timeout (milli seconds) for retrieving EC2 metadata
569
+ std::string grpc_proxy, // HTTP proxy address and port to be used for the gRPC connection
570
+ int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
571
+ // only used in lambda reporter (off=0, on=1, default off)
572
+ int is_grpc_clean_hack_enabled // flag indicating if custom grpc clean hack enabled (default 0)
549
573
  ) {
550
574
  oboe_init_options_t options;
551
575
  memset(&options, 0, sizeof(options));
552
- options.version = 10;
576
+ options.version = 12;
553
577
  oboe_init_options_set_defaults(&options);
554
578
 
555
579
  if (hostname_alias != "") {
@@ -583,6 +607,8 @@ Reporter::Reporter(
583
607
  if (grpc_proxy != "") {
584
608
  options.proxy = grpc_proxy.c_str();
585
609
  }
610
+ options.stdout_clear_nonblocking = stdout_clear_nonblocking;
611
+ options.is_grpc_clean_hack_enabled = is_grpc_clean_hack_enabled;
586
612
  init_status = oboe_init(&options);
587
613
  }
588
614
 
@@ -41,7 +41,7 @@ class Metadata : private oboe_metadata_t {
41
41
  friend class Context;
42
42
 
43
43
  public:
44
- Metadata(oboe_metadata_t *md);
44
+ Metadata(const oboe_metadata_t *md);
45
45
  ~Metadata();
46
46
 
47
47
  // these new objects are managed by SWIG %newobject
@@ -219,6 +219,11 @@ class Context {
219
219
  */
220
220
  static int isReady(unsigned int timeout);
221
221
 
222
+ /**
223
+ * check if oboe is running in a AWS Lambda environment
224
+ */
225
+ static bool isLambda();
226
+
222
227
  // these new objects are managed by SWIG %newobject
223
228
  /**
224
229
  * Create a new event object using the thread's context.
@@ -255,7 +260,7 @@ class Event : private oboe_event_t {
255
260
 
256
261
  bool addEdge(oboe_metadata_t *md);
257
262
  bool addEdgeStr(const std::string &val);
258
- bool addContextOpId(oboe_metadata_t *md);
263
+ bool addContextOpId(const oboe_metadata_t *md);
259
264
 
260
265
  bool addHostname();
261
266
 
@@ -287,7 +292,7 @@ class Event : private oboe_event_t {
287
292
  */
288
293
  bool sendProfiling();
289
294
 
290
- bool addSpanRef(oboe_metadata_t *md);
295
+ bool addSpanRef(const oboe_metadata_t *md);
291
296
  bool addProfileEdge(std::string id);
292
297
 
293
298
  /**
@@ -320,10 +325,16 @@ class MetricTags {
320
325
  public:
321
326
  MetricTags(size_t count);
322
327
  ~MetricTags();
323
- bool add(size_t index, char *k, char *v);
324
-
325
- private:
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
+ */
326
336
  oboe_metric_tag_t *get() const;
337
+ private:
327
338
  oboe_metric_tag_t *tags;
328
339
  size_t size;
329
340
  };
@@ -337,6 +348,13 @@ class CustomMetrics {
337
348
  const char *service_name, const MetricTags *tags, size_t tags_count);
338
349
  };
339
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
+
340
358
  class Reporter : private oboe_reporter_t {
341
359
  friend class Context; // Access to the private oboe_reporter_t base structure.
342
360
  public:
@@ -371,8 +389,11 @@ class Reporter : private oboe_reporter_t {
371
389
  double token_bucket_rate, // custom token bucket rate
372
390
  int file_single, // use single files in file reporter for each event
373
391
 
374
- int ec2_metadata_timeout, // the timeout (milli seconds) for retrieving EC2 metadata
375
- std::string grpc_proxy // HTTP proxy address and port to be used for the gRPC connection
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)
376
397
  );
377
398
 
378
399
  ~Reporter();
@@ -43,6 +43,7 @@ enum OBOE_DEBUG_MODULE {
43
43
  OBOE_MODULE_NGINX, /*!< Nginx webserver */
44
44
  OBOE_MODULE_PHP, /*!< PHP interpreter */
45
45
  OBOE_MODULE_DOTNET, /*!< dotnet wrapper */
46
+ OBOE_MODULE_RUBY, /*!< ruby c++ extension */
46
47
  };
47
48
 
48
49
  /**
@@ -1858,15 +1858,16 @@ int SWIG_Ruby_arity( VALUE proc, int minimal )
1858
1858
  #define SWIGTYPE_p_long swig_types[11]
1859
1859
  #define SWIGTYPE_p_long_long swig_types[12]
1860
1860
  #define SWIGTYPE_p_oboe_metadata_t swig_types[13]
1861
- #define SWIGTYPE_p_short swig_types[14]
1862
- #define SWIGTYPE_p_signed_char swig_types[15]
1863
- #define SWIGTYPE_p_std__string swig_types[16]
1864
- #define SWIGTYPE_p_unsigned_char swig_types[17]
1865
- #define SWIGTYPE_p_unsigned_int swig_types[18]
1866
- #define SWIGTYPE_p_unsigned_long_long swig_types[19]
1867
- #define SWIGTYPE_p_unsigned_short swig_types[20]
1868
- static swig_type_info *swig_types[22];
1869
- static swig_module_info swig_module = {swig_types, 21, 0, 0, 0, 0};
1861
+ #define SWIGTYPE_p_oboe_metric_tag_t swig_types[14]
1862
+ #define SWIGTYPE_p_short swig_types[15]
1863
+ #define SWIGTYPE_p_signed_char swig_types[16]
1864
+ #define SWIGTYPE_p_std__string swig_types[17]
1865
+ #define SWIGTYPE_p_unsigned_char swig_types[18]
1866
+ #define SWIGTYPE_p_unsigned_int swig_types[19]
1867
+ #define SWIGTYPE_p_unsigned_long_long swig_types[20]
1868
+ #define SWIGTYPE_p_unsigned_short swig_types[21]
1869
+ static swig_type_info *swig_types[23];
1870
+ static swig_module_info swig_module = {swig_types, 22, 0, 0, 0, 0};
1870
1871
  #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1871
1872
  #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1872
1873
 
@@ -2300,10 +2301,10 @@ _wrap_new_Metadata(int argc, VALUE *argv, VALUE self) {
2300
2301
  }
2301
2302
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
2302
2303
  if (!SWIG_IsOK(res1)) {
2303
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "oboe_metadata_t *","Metadata", 1, argv[0] ));
2304
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "oboe_metadata_t const *","Metadata", 1, argv[0] ));
2304
2305
  }
2305
2306
  arg1 = reinterpret_cast< oboe_metadata_t * >(argp1);
2306
- result = (Metadata *)new Metadata(arg1);
2307
+ result = (Metadata *)new Metadata((oboe_metadata_t const *)arg1);
2307
2308
  DATA_PTR(self) = result;
2308
2309
  return self;
2309
2310
  fail:
@@ -4518,6 +4519,22 @@ fail:
4518
4519
  }
4519
4520
 
4520
4521
 
4522
+ SWIGINTERN VALUE
4523
+ _wrap_Context_isLambda(int argc, VALUE *argv, VALUE self) {
4524
+ bool result;
4525
+ VALUE vresult = Qnil;
4526
+
4527
+ if ((argc < 0) || (argc > 0)) {
4528
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4529
+ }
4530
+ result = (bool)Context::isLambda();
4531
+ vresult = SWIG_From_bool(static_cast< bool >(result));
4532
+ return vresult;
4533
+ fail:
4534
+ return Qnil;
4535
+ }
4536
+
4537
+
4521
4538
  SWIGINTERN VALUE
4522
4539
  _wrap_Context_createEvent(int argc, VALUE *argv, VALUE self) {
4523
4540
  Event *result = 0 ;
@@ -5098,10 +5115,10 @@ _wrap_Event_addContextOpId(int argc, VALUE *argv, VALUE self) {
5098
5115
  arg1 = reinterpret_cast< Event * >(argp1);
5099
5116
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
5100
5117
  if (!SWIG_IsOK(res2)) {
5101
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "oboe_metadata_t *","addContextOpId", 2, argv[0] ));
5118
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "oboe_metadata_t const *","addContextOpId", 2, argv[0] ));
5102
5119
  }
5103
5120
  arg2 = reinterpret_cast< oboe_metadata_t * >(argp2);
5104
- result = (bool)(arg1)->addContextOpId(arg2);
5121
+ result = (bool)(arg1)->addContextOpId((oboe_metadata_t const *)arg2);
5105
5122
  vresult = SWIG_From_bool(static_cast< bool >(result));
5106
5123
  return vresult;
5107
5124
  fail:
@@ -5274,10 +5291,10 @@ _wrap_Event_addSpanRef(int argc, VALUE *argv, VALUE self) {
5274
5291
  arg1 = reinterpret_cast< Event * >(argp1);
5275
5292
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_oboe_metadata_t, 0 | 0 );
5276
5293
  if (!SWIG_IsOK(res2)) {
5277
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "oboe_metadata_t *","addSpanRef", 2, argv[0] ));
5294
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "oboe_metadata_t const *","addSpanRef", 2, argv[0] ));
5278
5295
  }
5279
5296
  arg2 = reinterpret_cast< oboe_metadata_t * >(argp2);
5280
- result = (bool)(arg1)->addSpanRef(arg2);
5297
+ result = (bool)(arg1)->addSpanRef((oboe_metadata_t const *)arg2);
5281
5298
  vresult = SWIG_From_bool(static_cast< bool >(result));
5282
5299
  return vresult;
5283
5300
  fail:
@@ -5931,15 +5948,15 @@ _wrap_MetricTags_add(int argc, VALUE *argv, VALUE self) {
5931
5948
  arg2 = static_cast< size_t >(val2);
5932
5949
  res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
5933
5950
  if (!SWIG_IsOK(res3)) {
5934
- SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char *","add", 3, argv[1] ));
5951
+ SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","add", 3, argv[1] ));
5935
5952
  }
5936
5953
  arg3 = reinterpret_cast< char * >(buf3);
5937
5954
  res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4);
5938
5955
  if (!SWIG_IsOK(res4)) {
5939
- SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char *","add", 4, argv[2] ));
5956
+ SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","add", 4, argv[2] ));
5940
5957
  }
5941
5958
  arg4 = reinterpret_cast< char * >(buf4);
5942
- result = (bool)(arg1)->add(arg2,arg3,arg4);
5959
+ result = (bool)(arg1)->add(arg2,(char const *)arg3,(char const *)arg4);
5943
5960
  vresult = SWIG_From_bool(static_cast< bool >(result));
5944
5961
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
5945
5962
  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
@@ -5951,6 +5968,30 @@ fail:
5951
5968
  }
5952
5969
 
5953
5970
 
5971
+ SWIGINTERN VALUE
5972
+ _wrap_MetricTags_get(int argc, VALUE *argv, VALUE self) {
5973
+ MetricTags *arg1 = (MetricTags *) 0 ;
5974
+ void *argp1 = 0 ;
5975
+ int res1 = 0 ;
5976
+ oboe_metric_tag_t *result = 0 ;
5977
+ VALUE vresult = Qnil;
5978
+
5979
+ if ((argc < 0) || (argc > 0)) {
5980
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
5981
+ }
5982
+ res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MetricTags, 0 | 0 );
5983
+ if (!SWIG_IsOK(res1)) {
5984
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MetricTags const *","get", 1, self ));
5985
+ }
5986
+ arg1 = reinterpret_cast< MetricTags * >(argp1);
5987
+ result = (oboe_metric_tag_t *)((MetricTags const *)arg1)->get();
5988
+ vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_oboe_metric_tag_t, 0 | 0 );
5989
+ return vresult;
5990
+ fail:
5991
+ return Qnil;
5992
+ }
5993
+
5994
+
5954
5995
  static swig_class SwigClassCustomMetrics;
5955
5996
 
5956
5997
  SWIGINTERN VALUE
@@ -6228,6 +6269,8 @@ _wrap_new_Reporter(int argc, VALUE *argv, VALUE self) {
6228
6269
  int arg17 ;
6229
6270
  int arg18 ;
6230
6271
  std::string arg19 ;
6272
+ int arg20 ;
6273
+ int arg21 ;
6231
6274
  int val2 ;
6232
6275
  int ecode2 = 0 ;
6233
6276
  int val4 ;
@@ -6252,10 +6295,14 @@ _wrap_new_Reporter(int argc, VALUE *argv, VALUE self) {
6252
6295
  int ecode17 = 0 ;
6253
6296
  int val18 ;
6254
6297
  int ecode18 = 0 ;
6298
+ int val20 ;
6299
+ int ecode20 = 0 ;
6300
+ int val21 ;
6301
+ int ecode21 = 0 ;
6255
6302
  Reporter *result = 0 ;
6256
6303
 
6257
- if ((argc < 19) || (argc > 19)) {
6258
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 19)",argc); SWIG_fail;
6304
+ if ((argc < 21) || (argc > 21)) {
6305
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 21)",argc); SWIG_fail;
6259
6306
  }
6260
6307
  {
6261
6308
  std::string *ptr = (std::string *)0;
@@ -6380,7 +6427,17 @@ _wrap_new_Reporter(int argc, VALUE *argv, VALUE self) {
6380
6427
  arg19 = *ptr;
6381
6428
  if (SWIG_IsNewObj(res)) delete ptr;
6382
6429
  }
6383
- result = (Reporter *)new Reporter(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19);
6430
+ ecode20 = SWIG_AsVal_int(argv[19], &val20);
6431
+ if (!SWIG_IsOK(ecode20)) {
6432
+ SWIG_exception_fail(SWIG_ArgError(ecode20), Ruby_Format_TypeError( "", "int","Reporter", 20, argv[19] ));
6433
+ }
6434
+ arg20 = static_cast< int >(val20);
6435
+ ecode21 = SWIG_AsVal_int(argv[20], &val21);
6436
+ if (!SWIG_IsOK(ecode21)) {
6437
+ SWIG_exception_fail(SWIG_ArgError(ecode21), Ruby_Format_TypeError( "", "int","Reporter", 21, argv[20] ));
6438
+ }
6439
+ arg21 = static_cast< int >(val21);
6440
+ result = (Reporter *)new Reporter(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19,arg20,arg21);
6384
6441
  DATA_PTR(self) = result;
6385
6442
  return self;
6386
6443
  fail:
@@ -6797,6 +6854,7 @@ static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t
6797
6854
  static swig_type_info _swigt__p_long = {"_p_long", "long *", 0, 0, (void*)0, 0};
6798
6855
  static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
6799
6856
  static swig_type_info _swigt__p_oboe_metadata_t = {"_p_oboe_metadata_t", "oboe_metadata_t *", 0, 0, (void*)0, 0};
6857
+ static swig_type_info _swigt__p_oboe_metric_tag_t = {"_p_oboe_metric_tag_t", "oboe_metric_tag_t *", 0, 0, (void*)0, 0};
6800
6858
  static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
6801
6859
  static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
6802
6860
  static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)0, 0};
@@ -6820,6 +6878,7 @@ static swig_type_info *swig_type_initial[] = {
6820
6878
  &_swigt__p_long,
6821
6879
  &_swigt__p_long_long,
6822
6880
  &_swigt__p_oboe_metadata_t,
6881
+ &_swigt__p_oboe_metric_tag_t,
6823
6882
  &_swigt__p_short,
6824
6883
  &_swigt__p_signed_char,
6825
6884
  &_swigt__p_std__string,
@@ -6843,6 +6902,7 @@ static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0
6843
6902
  static swig_cast_info _swigc__p_long[] = { {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
6844
6903
  static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
6845
6904
  static swig_cast_info _swigc__p_oboe_metadata_t[] = { {&_swigt__p_Metadata, _p_MetadataTo_p_oboe_metadata_t, 0, 0}, {&_swigt__p_oboe_metadata_t, 0, 0, 0},{0, 0, 0, 0}};
6905
+ static swig_cast_info _swigc__p_oboe_metric_tag_t[] = { {&_swigt__p_oboe_metric_tag_t, 0, 0, 0},{0, 0, 0, 0}};
6846
6906
  static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
6847
6907
  static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
6848
6908
  static swig_cast_info _swigc__p_std__string[] = { {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
@@ -6866,6 +6926,7 @@ static swig_cast_info *swig_cast_initial[] = {
6866
6926
  _swigc__p_long,
6867
6927
  _swigc__p_long_long,
6868
6928
  _swigc__p_oboe_metadata_t,
6929
+ _swigc__p_oboe_metric_tag_t,
6869
6930
  _swigc__p_short,
6870
6931
  _swigc__p_signed_char,
6871
6932
  _swigc__p_std__string,
@@ -7147,6 +7208,7 @@ SWIGEXPORT void Init_oboe_metal(void) {
7147
7208
  rb_define_const(mOboe_metal, "OBOE_MODULE_NGINX", SWIG_From_int(static_cast< int >(OBOE_MODULE_NGINX)));
7148
7209
  rb_define_const(mOboe_metal, "OBOE_MODULE_PHP", SWIG_From_int(static_cast< int >(OBOE_MODULE_PHP)));
7149
7210
  rb_define_const(mOboe_metal, "OBOE_MODULE_DOTNET", SWIG_From_int(static_cast< int >(OBOE_MODULE_DOTNET)));
7211
+ rb_define_const(mOboe_metal, "OBOE_MODULE_RUBY", SWIG_From_int(static_cast< int >(OBOE_MODULE_RUBY)));
7150
7212
 
7151
7213
  SwigClassMetadata.klass = rb_define_class_under(mOboe_metal, "Metadata", rb_cObject);
7152
7214
  SWIG_TypeClientData(SWIGTYPE_p_Metadata, (void *) &SwigClassMetadata);
@@ -7183,6 +7245,7 @@ SWIGEXPORT void Init_oboe_metal(void) {
7183
7245
  rb_define_singleton_method(SwigClassContext.klass, "validateTransformServiceName", VALUEFUNC(_wrap_Context_validateTransformServiceName), -1);
7184
7246
  rb_define_singleton_method(SwigClassContext.klass, "shutdown", VALUEFUNC(_wrap_Context_shutdown), -1);
7185
7247
  rb_define_singleton_method(SwigClassContext.klass, "isReady", VALUEFUNC(_wrap_Context_isReady), -1);
7248
+ rb_define_singleton_method(SwigClassContext.klass, "isLambda", VALUEFUNC(_wrap_Context_isLambda), -1);
7186
7249
  rb_define_singleton_method(SwigClassContext.klass, "createEvent", VALUEFUNC(_wrap_Context_createEvent), -1);
7187
7250
  rb_define_singleton_method(SwigClassContext.klass, "startTrace", VALUEFUNC(_wrap_Context_startTrace), -1);
7188
7251
  SwigClassContext.mark = 0;
@@ -7224,6 +7287,7 @@ SWIGEXPORT void Init_oboe_metal(void) {
7224
7287
  rb_define_alloc_func(SwigClassMetricTags.klass, _wrap_MetricTags_allocate);
7225
7288
  rb_define_method(SwigClassMetricTags.klass, "initialize", VALUEFUNC(_wrap_new_MetricTags), -1);
7226
7289
  rb_define_method(SwigClassMetricTags.klass, "add", VALUEFUNC(_wrap_MetricTags_add), -1);
7290
+ rb_define_method(SwigClassMetricTags.klass, "get", VALUEFUNC(_wrap_MetricTags_get), -1);
7227
7291
  SwigClassMetricTags.mark = 0;
7228
7292
  SwigClassMetricTags.destroy = (void (*)(void *)) free_MetricTags;
7229
7293
  SwigClassMetricTags.trackObjects = 0;