solarwinds_apm 5.1.9 → 6.0.0.preV2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +28 -55
  3. data/ext/oboe_metal/extconf.rb +37 -41
  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/init_solarwinds_apm.cc +0 -6
  10. data/ext/oboe_metal/src/oboe_debug.h +1 -0
  11. data/lib/oboe_metal.rb +116 -80
  12. data/lib/rails/generators/solarwinds_apm/install_generator.rb +1 -5
  13. data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +42 -267
  14. data/lib/solarwinds_apm/api/current_trace_info.rb +148 -0
  15. data/lib/solarwinds_apm/api/tracing.rb +30 -0
  16. data/lib/solarwinds_apm/api/transaction_name.rb +58 -0
  17. data/lib/solarwinds_apm/api.rb +8 -15
  18. data/lib/solarwinds_apm/base.rb +4 -131
  19. data/lib/solarwinds_apm/config.rb +101 -174
  20. data/lib/solarwinds_apm/constants.rb +32 -0
  21. data/lib/solarwinds_apm/logger.rb +1 -1
  22. data/lib/solarwinds_apm/noop/context.rb +2 -5
  23. data/lib/solarwinds_apm/noop/metadata.rb +1 -2
  24. data/lib/solarwinds_apm/oboe_init_options.rb +74 -38
  25. data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +204 -0
  26. data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +166 -0
  27. data/lib/solarwinds_apm/opentelemetry/solarwinds_propagator.rb +92 -0
  28. data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +72 -0
  29. data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +335 -0
  30. data/lib/solarwinds_apm/opentelemetry.rb +8 -0
  31. data/lib/solarwinds_apm/otel_config.rb +161 -0
  32. data/lib/solarwinds_apm/{inst → support}/logger_formatter.rb +5 -6
  33. data/lib/solarwinds_apm/{inst → support}/logging_log_event.rb +3 -6
  34. data/lib/solarwinds_apm/{inst → support}/lumberjack_formatter.rb +1 -4
  35. data/lib/solarwinds_apm/support/oboe_tracing_mode.rb +27 -0
  36. data/lib/solarwinds_apm/support/swomarginalia/LICENSE +20 -0
  37. data/lib/solarwinds_apm/support/swomarginalia/README.md +41 -0
  38. data/lib/solarwinds_apm/support/swomarginalia/comment.rb +205 -0
  39. data/lib/solarwinds_apm/support/swomarginalia/load_swomarginalia.rb +48 -0
  40. data/lib/solarwinds_apm/support/swomarginalia/railtie.rb +22 -0
  41. data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +86 -0
  42. data/lib/solarwinds_apm/support/transaction_cache.rb +24 -0
  43. data/lib/solarwinds_apm/support/transaction_settings.rb +26 -209
  44. data/lib/solarwinds_apm/support/transformer.rb +56 -0
  45. data/lib/solarwinds_apm/support/txn_name_manager.rb +25 -0
  46. data/lib/solarwinds_apm/support/x_trace_options.rb +42 -26
  47. data/lib/solarwinds_apm/support.rb +37 -10
  48. data/lib/solarwinds_apm/support_report.rb +10 -32
  49. data/lib/solarwinds_apm/thread_local.rb +1 -1
  50. data/lib/solarwinds_apm/version.rb +4 -4
  51. data/lib/solarwinds_apm.rb +29 -25
  52. metadata +63 -123
  53. data/.dockerignore +0 -5
  54. data/.gitignore +0 -58
  55. data/.rubocop.yml +0 -29
  56. data/.whitesource +0 -22
  57. data/.yardopts +0 -7
  58. data/CHANGELOG-appoptics.md +0 -766
  59. data/CHANGELOG.md +0 -82
  60. data/CONFIG.md +0 -31
  61. data/Gemfile +0 -15
  62. data/README.md +0 -385
  63. data/bin/solarwinds_apm_config +0 -15
  64. data/examples/prepend.rb +0 -13
  65. data/examples/sdk_examples.rb +0 -158
  66. data/ext/oboe_metal/README.md +0 -69
  67. data/ext/oboe_metal/extconf_local.rb +0 -75
  68. data/ext/oboe_metal/lib/.keep +0 -0
  69. data/ext/oboe_metal/noop/noop.c +0 -8
  70. data/ext/oboe_metal/src/README.md +0 -6
  71. data/ext/oboe_metal/src/frames.cc +0 -247
  72. data/ext/oboe_metal/src/frames.h +0 -40
  73. data/ext/oboe_metal/src/logging.cc +0 -97
  74. data/ext/oboe_metal/src/logging.h +0 -34
  75. data/ext/oboe_metal/src/profiling.cc +0 -435
  76. data/ext/oboe_metal/src/profiling.h +0 -78
  77. data/ext/oboe_metal/test/CMakeLists.txt +0 -53
  78. data/ext/oboe_metal/test/FindGMock.cmake +0 -43
  79. data/ext/oboe_metal/test/README.md +0 -56
  80. data/ext/oboe_metal/test/frames_test.cc +0 -164
  81. data/ext/oboe_metal/test/profiling_test.cc +0 -93
  82. data/ext/oboe_metal/test/ruby_inc_dir.rb +0 -8
  83. data/ext/oboe_metal/test/ruby_prefix.rb +0 -8
  84. data/ext/oboe_metal/test/ruby_test_helper.rb +0 -67
  85. data/ext/oboe_metal/test/test.h +0 -11
  86. data/ext/oboe_metal/test/test_main.cc +0 -32
  87. data/init.rb +0 -4
  88. data/lib/solarwinds_apm/api/layerinit.rb +0 -41
  89. data/lib/solarwinds_apm/api/logging.rb +0 -356
  90. data/lib/solarwinds_apm/api/memcache.rb +0 -37
  91. data/lib/solarwinds_apm/api/metrics.rb +0 -63
  92. data/lib/solarwinds_apm/api/util.rb +0 -98
  93. data/lib/solarwinds_apm/frameworks/grape.rb +0 -96
  94. data/lib/solarwinds_apm/frameworks/padrino.rb +0 -78
  95. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller.rb +0 -100
  96. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller5.rb +0 -50
  97. data/lib/solarwinds_apm/frameworks/rails/inst/action_controller_api.rb +0 -50
  98. data/lib/solarwinds_apm/frameworks/rails/inst/action_view.rb +0 -88
  99. data/lib/solarwinds_apm/frameworks/rails/inst/active_record.rb +0 -26
  100. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/mysql2.rb +0 -29
  101. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/postgresql.rb +0 -22
  102. data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +0 -103
  103. data/lib/solarwinds_apm/frameworks/rails/inst/logger_formatters.rb +0 -14
  104. data/lib/solarwinds_apm/frameworks/rails.rb +0 -100
  105. data/lib/solarwinds_apm/frameworks/sinatra.rb +0 -96
  106. data/lib/solarwinds_apm/inst/bunny-client.rb +0 -157
  107. data/lib/solarwinds_apm/inst/bunny-consumer.rb +0 -102
  108. data/lib/solarwinds_apm/inst/curb.rb +0 -289
  109. data/lib/solarwinds_apm/inst/dalli.rb +0 -89
  110. data/lib/solarwinds_apm/inst/delayed_job.rb +0 -100
  111. data/lib/solarwinds_apm/inst/excon.rb +0 -113
  112. data/lib/solarwinds_apm/inst/faraday.rb +0 -96
  113. data/lib/solarwinds_apm/inst/graphql.rb +0 -206
  114. data/lib/solarwinds_apm/inst/grpc_client.rb +0 -147
  115. data/lib/solarwinds_apm/inst/grpc_server.rb +0 -119
  116. data/lib/solarwinds_apm/inst/httpclient.rb +0 -182
  117. data/lib/solarwinds_apm/inst/memcached.rb +0 -86
  118. data/lib/solarwinds_apm/inst/mongo.rb +0 -246
  119. data/lib/solarwinds_apm/inst/mongo2.rb +0 -225
  120. data/lib/solarwinds_apm/inst/moped.rb +0 -466
  121. data/lib/solarwinds_apm/inst/net_http.rb +0 -60
  122. data/lib/solarwinds_apm/inst/rack.rb +0 -223
  123. data/lib/solarwinds_apm/inst/rack_cache.rb +0 -35
  124. data/lib/solarwinds_apm/inst/redis.rb +0 -280
  125. data/lib/solarwinds_apm/inst/redis_v4.rb +0 -273
  126. data/lib/solarwinds_apm/inst/resque.rb +0 -129
  127. data/lib/solarwinds_apm/inst/rest-client.rb +0 -43
  128. data/lib/solarwinds_apm/inst/sequel.rb +0 -241
  129. data/lib/solarwinds_apm/inst/sidekiq-client.rb +0 -63
  130. data/lib/solarwinds_apm/inst/sidekiq-worker.rb +0 -64
  131. data/lib/solarwinds_apm/inst/typhoeus.rb +0 -90
  132. data/lib/solarwinds_apm/instrumentation.rb +0 -22
  133. data/lib/solarwinds_apm/loading.rb +0 -65
  134. data/lib/solarwinds_apm/noop/profiling.rb +0 -21
  135. data/lib/solarwinds_apm/ruby.rb +0 -35
  136. data/lib/solarwinds_apm/sdk/current_trace_info.rb +0 -123
  137. data/lib/solarwinds_apm/sdk/custom_metrics.rb +0 -94
  138. data/lib/solarwinds_apm/sdk/logging.rb +0 -37
  139. data/lib/solarwinds_apm/sdk/trace_context_headers.rb +0 -69
  140. data/lib/solarwinds_apm/sdk/tracing.rb +0 -432
  141. data/lib/solarwinds_apm/support/profiling.rb +0 -25
  142. data/lib/solarwinds_apm/support/trace_context.rb +0 -53
  143. data/lib/solarwinds_apm/support/trace_state.rb +0 -69
  144. data/lib/solarwinds_apm/support/trace_string.rb +0 -89
  145. data/lib/solarwinds_apm/support/transaction_metrics.rb +0 -67
  146. data/lib/solarwinds_apm/test.rb +0 -165
  147. data/lib/solarwinds_apm/util.rb +0 -426
  148. data/log/.keep +0 -0
  149. data/log/postgresql/.keep +0 -0
  150. data/solarwinds_apm.gemspec +0 -55
  151. data/yardoc_frontpage.md +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e79b789228d9d0885289c825d1ae712bab1d9450334f6b27fd72e19763b436a
4
- data.tar.gz: 62ec2e7f017cfa2824d269d7db3a3330d9c5c5555424552f8c289f1401caa60d
3
+ metadata.gz: 4f218890396745c5ba75f0819fa07e3717014fe7aa4072136cf62c23bcbadf34
4
+ data.tar.gz: b02cde4d6b896bc60da7fe2c1ab67fd01500a97073d6b67cae497eca70773fa7
5
5
  SHA512:
6
- metadata.gz: 210f5a2c53d302666b12a3afff04481bf3ea094f509b6275aedf5825cdce721d45dcd5dfd170b2c1ab484ef01c9e5bc098235213a066d0cb860caa99c9fbf00b
7
- data.tar.gz: 49280e85e07e7523c67b0bb848d71c9160c01c4861fffcccd526af7be436ca709fb31e9995f5326cf497ceffa1622244fc98ba5bba1c601fcf2e5687a49b7d01
6
+ metadata.gz: f699da24367449958aaff9900c3a0e6ef312917a98df5eda9fd7694a7ccf0f4b27a4f9ff02c3b855d89f2360215b6b0e0b3cfcb541f3b34cc05f7c6de468520f
7
+ data.tar.gz: 65b88f0502aadd4e1e0fda69e39c73350efc100c5a64d226ccd474aa11409af8fd40a5ee1f5735516a2fd7ac5fc20fb16e5f8140c2550029bf8fafdd049d0002
data/LICENSE CHANGED
@@ -1,18 +1,18 @@
1
-
2
- Apache License
1
+
2
+ Apache License
3
3
  Version 2.0, January 2004
4
4
  http://www.apache.org/licenses/
5
-
5
+
6
6
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
7
+
8
8
  1. Definitions.
9
-
9
+
10
10
  "License" shall mean the terms and conditions for use, reproduction,
11
11
  and distribution as defined by Sections 1 through 9 of this document.
12
-
12
+
13
13
  "Licensor" shall mean the copyright owner or entity authorized by
14
14
  the copyright owner that is granting the License.
15
-
15
+
16
16
  "Legal Entity" shall mean the union of the acting entity and all
17
17
  other entities that control, are controlled by, or are under common
18
18
  control with that entity. For the purposes of this definition,
@@ -20,24 +20,24 @@
20
20
  direction or management of such entity, whether by contract or
21
21
  otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
22
  outstanding shares, or (iii) beneficial ownership of such entity.
23
-
23
+
24
24
  "You" (or "Your") shall mean an individual or Legal Entity
25
25
  exercising permissions granted by this License.
26
-
26
+
27
27
  "Source" form shall mean the preferred form for making modifications,
28
28
  including but not limited to software source code, documentation
29
29
  source, and configuration files.
30
-
30
+
31
31
  "Object" form shall mean any form resulting from mechanical
32
32
  transformation or translation of a Source form, including but
33
33
  not limited to compiled object code, generated documentation,
34
34
  and conversions to other media types.
35
-
35
+
36
36
  "Work" shall mean the work of authorship, whether in Source or
37
37
  Object form, made available under the License, as indicated by a
38
38
  copyright notice that is included in or attached to the work
39
39
  (an example is provided in the Appendix below).
40
-
40
+
41
41
  "Derivative Works" shall mean any work, whether in Source or Object
42
42
  form, that is based on (or derived from) the Work and for which the
43
43
  editorial revisions, annotations, elaborations, or other modifications
@@ -45,7 +45,7 @@
45
45
  of this License, Derivative Works shall not include works that remain
46
46
  separable from, or merely link (or bind by name) to the interfaces of,
47
47
  the Work and Derivative Works thereof.
48
-
48
+
49
49
  "Contribution" shall mean any work of authorship, including
50
50
  the original version of the Work and any modifications or additions
51
51
  to that Work or Derivative Works thereof, that is intentionally
@@ -59,18 +59,18 @@
59
59
  Licensor for the purpose of discussing and improving the Work, but
60
60
  excluding communication that is conspicuously marked or otherwise
61
61
  designated in writing by the copyright owner as "Not a Contribution."
62
-
62
+
63
63
  "Contributor" shall mean Licensor and any individual or Legal Entity
64
64
  on behalf of whom a Contribution has been received by Licensor and
65
65
  subsequently incorporated within the Work.
66
-
66
+
67
67
  2. Grant of Copyright License. Subject to the terms and conditions of
68
68
  this License, each Contributor hereby grants to You a perpetual,
69
69
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
70
  copyright license to reproduce, prepare Derivative Works of,
71
71
  publicly display, publicly perform, sublicense, and distribute the
72
72
  Work and such Derivative Works in Source or Object form.
73
-
73
+
74
74
  3. Grant of Patent License. Subject to the terms and conditions of
75
75
  this License, each Contributor hereby grants to You a perpetual,
76
76
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
@@ -86,24 +86,24 @@
86
86
  or contributory patent infringement, then any patent licenses
87
87
  granted to You under this License for that Work shall terminate
88
88
  as of the date such litigation is filed.
89
-
89
+
90
90
  4. Redistribution. You may reproduce and distribute copies of the
91
91
  Work or Derivative Works thereof in any medium, with or without
92
92
  modifications, and in Source or Object form, provided that You
93
93
  meet the following conditions:
94
-
94
+
95
95
  (a) You must give any other recipients of the Work or
96
96
  Derivative Works a copy of this License; and
97
-
97
+
98
98
  (b) You must cause any modified files to carry prominent notices
99
99
  stating that You changed the files; and
100
-
100
+
101
101
  (c) You must retain, in the Source form of any Derivative Works
102
102
  that You distribute, all copyright, patent, trademark, and
103
103
  attribution notices from the Source form of the Work,
104
104
  excluding those notices that do not pertain to any part of
105
105
  the Derivative Works; and
106
-
106
+
107
107
  (d) If the Work includes a "NOTICE" text file as part of its
108
108
  distribution, then any Derivative Works that You distribute must
109
109
  include a readable copy of the attribution notices contained
@@ -120,14 +120,14 @@
120
120
  or as an addendum to the NOTICE text from the Work, provided
121
121
  that such additional attribution notices cannot be construed
122
122
  as modifying the License.
123
-
123
+
124
124
  You may add Your own copyright statement to Your modifications and
125
125
  may provide additional or different license terms and conditions
126
126
  for use, reproduction, or distribution of Your modifications, or
127
127
  for any such Derivative Works as a whole, provided Your use,
128
128
  reproduction, and distribution of the Work otherwise complies with
129
129
  the conditions stated in this License.
130
-
130
+
131
131
  5. Submission of Contributions. Unless You explicitly state otherwise,
132
132
  any Contribution intentionally submitted for inclusion in the Work
133
133
  by You to the Licensor shall be under the terms and conditions of
@@ -135,12 +135,12 @@
135
135
  Notwithstanding the above, nothing herein shall supersede or modify
136
136
  the terms of any separate license agreement you may have executed
137
137
  with Licensor regarding such Contributions.
138
-
138
+
139
139
  6. Trademarks. This License does not grant permission to use the trade
140
140
  names, trademarks, service marks, or product names of the Licensor,
141
141
  except as required for reasonable and customary use in describing the
142
142
  origin of the Work and reproducing the content of the NOTICE file.
143
-
143
+
144
144
  7. Disclaimer of Warranty. Unless required by applicable law or
145
145
  agreed to in writing, Licensor provides the Work (and each
146
146
  Contributor provides its Contributions) on an "AS IS" BASIS,
@@ -150,7 +150,7 @@
150
150
  PARTICULAR PURPOSE. You are solely responsible for determining the
151
151
  appropriateness of using or redistributing the Work and assume any
152
152
  risks associated with Your exercise of permissions under this License.
153
-
153
+
154
154
  8. Limitation of Liability. In no event and under no legal theory,
155
155
  whether in tort (including negligence), contract, or otherwise,
156
156
  unless required by applicable law (such as deliberate and grossly
@@ -162,7 +162,7 @@
162
162
  work stoppage, computer failure or malfunction, or any and all
163
163
  other commercial damages or losses), even if such Contributor
164
164
  has been advised of the possibility of such damages.
165
-
165
+
166
166
  9. Accepting Warranty or Additional Liability. While redistributing
167
167
  the Work or Derivative Works thereof, You may choose to offer,
168
168
  and charge a fee for, acceptance of support, warranty, indemnity,
@@ -172,31 +172,4 @@
172
172
  of any other Contributor, and only if You agree to indemnify,
173
173
  defend, and hold each Contributor harmless for any liability
174
174
  incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
175
+ of your accepting any such warranty or additional liability.
@@ -6,73 +6,69 @@
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.
25
- ao_lib_dir = File.join(ext_dir, 'lib')
26
- ao_include = File.join(ext_dir, 'src')
24
+ swo_lib_dir = File.join(ext_dir, 'lib')
25
+ swo_include = File.join(ext_dir, 'src')
27
26
 
28
27
  # Download the appropriate liboboe from Staging or Production
29
- version = File.read(File.join(ao_include, 'VERSION')).strip
28
+ version = File.read(File.join(swo_include, 'VERSION')).strip
30
29
  if ENV['OBOE_DEV'].to_s.downcase == 'true'
31
- ao_path = "https://solarwinds-apm-staging.s3.us-west-2.amazonaws.com/apm/c-lib/nightly"
30
+ swo_path = "https://solarwinds-apm-staging.s3.us-west-2.amazonaws.com/apm/c-lib/nightly"
32
31
  puts 'Fetching c-lib from DEVELOPMENT Build'
33
32
  elsif ENV['OBOE_STAGING'].to_s.downcase == 'true'
34
- ao_path = File.join('https://agent-binaries.global.st-ssp.solarwinds.com/apm/c-lib/', version)
33
+ swo_path = File.join('https://agent-binaries.global.st-ssp.solarwinds.com/apm/c-lib/', version)
35
34
  puts 'Fetching c-lib from STAGING'
36
35
  else
37
- ao_path = File.join('https://agent-binaries.cloud.solarwinds.com/apm/c-lib/', version)
36
+ swo_path = File.join('https://agent-binaries.cloud.solarwinds.com/apm/c-lib/', version)
38
37
  end
39
38
 
40
- ao_arch = "x86_64"
39
+ swo_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
+ swo_arch = 'x86_64'
44
+ when 'aarch64'
45
+ swo_arch = 'aarch64'
47
46
  end
48
47
 
49
48
  if File.exist?('/etc/alpine-release')
50
49
  version = File.read('/etc/alpine-release').strip
51
50
 
52
- tmp_ao_arch = ao_arch.clone
53
- ao_arch =
51
+ tmp_swo_arch = swo_arch.clone
52
+ swo_arch =
54
53
  if Gem::Version.new(version) < Gem::Version.new('3.9')
55
- "alpine-libressl-#{tmp_ao_arch}"
54
+ "alpine-libressl-#{tmp_swo_arch}"
56
55
  else # openssl
57
- "alpine-#{tmp_ao_arch}"
56
+ "alpine-#{tmp_swo_arch}"
58
57
  end
59
58
  end
60
59
 
61
- ao_clib = "liboboe-1.0-#{ao_arch}.so"
62
- ao_item = File.join(ao_path, ao_clib)
63
- ao_checksum_file = File.join(ao_lib_dir, "#{ao_clib}.sha256")
64
- clib = File.join(ao_lib_dir, ao_clib)
60
+ swo_clib = "liboboe-1.0-#{swo_arch}.so"
61
+ swo_item = File.join(swo_path, swo_clib)
62
+ swo_checksum_file = File.join(swo_lib_dir, "#{swo_clib}.sha256")
63
+ clib = File.join(swo_lib_dir, swo_clib)
65
64
 
66
65
  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(swo_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(swo_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
@@ -97,7 +93,7 @@ while retries > 0
97
93
  $stderr.puts 'Download of the c-extension for the solarwinds_apm gem failed.'
98
94
  $stderr.puts 'solarwinds_apm will not instrument the code. No tracing will occur.'
99
95
  $stderr.puts 'Contact technicalsupport@solarwinds.com if the problem persists.'
100
- $stderr.puts "error: #{ao_item}\n#{e.message}"
96
+ $stderr.puts "error: #{swo_item}\n#{e.message}"
101
97
  $stderr.puts '==================================================================='
102
98
  create_makefile('oboe_noop', 'noop')
103
99
  end
@@ -107,9 +103,9 @@ end
107
103
 
108
104
  if success
109
105
  # Create relative symlinks for the SolarWindsAPM library
110
- Dir.chdir(ao_lib_dir) do
111
- File.symlink(ao_clib, 'liboboe.so')
112
- File.symlink(ao_clib, 'liboboe-1.0.so.0')
106
+ Dir.chdir(swo_lib_dir) do
107
+ File.symlink(swo_clib, 'liboboe.so')
108
+ File.symlink(swo_clib, 'liboboe-1.0.so.0')
113
109
  end
114
110
 
115
111
  dir_config('oboe', 'src', 'lib')
@@ -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
- 5403faf71b2d26bf2a0fd32d159f10b920d5fdafc0aef4b335e5e272d22c1b70
1
+ b931c715d8ddaa9f2b91c72ad708ed3467e6e68ee4255756123b2ca96f1b98d0
@@ -1 +1 @@
1
- 78964dc06204715aa29a8ff47b259984ae476ab72f3d0d983e2ef1c52ef70d6a
1
+ c8189fe6f5b31c15c31d3b005aebcff90f97ff82e92d9e0d3b254bbbe2a7367d
@@ -1 +1 @@
1
- 97c82835d4dbf1130b33a1c75a3c5d9923b1b5c5224e19db9902288c29d128c5
1
+ 2824ba630ba794ff6280358922b54e8e1be4ccdb145376f90601e6652d149525
@@ -1 +1 @@
1
- 6c04a460825bf130caa83433ad0aa01b56f4c5a4ca891df3ffa516db8dc9486a
1
+ 82a003ec82e3703260cdc215ef4c0c0bc7bc916cef27ef509034b60fd5ef9b35
@@ -1,2 +1,2 @@
1
- 12.3.0
1
+ 12.4.0
2
2
 
@@ -9,14 +9,8 @@ extern "C" {
9
9
 
10
10
  void Init_oboe_metal(void);
11
11
 
12
- void Init_profiling(void);
13
-
14
12
  void Init_libsolarwinds_apm() {
15
13
  Init_oboe_metal();
16
-
17
- // * create SolarWindsAPM::CProfiler module for enabling SolarWindsAPM::Profiling
18
- // * see lib/solarwinds_apm/support.rb
19
- // Init_profiling();
20
14
  }
21
15
 
22
16
  #ifdef __cplusplus
@@ -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.
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 unless 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