solarwinds_apm 5.1.8 → 6.0.0.preV1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +0 -1
  3. data/ext/oboe_metal/extconf.rb +19 -23
  4. data/ext/oboe_metal/lib/liboboe-1.0-aarch64.so.sha256 +1 -1
  5. data/ext/oboe_metal/lib/liboboe-1.0-alpine-aarch64.so.sha256 +1 -1
  6. data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.sha256 +1 -1
  7. data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.sha256 +1 -1
  8. data/ext/oboe_metal/src/VERSION +1 -1
  9. data/ext/oboe_metal/src/oboe_api.cpp +9 -7
  10. data/ext/oboe_metal/src/oboe_api.h +7 -7
  11. data/ext/oboe_metal/src/oboe_debug.h +2 -0
  12. data/ext/oboe_metal/src/oboe_swig_wrap.cc +19 -18
  13. data/lib/oboe_metal.rb +116 -80
  14. data/lib/rails/generators/solarwinds_apm/install_generator.rb +1 -2
  15. data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +44 -260
  16. data/lib/solarwinds_apm/api/current_trace_info.rb +148 -0
  17. data/lib/solarwinds_apm/api/tracing.rb +30 -0
  18. data/lib/solarwinds_apm/api/transaction_name.rb +57 -0
  19. data/lib/solarwinds_apm/api.rb +8 -15
  20. data/lib/solarwinds_apm/base.rb +4 -131
  21. data/lib/solarwinds_apm/config.rb +128 -175
  22. data/lib/solarwinds_apm/constants.rb +32 -0
  23. data/lib/solarwinds_apm/logger.rb +1 -1
  24. data/lib/solarwinds_apm/noop/context.rb +2 -5
  25. data/lib/solarwinds_apm/noop/metadata.rb +1 -2
  26. data/lib/solarwinds_apm/noop/profiling.rb +3 -7
  27. data/lib/solarwinds_apm/oboe_init_options.rb +71 -33
  28. data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +204 -0
  29. data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +163 -0
  30. data/lib/solarwinds_apm/opentelemetry/solarwinds_propagator.rb +92 -0
  31. data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +72 -0
  32. data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +330 -0
  33. data/lib/solarwinds_apm/opentelemetry.rb +8 -0
  34. data/lib/solarwinds_apm/otel_config.rb +161 -0
  35. data/lib/solarwinds_apm/{inst → support}/logger_formatter.rb +5 -6
  36. data/lib/solarwinds_apm/{inst → support}/logging_log_event.rb +3 -6
  37. data/lib/solarwinds_apm/{inst → support}/lumberjack_formatter.rb +1 -4
  38. data/lib/solarwinds_apm/support/oboe_tracing_mode.rb +27 -0
  39. data/lib/solarwinds_apm/support/swomarginalia/LICENSE +20 -0
  40. data/lib/solarwinds_apm/support/swomarginalia/README.md +41 -0
  41. data/lib/solarwinds_apm/support/swomarginalia/comment.rb +205 -0
  42. data/lib/solarwinds_apm/support/swomarginalia/load_swomarginalia.rb +48 -0
  43. data/lib/solarwinds_apm/support/swomarginalia/railtie.rb +22 -0
  44. data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +86 -0
  45. data/lib/solarwinds_apm/support/transaction_cache.rb +24 -0
  46. data/lib/solarwinds_apm/support/transaction_settings.rb +26 -209
  47. data/lib/solarwinds_apm/support/transformer.rb +56 -0
  48. data/lib/solarwinds_apm/support/txn_name_manager.rb +25 -0
  49. data/lib/solarwinds_apm/support/x_trace_options.rb +42 -26
  50. data/lib/solarwinds_apm/support.rb +33 -10
  51. data/lib/solarwinds_apm/support_report.rb +10 -32
  52. data/lib/solarwinds_apm/thread_local.rb +1 -1
  53. data/lib/solarwinds_apm/version.rb +4 -4
  54. data/lib/solarwinds_apm.rb +31 -26
  55. metadata +76 -121
  56. data/.dockerignore +0 -5
  57. data/.gitignore +0 -58
  58. data/.rubocop.yml +0 -29
  59. data/.whitesource +0 -22
  60. data/.yardopts +0 -7
  61. data/CHANGELOG-appoptics.md +0 -766
  62. data/CHANGELOG.md +0 -72
  63. data/CONFIG.md +0 -31
  64. data/Gemfile +0 -15
  65. data/README.md +0 -385
  66. data/bin/solarwinds_apm_config +0 -15
  67. data/examples/prepend.rb +0 -13
  68. data/examples/sdk_examples.rb +0 -158
  69. data/ext/oboe_metal/README.md +0 -69
  70. data/ext/oboe_metal/extconf_local.rb +0 -75
  71. data/ext/oboe_metal/lib/.keep +0 -0
  72. data/ext/oboe_metal/noop/noop.c +0 -8
  73. data/ext/oboe_metal/src/README.md +0 -6
  74. data/ext/oboe_metal/src/frames.cc +0 -247
  75. data/ext/oboe_metal/src/frames.h +0 -40
  76. data/ext/oboe_metal/src/logging.cc +0 -97
  77. data/ext/oboe_metal/src/logging.h +0 -34
  78. data/ext/oboe_metal/src/profiling.cc +0 -435
  79. data/ext/oboe_metal/src/profiling.h +0 -78
  80. data/ext/oboe_metal/test/CMakeLists.txt +0 -53
  81. data/ext/oboe_metal/test/FindGMock.cmake +0 -43
  82. data/ext/oboe_metal/test/README.md +0 -56
  83. data/ext/oboe_metal/test/frames_test.cc +0 -164
  84. data/ext/oboe_metal/test/profiling_test.cc +0 -93
  85. data/ext/oboe_metal/test/ruby_inc_dir.rb +0 -8
  86. data/ext/oboe_metal/test/ruby_prefix.rb +0 -8
  87. data/ext/oboe_metal/test/ruby_test_helper.rb +0 -67
  88. data/ext/oboe_metal/test/test.h +0 -11
  89. data/ext/oboe_metal/test/test_main.cc +0 -32
  90. data/init.rb +0 -4
  91. data/lib/solarwinds_apm/api/layerinit.rb +0 -41
  92. data/lib/solarwinds_apm/api/logging.rb +0 -356
  93. data/lib/solarwinds_apm/api/memcache.rb +0 -37
  94. data/lib/solarwinds_apm/api/metrics.rb +0 -63
  95. data/lib/solarwinds_apm/api/util.rb +0 -98
  96. data/lib/solarwinds_apm/frameworks/grape.rb +0 -96
  97. data/lib/solarwinds_apm/frameworks/padrino.rb +0 -78
  98. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller.rb +0 -100
  99. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller5.rb +0 -50
  100. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller_api.rb +0 -50
  101. data/lib/solarwinds_apm/frameworks/rails/inst/action_view.rb +0 -88
  102. data/lib/solarwinds_apm/frameworks/rails/inst/active_record.rb +0 -26
  103. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/mysql2.rb +0 -29
  104. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/postgresql.rb +0 -22
  105. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +0 -103
  106. data/lib/solarwinds_apm/frameworks/rails/inst/logger_formatters.rb +0 -14
  107. data/lib/solarwinds_apm/frameworks/rails.rb +0 -100
  108. data/lib/solarwinds_apm/frameworks/sinatra.rb +0 -96
  109. data/lib/solarwinds_apm/inst/bunny-client.rb +0 -157
  110. data/lib/solarwinds_apm/inst/bunny-consumer.rb +0 -102
  111. data/lib/solarwinds_apm/inst/curb.rb +0 -289
  112. data/lib/solarwinds_apm/inst/dalli.rb +0 -89
  113. data/lib/solarwinds_apm/inst/delayed_job.rb +0 -100
  114. data/lib/solarwinds_apm/inst/excon.rb +0 -113
  115. data/lib/solarwinds_apm/inst/faraday.rb +0 -96
  116. data/lib/solarwinds_apm/inst/graphql.rb +0 -206
  117. data/lib/solarwinds_apm/inst/grpc_client.rb +0 -147
  118. data/lib/solarwinds_apm/inst/grpc_server.rb +0 -119
  119. data/lib/solarwinds_apm/inst/httpclient.rb +0 -182
  120. data/lib/solarwinds_apm/inst/memcached.rb +0 -86
  121. data/lib/solarwinds_apm/inst/mongo.rb +0 -246
  122. data/lib/solarwinds_apm/inst/mongo2.rb +0 -225
  123. data/lib/solarwinds_apm/inst/moped.rb +0 -466
  124. data/lib/solarwinds_apm/inst/net_http.rb +0 -60
  125. data/lib/solarwinds_apm/inst/rack.rb +0 -223
  126. data/lib/solarwinds_apm/inst/rack_cache.rb +0 -35
  127. data/lib/solarwinds_apm/inst/redis.rb +0 -280
  128. data/lib/solarwinds_apm/inst/redis_v4.rb +0 -273
  129. data/lib/solarwinds_apm/inst/resque.rb +0 -129
  130. data/lib/solarwinds_apm/inst/rest-client.rb +0 -43
  131. data/lib/solarwinds_apm/inst/sequel.rb +0 -241
  132. data/lib/solarwinds_apm/inst/sidekiq-client.rb +0 -63
  133. data/lib/solarwinds_apm/inst/sidekiq-worker.rb +0 -64
  134. data/lib/solarwinds_apm/inst/typhoeus.rb +0 -90
  135. data/lib/solarwinds_apm/instrumentation.rb +0 -22
  136. data/lib/solarwinds_apm/loading.rb +0 -65
  137. data/lib/solarwinds_apm/ruby.rb +0 -35
  138. data/lib/solarwinds_apm/sdk/current_trace_info.rb +0 -123
  139. data/lib/solarwinds_apm/sdk/custom_metrics.rb +0 -94
  140. data/lib/solarwinds_apm/sdk/logging.rb +0 -37
  141. data/lib/solarwinds_apm/sdk/trace_context_headers.rb +0 -69
  142. data/lib/solarwinds_apm/sdk/tracing.rb +0 -432
  143. data/lib/solarwinds_apm/support/profiling.rb +0 -25
  144. data/lib/solarwinds_apm/support/trace_context.rb +0 -53
  145. data/lib/solarwinds_apm/support/trace_state.rb +0 -69
  146. data/lib/solarwinds_apm/support/trace_string.rb +0 -89
  147. data/lib/solarwinds_apm/support/transaction_metrics.rb +0 -67
  148. data/lib/solarwinds_apm/test.rb +0 -165
  149. data/lib/solarwinds_apm/util.rb +0 -426
  150. data/log/.keep +0 -0
  151. data/log/postgresql/.keep +0 -0
  152. data/solarwinds_apm.gemspec +0 -55
  153. data/yardoc_frontpage.md +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38400d874e2a05decf3eb4e7691ac398dc41176bb904a72a58e38006440cee4f
4
- data.tar.gz: 2ae5f68730f05b225293a983a13583103b1cbe02bbd906d8ad2aa4a7b074622a
3
+ metadata.gz: 78b2c4b54eaff62c93db5c06ebd9e85f73aea61943fa8eb90f0ba157dc81ab01
4
+ data.tar.gz: 2133540e0d8ec4ab097cd638d0cfd834649bc4898555ffb9cbfd7fa58a6e2355
5
5
  SHA512:
6
- metadata.gz: 712b3ce5b8dafdf5b53c0bbec9da080a4f28ea34ed798d227a965c611b09775147f5145572c4200fef7034ca5233c2b06b58d5064ec798a162f8d7d76020d9fa
7
- data.tar.gz: 054b79133ed377c8d47ab9ce79cdd41519c8bb9f4ef8187d397d6893f0ad3a2a6a6329d22e9e6297b44e9c09d6194b6027e4ec3c7a7ff680d1dc4bcac0371ee6
6
+ metadata.gz: 2731e533815670079641e91865a502157162a4924d4c1c0950b50f3e42d7417619305f51a2db22f12ef45ea9111b826d59bcd091f9201b1375afdb06e940421a
7
+ data.tar.gz: 6c2053e792310de17c09a58b68e8b74ba100a01c025d703d8cee315b7c3ad7ae6f23da08fe0b5dda2a6328a710330c6ce1468db12703c4d16ce98f1564df5436
data/LICENSE CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  Apache License
3
2
  Version 2.0, January 2004
4
3
  http://www.apache.org/licenses/
@@ -6,19 +6,18 @@
6
6
  require 'mkmf'
7
7
  require 'rbconfig'
8
8
  require 'open-uri'
9
- require 'no_proxy_fix'
10
9
 
11
10
  CONFIG['warnflags'] = CONFIG['warnflags'].gsub(/-Wdeclaration-after-statement/, '')
12
- .gsub(/-Wimplicit-function-declaration/, '')
13
- .gsub(/-Wimplicit-int/, '')
14
- .gsub(/-Wno-tautological-compare/, '')
15
- .gsub(/-Wno-self-assign/, '')
16
- .gsub(/-Wno-parentheses-equality/, '')
17
- .gsub(/-Wno-constant-logical-operand/, '')
18
- .gsub(/-Wno-cast-function-type/, '')
11
+ .gsub(/-Wimplicit-function-declaration/, '')
12
+ .gsub(/-Wimplicit-int/, '')
13
+ .gsub(/-Wno-tautological-compare/, '')
14
+ .gsub(/-Wno-self-assign/, '')
15
+ .gsub(/-Wno-parentheses-equality/, '')
16
+ .gsub(/-Wno-constant-logical-operand/, '')
17
+ .gsub(/-Wno-cast-function-type/, '')
19
18
  init_mkmf(CONFIG)
20
19
 
21
- ext_dir = File.expand_path(File.dirname(__FILE__))
20
+ ext_dir = __dir__
22
21
 
23
22
  # Set the mkmf lib paths so we have no issues linking to
24
23
  # the SolarWindsAPM libs.
@@ -37,13 +36,13 @@ else
37
36
  ao_path = File.join('https://agent-binaries.cloud.solarwinds.com/apm/c-lib/', version)
38
37
  end
39
38
 
40
- ao_arch = "x86_64"
39
+ ao_arch = 'x86_64'
41
40
  system_arch = `uname -m` # for mac, the command is `uname` # "Darwin\n"; try `uname -a`
42
41
  case system_arch.gsub("\n","")
43
- when "x86_64"
44
- ao_arch = "x86_64"
45
- when "aarch64"
46
- ao_arch = "aarch64"
42
+ when 'x86_64'
43
+ ao_arch = 'x86_64'
44
+ when 'aarch64'
45
+ ao_arch = 'aarch64'
47
46
  end
48
47
 
49
48
  if File.exist?('/etc/alpine-release')
@@ -67,12 +66,9 @@ retries = 3
67
66
  success = false
68
67
  while retries > 0
69
68
  begin
70
- download = URI.open(ao_item, 'rb')
71
- IO.copy_stream(download, clib)
72
-
69
+ IO.copy_stream(URI.parse(ao_item).open, clib)
73
70
  clib_checksum = Digest::SHA256.file(clib).hexdigest
74
- download.close
75
- checksum = File.read(ao_checksum_file).strip
71
+ checksum = File.read(ao_checksum_file).strip
76
72
 
77
73
  # unfortunately these messages only show if the install command is run
78
74
  # with the `--verbose` flag
@@ -89,7 +85,7 @@ while retries > 0
89
85
  success = true
90
86
  retries = 0
91
87
  end
92
- rescue => e
88
+ rescue StandardError => e
93
89
  File.write(clib, '')
94
90
  retries -= 1
95
91
  if retries == 0
@@ -139,15 +135,15 @@ if success
139
135
 
140
136
  create_makefile('libsolarwinds_apm', 'src')
141
137
  else
142
- $stderr.puts '== ERROR ========================================================='
138
+ $stderr.puts '== ERROR ========================================================='
143
139
  if have_library('oboe')
144
140
  $stderr.puts "The c-library either needs to be updated or doesn't match the OS."
145
141
  $stderr.puts 'No tracing will occur.'
146
142
  else
147
143
  $stderr.puts 'Could not find a matching c-library. No tracing will occur.'
148
144
  end
149
- $stderr.puts 'Contact technicalsupport@solarwinds.com if the problem persists.'
150
- $stderr.puts '=================================================================='
145
+ $stderr.puts 'Contact technicalsupport@solarwinds.com if the problem persists.'
146
+ $stderr.puts '=================================================================='
151
147
  create_makefile('oboe_noop', 'noop')
152
148
  end
153
149
  end
@@ -1 +1 @@
1
- 5a62c8d1bd4cb5970a1a2e20b5d6424203a783b6d5ae17bffa90f7c8cac1b49a
1
+ b931c715d8ddaa9f2b91c72ad708ed3467e6e68ee4255756123b2ca96f1b98d0
@@ -1 +1 @@
1
- 0b2d8c81c9180d44206f89e01f76c4f6ae1dc49f289918b8544083afff66086c
1
+ c8189fe6f5b31c15c31d3b005aebcff90f97ff82e92d9e0d3b254bbbe2a7367d
@@ -1 +1 @@
1
- 6443f871141df922693f30a3fbc9772d7af7341539286168e42de51073336daa
1
+ 2824ba630ba794ff6280358922b54e8e1be4ccdb145376f90601e6652d149525
@@ -1 +1 @@
1
- bc83cb241947ad798285fe152dab4f7dd135075a303b128c4d5be7dea0ef9620
1
+ 82a003ec82e3703260cdc215ef4c0c0bc7bc916cef27ef509034b60fd5ef9b35
@@ -1,2 +1,2 @@
1
- 12.2.0
1
+ 12.4.0
2
2
 
@@ -293,27 +293,27 @@ Event *Event::startTrace(const oboe_metadata_t *md) {
293
293
  }
294
294
 
295
295
  // called e.g. from Python e.addInfo("Key", None) & Ruby e.addInfo("Key", nil)
296
- bool Event::addInfo(char *key, void *val) {
296
+ bool Event::addInfo(const char *key, void *val) {
297
297
  // oboe_event_add_info(evt, key, NULL) does nothing
298
298
  (void)key;
299
299
  (void)val;
300
300
  return true;
301
301
  }
302
302
 
303
- bool Event::addInfo(char *key, const std::string& val) {
303
+ bool Event::addInfo(const char *key, const std::string& val) {
304
304
  return oboe_event_add_info(this, key, val.c_str()) == 0;
305
305
  }
306
306
 
307
- bool Event::addInfo(char *key, long val) {
307
+ bool Event::addInfo(const char *key, long val) {
308
308
  int64_t val_ = val;
309
309
  return oboe_event_add_info_int64(this, key, val_) == 0;
310
310
  }
311
311
 
312
- bool Event::addInfo(char *key, double val) {
312
+ bool Event::addInfo(const char *key, double val) {
313
313
  return oboe_event_add_info_double(this, key, val) == 0;
314
314
  }
315
315
 
316
- bool Event::addInfo(char *key, bool val) {
316
+ bool Event::addInfo(const char *key, bool val) {
317
317
  return oboe_event_add_info_bool(this, key, val) == 0;
318
318
  }
319
319
 
@@ -321,7 +321,7 @@ bool Event::addInfo(char *key, bool val) {
321
321
  * this function was added for profiling
322
322
  * to report the timestamps of omitted snapshots
323
323
  */
324
- bool Event::addInfo(char *key, const long *vals, int num) {
324
+ bool Event::addInfo(const char *key, const long *vals, int num) {
325
325
  oboe_bson_append_start_array(&(this->bbuf), key);
326
326
  for (int i = 0; i < num; i++) {
327
327
  oboe_bson_append_long(&(this->bbuf), std::to_string(i).c_str(), (int64_t)vals[i]);
@@ -330,11 +330,12 @@ bool Event::addInfo(char *key, const long *vals, int num) {
330
330
  return true;
331
331
  }
332
332
 
333
+ #ifndef SWIG
333
334
  /*
334
335
  * A profiling specific addInfo function
335
336
  * to add the frames that make up a snapshot
336
337
  */
337
- bool Event::addInfo(char *key, const std::vector<FrameData> &vals) {
338
+ bool Event::addInfo(const char *key, const std::vector<FrameData> &vals) {
338
339
  oboe_bson_append_start_array(&(this->bbuf), key);
339
340
  int i = 0;
340
341
  for (FrameData val : vals) {
@@ -355,6 +356,7 @@ bool Event::addInfo(char *key, const std::vector<FrameData> &vals) {
355
356
  oboe_bson_append_finish_object(&(this->bbuf));
356
357
  return true;
357
358
  }
359
+ #endif
358
360
 
359
361
  bool Event::addEdge(oboe_metadata_t *md) {
360
362
  return oboe_event_add_edge(this, md) == 0;
@@ -315,15 +315,15 @@ class Event : private oboe_event_t {
315
315
  ~Event();
316
316
 
317
317
  // called e.g. from Python e.addInfo("Key", None) & Ruby e.addInfo("Key", nil)
318
- bool addInfo(char *key, void *val);
319
- bool addInfo(char *key, const std::string& val);
320
- bool addInfo(char *key, long val);
321
- bool addInfo(char *key, double val);
322
- bool addInfo(char *key, bool val);
323
- bool addInfo(char *key, const long *vals, int num);
318
+ bool addInfo(const char *key, void *val);
319
+ bool addInfo(const char *key, const std::string& val);
320
+ bool addInfo(const char *key, long val);
321
+ bool addInfo(const char *key, double val);
322
+ bool addInfo(const char *key, bool val);
323
+ bool addInfo(const char *key, const long *vals, int num);
324
324
 
325
325
  #ifndef SWIG // for profiling only used by Ruby gem cpp-code
326
- bool addInfo(char *key, const std::vector<FrameData> &vals);
326
+ bool addInfo(const char *key, const std::vector<FrameData> &vals);
327
327
  #endif
328
328
 
329
329
  bool addEdge(oboe_metadata_t *md);
@@ -6,6 +6,7 @@ extern "C" {
6
6
  #endif
7
7
 
8
8
  #include <stdbool.h>
9
+ #include <stdio.h>
9
10
 
10
11
  /**
11
12
  * Defined diagnostic log detail levels.
@@ -41,6 +42,7 @@ enum OBOE_DEBUG_MODULE {
41
42
  OBOE_MODULE_HOST_ID_SERVICE,
42
43
  OBOE_MODULE_AWS_RESOURCE_PROVIDER,
43
44
  OBOE_MODULE_AZURE_RESOURCE_PROVIDER,
45
+ OBOE_MODULE_UAMSCLIENT_RESOURCE_PROVIDER
44
46
  };
45
47
 
46
48
  /** Compile time debug logging detail level - cannot log more detailed than this. */
@@ -5480,14 +5480,14 @@ _wrap_Event_addInfo__SWIG_0(int argc, VALUE *argv, VALUE self) {
5480
5480
  arg1 = reinterpret_cast< Event * >(argp1);
5481
5481
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
5482
5482
  if (!SWIG_IsOK(res2)) {
5483
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
5483
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","addInfo", 2, argv[0] ));
5484
5484
  }
5485
5485
  arg2 = reinterpret_cast< char * >(buf2);
5486
5486
  res3 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg3), 0, 0);
5487
5487
  if (!SWIG_IsOK(res3)) {
5488
5488
  SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "void *","addInfo", 3, argv[1] ));
5489
5489
  }
5490
- result = (bool)(arg1)->addInfo(arg2,arg3);
5490
+ result = (bool)(arg1)->addInfo((char const *)arg2,arg3);
5491
5491
  vresult = SWIG_From_bool(static_cast< bool >(result));
5492
5492
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
5493
5493
  return vresult;
@@ -5521,7 +5521,7 @@ _wrap_Event_addInfo__SWIG_1(int argc, VALUE *argv, VALUE self) {
5521
5521
  arg1 = reinterpret_cast< Event * >(argp1);
5522
5522
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
5523
5523
  if (!SWIG_IsOK(res2)) {
5524
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
5524
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","addInfo", 2, argv[0] ));
5525
5525
  }
5526
5526
  arg2 = reinterpret_cast< char * >(buf2);
5527
5527
  {
@@ -5535,7 +5535,7 @@ _wrap_Event_addInfo__SWIG_1(int argc, VALUE *argv, VALUE self) {
5535
5535
  }
5536
5536
  arg3 = ptr;
5537
5537
  }
5538
- result = (bool)(arg1)->addInfo(arg2,(std::string const &)*arg3);
5538
+ result = (bool)(arg1)->addInfo((char const *)arg2,(std::string const &)*arg3);
5539
5539
  vresult = SWIG_From_bool(static_cast< bool >(result));
5540
5540
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
5541
5541
  if (SWIG_IsNewObj(res3)) delete arg3;
@@ -5572,7 +5572,7 @@ _wrap_Event_addInfo__SWIG_2(int argc, VALUE *argv, VALUE self) {
5572
5572
  arg1 = reinterpret_cast< Event * >(argp1);
5573
5573
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
5574
5574
  if (!SWIG_IsOK(res2)) {
5575
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
5575
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","addInfo", 2, argv[0] ));
5576
5576
  }
5577
5577
  arg2 = reinterpret_cast< char * >(buf2);
5578
5578
  ecode3 = SWIG_AsVal_long(argv[1], &val3);
@@ -5580,7 +5580,7 @@ _wrap_Event_addInfo__SWIG_2(int argc, VALUE *argv, VALUE self) {
5580
5580
  SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "long","addInfo", 3, argv[1] ));
5581
5581
  }
5582
5582
  arg3 = static_cast< long >(val3);
5583
- result = (bool)(arg1)->addInfo(arg2,arg3);
5583
+ result = (bool)(arg1)->addInfo((char const *)arg2,arg3);
5584
5584
  vresult = SWIG_From_bool(static_cast< bool >(result));
5585
5585
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
5586
5586
  return vresult;
@@ -5615,7 +5615,7 @@ _wrap_Event_addInfo__SWIG_3(int argc, VALUE *argv, VALUE self) {
5615
5615
  arg1 = reinterpret_cast< Event * >(argp1);
5616
5616
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
5617
5617
  if (!SWIG_IsOK(res2)) {
5618
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
5618
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","addInfo", 2, argv[0] ));
5619
5619
  }
5620
5620
  arg2 = reinterpret_cast< char * >(buf2);
5621
5621
  ecode3 = SWIG_AsVal_double(argv[1], &val3);
@@ -5623,7 +5623,7 @@ _wrap_Event_addInfo__SWIG_3(int argc, VALUE *argv, VALUE self) {
5623
5623
  SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "double","addInfo", 3, argv[1] ));
5624
5624
  }
5625
5625
  arg3 = static_cast< double >(val3);
5626
- result = (bool)(arg1)->addInfo(arg2,arg3);
5626
+ result = (bool)(arg1)->addInfo((char const *)arg2,arg3);
5627
5627
  vresult = SWIG_From_bool(static_cast< bool >(result));
5628
5628
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
5629
5629
  return vresult;
@@ -5658,7 +5658,7 @@ _wrap_Event_addInfo__SWIG_4(int argc, VALUE *argv, VALUE self) {
5658
5658
  arg1 = reinterpret_cast< Event * >(argp1);
5659
5659
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
5660
5660
  if (!SWIG_IsOK(res2)) {
5661
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
5661
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","addInfo", 2, argv[0] ));
5662
5662
  }
5663
5663
  arg2 = reinterpret_cast< char * >(buf2);
5664
5664
  ecode3 = SWIG_AsVal_bool(argv[1], &val3);
@@ -5666,7 +5666,7 @@ _wrap_Event_addInfo__SWIG_4(int argc, VALUE *argv, VALUE self) {
5666
5666
  SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","addInfo", 3, argv[1] ));
5667
5667
  }
5668
5668
  arg3 = static_cast< bool >(val3);
5669
- result = (bool)(arg1)->addInfo(arg2,arg3);
5669
+ result = (bool)(arg1)->addInfo((char const *)arg2,arg3);
5670
5670
  vresult = SWIG_From_bool(static_cast< bool >(result));
5671
5671
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
5672
5672
  return vresult;
@@ -5704,7 +5704,7 @@ _wrap_Event_addInfo__SWIG_5(int argc, VALUE *argv, VALUE self) {
5704
5704
  arg1 = reinterpret_cast< Event * >(argp1);
5705
5705
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
5706
5706
  if (!SWIG_IsOK(res2)) {
5707
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","addInfo", 2, argv[0] ));
5707
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","addInfo", 2, argv[0] ));
5708
5708
  }
5709
5709
  arg2 = reinterpret_cast< char * >(buf2);
5710
5710
  res3 = SWIG_ConvertPtr(argv[1], &argp3,SWIGTYPE_p_long, 0 | 0 );
@@ -5717,7 +5717,7 @@ _wrap_Event_addInfo__SWIG_5(int argc, VALUE *argv, VALUE self) {
5717
5717
  SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","addInfo", 4, argv[2] ));
5718
5718
  }
5719
5719
  arg4 = static_cast< int >(val4);
5720
- result = (bool)(arg1)->addInfo(arg2,(long const *)arg3,arg4);
5720
+ result = (bool)(arg1)->addInfo((char const *)arg2,(long const *)arg3,arg4);
5721
5721
  vresult = SWIG_From_bool(static_cast< bool >(result));
5722
5722
  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
5723
5723
  return vresult;
@@ -5857,12 +5857,12 @@ SWIGINTERN VALUE _wrap_Event_addInfo(int nargs, VALUE *args, VALUE self) {
5857
5857
 
5858
5858
  fail:
5859
5859
  Ruby_Format_OverloadedError( argc, 5, "Event.addInfo",
5860
- " bool Event.addInfo(char *key, void *val)\n"
5861
- " bool Event.addInfo(char *key, std::string const &val)\n"
5862
- " bool Event.addInfo(char *key, long val)\n"
5863
- " bool Event.addInfo(char *key, double val)\n"
5864
- " bool Event.addInfo(char *key, bool val)\n"
5865
- " bool Event.addInfo(char *key, long const *vals, int num)\n");
5860
+ " bool Event.addInfo(char const *key, void *val)\n"
5861
+ " bool Event.addInfo(char const *key, std::string const &val)\n"
5862
+ " bool Event.addInfo(char const *key, long val)\n"
5863
+ " bool Event.addInfo(char const *key, double val)\n"
5864
+ " bool Event.addInfo(char const *key, bool val)\n"
5865
+ " bool Event.addInfo(char const *key, long const *vals, int num)\n");
5866
5866
 
5867
5867
  return Qnil;
5868
5868
  }
@@ -8373,6 +8373,7 @@ SWIGEXPORT void Init_oboe_metal(void) {
8373
8373
  rb_define_const(mOboe_metal, "OBOE_MODULE_HOST_ID_SERVICE", SWIG_From_int(static_cast< int >(OBOE_MODULE_HOST_ID_SERVICE)));
8374
8374
  rb_define_const(mOboe_metal, "OBOE_MODULE_AWS_RESOURCE_PROVIDER", SWIG_From_int(static_cast< int >(OBOE_MODULE_AWS_RESOURCE_PROVIDER)));
8375
8375
  rb_define_const(mOboe_metal, "OBOE_MODULE_AZURE_RESOURCE_PROVIDER", SWIG_From_int(static_cast< int >(OBOE_MODULE_AZURE_RESOURCE_PROVIDER)));
8376
+ rb_define_const(mOboe_metal, "OBOE_MODULE_UAMSCLIENT_RESOURCE_PROVIDER", SWIG_From_int(static_cast< int >(OBOE_MODULE_UAMSCLIENT_RESOURCE_PROVIDER)));
8376
8377
  rb_define_const(mOboe_metal, "MAX_DEBUG_MSG_COUNT", SWIG_From_int(static_cast< int >(1)));
8377
8378
  rb_define_module_function(mOboe_metal, "oboe_debug_log_init", VALUEFUNC(_wrap_oboe_debug_log_init), -1);
8378
8379
  rb_define_module_function(mOboe_metal, "oboe_debug_logger", VALUEFUNC(_wrap_oboe_debug_logger), -1);
data/lib/oboe_metal.rb CHANGED
@@ -1,15 +1,13 @@
1
1
  # Copyright (c) 2016 SolarWinds, LLC.
2
2
  # All rights reserved.
3
3
 
4
- require 'thread'
5
-
6
4
  # Disable docs and Camelcase warns since we're implementing
7
5
  # an interface here. See OboeBase for details.
8
- # rubocop:disable Style/Documentation, Naming/MethodName
9
6
  module SolarWindsAPM
10
7
  extend SolarWindsAPMBase
11
8
  include Oboe_metal
12
9
 
10
+ # Reporter that send span data to SWO
13
11
  class Reporter
14
12
  class << self
15
13
  ##
@@ -26,13 +24,8 @@ module SolarWindsAPM
26
24
 
27
25
  SolarWindsAPM.reporter = Oboe_metal::Reporter.new(*options)
28
26
 
29
- # Only report __Init from here if we are not instrumenting a framework.
30
- # Otherwise, frameworks will handle reporting __Init after full initialization
31
- unless defined?(::Rails) || defined?(::Sinatra) || defined?(::Padrino) || defined?(::Grape)
32
- SolarWindsAPM::API.report_init
33
- end
34
-
35
- rescue => e
27
+ report_init
28
+ rescue StandardError=> e
36
29
  $stderr.puts e.message
37
30
  raise
38
31
  end
@@ -44,8 +37,8 @@ module SolarWindsAPM
44
37
  #
45
38
  # Send the report for the given event
46
39
  #
47
- def sendReport(evt)
48
- SolarWindsAPM.reporter.sendReport(evt)
40
+ def send_report(evt, with_system_timestamp: true)
41
+ SolarWindsAPM.reporter.sendReport(evt, with_system_timestamp)
49
42
  end
50
43
 
51
44
  ##
@@ -53,8 +46,8 @@ module SolarWindsAPM
53
46
  #
54
47
  # Send the report for the given event
55
48
  #
56
- def sendStatus(evt, context = nil)
57
- SolarWindsAPM.reporter.sendStatus(evt, context)
49
+ def send_status(evt, context=nil, with_system_timestamp: true)
50
+ SolarWindsAPM.reporter.sendStatus(evt, context, with_system_timestamp)
58
51
  end
59
52
 
60
53
  ##
@@ -67,20 +60,11 @@ module SolarWindsAPM
67
60
  end
68
61
 
69
62
  ##
70
- # hard_clear_all_traces
71
- #
72
- # Truncates the trace output file to zero by deleting the original bson file
73
- #
74
- def hard_clear_all_traces
75
- File.delete(SolarWindsAPM::OboeInitOptions.instance.host) if File.exist?(SolarWindsAPM::OboeInitOptions.instance.host)
76
- end
77
-
78
- ##
79
- # get_all_traces
63
+ # obtain_all_traces
80
64
  #
81
65
  # Retrieves all traces written to the trace file
82
66
  #
83
- def get_all_traces
67
+ def obtain_all_traces
84
68
  io = File.open(SolarWindsAPM::OboeInitOptions.instance.host, 'r')
85
69
  contents = io.readlines(nil)
86
70
  io.close
@@ -106,68 +90,121 @@ module SolarWindsAPM
106
90
  end
107
91
  else
108
92
  bbb = ::BSON::ByteBuffer.new(contents[0])
109
- until bbb.length == 0
110
- traces << Hash.from_bson(bbb)
111
- end
93
+ traces << Hash.from_bson(bbb) until bbb.length == 0
112
94
  end
113
95
 
114
96
  traces
115
97
  end
116
- end
117
- end
118
98
 
119
- module EventUtil
120
- def self.metadataString(evt)
121
- evt.metadataString
99
+ private
100
+
101
+ # Internal: Report that instrumentation for the given layer has been
102
+ # installed, as well as the version of instrumentation and version of
103
+ # layer.
104
+ #
105
+ def report_init(layer=:rack) # :nodoc:
106
+ # Don't send __Init in test or if SolarWindsAPM
107
+ # isn't fully loaded (e.g. missing c-extension)
108
+ return if ENV.has_key?('SW_APM_GEM_TEST') || !SolarWindsAPM.loaded
109
+
110
+ platform_info = build_swo_init_report
111
+ log_init(layer, platform_info)
112
+ end
113
+
114
+ ##
115
+ # :nodoc:
116
+ # Internal: Reports agent init to the collector
117
+ #
118
+ # ==== Arguments
119
+ #
120
+ # * +layer+ - The layer the reported event belongs to
121
+ # * +kvs+ - A hash containing key/value pairs that will be reported along with this event
122
+ def log_init(layer=:rack, kvs={})
123
+ context = SolarWindsAPM::Metadata.makeRandom
124
+ return SolarWindsAPM::Context.toString unless context.isValid
125
+
126
+ event = context.createEvent
127
+ event.addInfo('Layer', layer.to_s)
128
+ event.addInfo('Label', 'single')
129
+ kvs.each do |k, v|
130
+ event.addInfo(k, v.to_s)
131
+ end
132
+
133
+ SolarWindsAPM::Reporter.send_status(event, context, with_system_timestamp: true)
134
+ SolarWindsAPM::Context.toString
135
+ end
136
+
137
+ ##
138
+ # build_swo_init_report
139
+ #
140
+ # Internal: Build a hash of KVs that reports on the status of the
141
+ # running environment for swo only. This is used on stack boot in __Init reporting
142
+ # and for SolarWindsAPM.support_report.
143
+ #
144
+ def build_swo_init_report
145
+
146
+ platform_info = {'__Init' => true}
147
+
148
+ begin
149
+ platform_info['APM.Version'] = SolarWindsAPM::Version::STRING
150
+ platform_info['APM.Extension.Version'] = extension_lib_version
151
+
152
+ # OTel Resource Attributes (Optional)
153
+ platform_info['process.executable.path'] = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
154
+ platform_info['process.executable.name'] = RbConfig::CONFIG['ruby_install_name']
155
+ platform_info['process.command_line'] = $PROGRAM_NAME
156
+ platform_info['process.telemetry.path'] = Gem::Specification.find_by_name('solarwinds_apm')&.full_gem_path
157
+ platform_info['os.type'] = RUBY_PLATFORM
158
+
159
+ platform_info.merge!(report_gem_in_use)
160
+
161
+ # Collect up opentelemetry sdk version (Instrumented Library Versions) (Required)
162
+ begin
163
+ require 'opentelemetry/sdk'
164
+ ::OpenTelemetry::SDK::Resources::Resource.telemetry_sdk.attribute_enumerator.each {|k,v| platform_info[k] = v}
165
+ ::OpenTelemetry::SDK::Resources::Resource.process.attribute_enumerator.each {|k,v| platform_info[k] = v}
166
+ rescue StandardError => e
167
+ SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] Fail to extract telemetry attributes. Error: #{e.message}"}
168
+ end
169
+ rescue StandardError, ScriptError => e
170
+ # Also rescue ScriptError (aka SyntaxError) in case one of the expected
171
+ # version defines don't exist
172
+
173
+ platform_info['Error'] = "Error in build_report: #{e.message}"
174
+
175
+ SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] Error in build_init_report: #{e.message}"}
176
+ SolarWindsAPM.logger.debug {e.backtrace}
177
+ end
178
+ platform_info
179
+ end
180
+
181
+ ##
182
+ # Collect up the loaded gems
183
+ ##
184
+ def report_gem_in_use
185
+ platform_info = {}
186
+ if defined?(Gem) && Gem.respond_to?(:loaded_specs)
187
+ Gem.loaded_specs.each_pair {|k, v| platform_info["Ruby.#{k}.Version"] = v.version.to_s}
188
+ else
189
+ platform_info.merge!(legacy_build_init_report)
190
+ end
191
+ platform_info
192
+ end
193
+
194
+ ##
195
+ # get extension library version by looking at the VERSION file
196
+ # oboe not loaded yet, can't use oboe_api function to read oboe VERSION
197
+ ##
198
+ def extension_lib_version
199
+ gem_location = Gem::Specification.find_by_name('solarwinds_apm')
200
+ clib_version_file = File.join(gem_location&.gem_dir, 'ext', 'oboe_metal', 'src', 'VERSION')
201
+ File.read(clib_version_file).strip
202
+ end
122
203
  end
123
204
  end
124
205
 
125
206
  class << self
126
- # def sample?(opts = {})
127
- # # Return false if no-op mode
128
- # return false unless SolarWindsAPM.loaded
129
- #
130
- # # Assure defaults since SWIG enforces Strings
131
- # xtrace = opts[:xtrace] ? opts[:xtrace].to_s.strip : SW_APM_STR_BLANK
132
- #
133
- # # the first arg has changed to be the service name, blank means to use the default (from the service key)
134
- # rv = SolarWindsAPM::Context.sampleRequest(SW_APM_STR_BLANK, xtrace)
135
- #
136
- # if rv == 0
137
- # SolarWindsAPM.sample_rate = -1
138
- # SolarWindsAPM.sample_source = -1
139
- # false
140
- # else
141
- # # liboboe version > 1.3.1 returning a bit masked integer with SampleRate and
142
- # # source embedded
143
- # SolarWindsAPM.sample_rate = (rv & SAMPLE_RATE_MASK)
144
- # SolarWindsAPM.sample_source = (rv & SAMPLE_SOURCE_MASK) >> 24
145
- # true
146
- # end
147
- # rescue StandardError => e
148
- # SolarWindsAPM.logger.debug "[oboe/error] sample? error: #{e.inspect}"
149
- # false
150
- # end
151
-
152
- # def set_tracing_mode(mode)
153
- # return unless SolarWindsAPM.loaded
154
- #
155
- # value = mode.to_sym
156
- #
157
- # case value
158
- # when :disabled, :never
159
- # SolarWindsAPM::Context.setTracingMode(SW_APM_TRACE_DISABLED)
160
- #
161
- # when :enabled, :always
162
- # SolarWindsAPM::Context.setTracingMode(SW_APM_TRACE_ENABLED)
163
- #
164
- # else
165
- # SolarWindsAPM.logger.fatal "[oboe/error] Invalid tracing mode set: #{mode}"
166
- # SolarWindsAPM::Context.setTracingMode(SW_APM_TRACE_DISABLED)
167
- # end
168
- # end
169
-
170
- def set_sample_rate(rate)
207
+ def sample_rate(rate)
171
208
  return unless SolarWindsAPM.loaded
172
209
 
173
210
  # Update liboboe with the new SampleRate value
@@ -175,7 +212,6 @@ module SolarWindsAPM
175
212
  end
176
213
  end
177
214
  end
178
- # rubocop:enable Style/Documentation
179
215
 
180
216
  SolarWindsAPM.loaded = true
181
- SolarWindsAPM.config_lock = Mutex.new
217
+ # rubocop:enable Style/Documentation
@@ -2,6 +2,7 @@
2
2
  # All rights reserved.
3
3
 
4
4
  module SolarWindsAPM
5
+ # InstallGenerator
5
6
  class InstallGenerator < ::Rails::Generators::Base
6
7
  source_root File.join(File.dirname(__FILE__), 'templates')
7
8
  desc "Copies a SolarWindsAPM gem initializer file to your application."
@@ -20,7 +21,6 @@ module SolarWindsAPM
20
21
 
21
22
  private
22
23
 
23
- # rubocop:disable Metrics/MethodLength
24
24
  def print_header
25
25
  say ""
26
26
  say shell.set_color "Welcome to the SolarWindsAPM Ruby instrumentation setup.", :green, :bold
@@ -34,7 +34,6 @@ module SolarWindsAPM
34
34
  say "More information on instrumenting Ruby applications can be found here:"
35
35
  say "https://documentation.solarwinds.com/en/success_center/observability/default.htm#cshid=config-ruby-agent"
36
36
  end
37
- # rubocop:enable Metrics/MethodLength
38
37
 
39
38
  def print_footer
40
39
  say ""