solarwinds_apm 6.0.0.preV1 → 6.0.0.preV3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +28 -54
  3. data/ext/oboe_metal/extconf.rb +23 -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 -2
  9. data/ext/oboe_metal/src/init_solarwinds_apm.cc +0 -6
  10. data/ext/oboe_metal/src/oboe.h +0 -12
  11. data/ext/oboe_metal/src/oboe_swig_wrap.cc +5 -5
  12. data/lib/oboe_metal.rb +3 -3
  13. data/lib/rails/generators/solarwinds_apm/install_generator.rb +0 -3
  14. data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +8 -25
  15. data/lib/solarwinds_apm/api/current_trace_info.rb +1 -2
  16. data/lib/solarwinds_apm/api/opentelemetry.rb +39 -0
  17. data/lib/solarwinds_apm/api/transaction_name.rb +18 -17
  18. data/lib/solarwinds_apm/api.rb +2 -0
  19. data/lib/solarwinds_apm/config.rb +21 -63
  20. data/lib/solarwinds_apm/constants.rb +2 -4
  21. data/lib/solarwinds_apm/noop/context.rb +1 -1
  22. data/lib/solarwinds_apm/oboe_init_options.rb +11 -16
  23. data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +92 -87
  24. data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +27 -23
  25. data/lib/solarwinds_apm/opentelemetry/solarwinds_propagator.rb +28 -28
  26. data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +9 -14
  27. data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +132 -175
  28. data/lib/solarwinds_apm/otel_config.rb +55 -36
  29. data/lib/solarwinds_apm/support/lumberjack_formatter.rb +17 -2
  30. data/lib/solarwinds_apm/support/swomarginalia/comment.rb +2 -2
  31. data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +6 -5
  32. data/lib/solarwinds_apm/support/transaction_cache.rb +27 -2
  33. data/lib/solarwinds_apm/support/transaction_settings.rb +10 -10
  34. data/lib/solarwinds_apm/support/txn_name_manager.rb +34 -17
  35. data/lib/solarwinds_apm/support/utils.rb +24 -0
  36. data/lib/solarwinds_apm/support.rb +4 -2
  37. data/lib/solarwinds_apm/version.rb +1 -1
  38. data/lib/solarwinds_apm.rb +3 -4
  39. metadata +18 -33
  40. data/lib/oboe.rb +0 -7
  41. data/lib/solarwinds_apm/noop/profiling.rb +0 -17
  42. data/lib/solarwinds_apm/support/transformer.rb +0 -56
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78b2c4b54eaff62c93db5c06ebd9e85f73aea61943fa8eb90f0ba157dc81ab01
4
- data.tar.gz: 2133540e0d8ec4ab097cd638d0cfd834649bc4898555ffb9cbfd7fa58a6e2355
3
+ metadata.gz: 6ac8eac87b0a75af0fc92b5f220fd70393a893b1b3291b013d11e5dfa29ee99e
4
+ data.tar.gz: 2fc862e44f562b7d29c85cd7b54fcb490c4ba5c8575f817a4d65d6cf9914479b
5
5
  SHA512:
6
- metadata.gz: 2731e533815670079641e91865a502157162a4924d4c1c0950b50f3e42d7417619305f51a2db22f12ef45ea9111b826d59bcd091f9201b1375afdb06e940421a
7
- data.tar.gz: 6c2053e792310de17c09a58b68e8b74ba100a01c025d703d8cee315b7c3ad7ae6f23da08fe0b5dda2a6328a710330c6ce1468db12703c4d16ce98f1564df5436
6
+ metadata.gz: 3f08999c45b7fe14c224df1af5bd4fc83ba9efd21fb4d6bac5ec36bfe437448ce0622ce8997e9acf47c90010fda716a1f92f35b7336b41fb29ac33ded939abfa
7
+ data.tar.gz: 2e9dc14242b180518bf23d39db3c8f93dde26855fc5a9ee356a7d712ac624e0939adf5390f02770a1bd56d38fa34d9cb91566d7747e073982514e9ae6e09b380
data/LICENSE CHANGED
@@ -1,17 +1,18 @@
1
- Apache License
1
+
2
+ Apache License
2
3
  Version 2.0, January 2004
3
4
  http://www.apache.org/licenses/
4
-
5
+
5
6
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
+
7
8
  1. Definitions.
8
-
9
+
9
10
  "License" shall mean the terms and conditions for use, reproduction,
10
11
  and distribution as defined by Sections 1 through 9 of this document.
11
-
12
+
12
13
  "Licensor" shall mean the copyright owner or entity authorized by
13
14
  the copyright owner that is granting the License.
14
-
15
+
15
16
  "Legal Entity" shall mean the union of the acting entity and all
16
17
  other entities that control, are controlled by, or are under common
17
18
  control with that entity. For the purposes of this definition,
@@ -19,24 +20,24 @@
19
20
  direction or management of such entity, whether by contract or
20
21
  otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
22
  outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
+
23
24
  "You" (or "Your") shall mean an individual or Legal Entity
24
25
  exercising permissions granted by this License.
25
-
26
+
26
27
  "Source" form shall mean the preferred form for making modifications,
27
28
  including but not limited to software source code, documentation
28
29
  source, and configuration files.
29
-
30
+
30
31
  "Object" form shall mean any form resulting from mechanical
31
32
  transformation or translation of a Source form, including but
32
33
  not limited to compiled object code, generated documentation,
33
34
  and conversions to other media types.
34
-
35
+
35
36
  "Work" shall mean the work of authorship, whether in Source or
36
37
  Object form, made available under the License, as indicated by a
37
38
  copyright notice that is included in or attached to the work
38
39
  (an example is provided in the Appendix below).
39
-
40
+
40
41
  "Derivative Works" shall mean any work, whether in Source or Object
41
42
  form, that is based on (or derived from) the Work and for which the
42
43
  editorial revisions, annotations, elaborations, or other modifications
@@ -44,7 +45,7 @@
44
45
  of this License, Derivative Works shall not include works that remain
45
46
  separable from, or merely link (or bind by name) to the interfaces of,
46
47
  the Work and Derivative Works thereof.
47
-
48
+
48
49
  "Contribution" shall mean any work of authorship, including
49
50
  the original version of the Work and any modifications or additions
50
51
  to that Work or Derivative Works thereof, that is intentionally
@@ -58,18 +59,18 @@
58
59
  Licensor for the purpose of discussing and improving the Work, but
59
60
  excluding communication that is conspicuously marked or otherwise
60
61
  designated in writing by the copyright owner as "Not a Contribution."
61
-
62
+
62
63
  "Contributor" shall mean Licensor and any individual or Legal Entity
63
64
  on behalf of whom a Contribution has been received by Licensor and
64
65
  subsequently incorporated within the Work.
65
-
66
+
66
67
  2. Grant of Copyright License. Subject to the terms and conditions of
67
68
  this License, each Contributor hereby grants to You a perpetual,
68
69
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
70
  copyright license to reproduce, prepare Derivative Works of,
70
71
  publicly display, publicly perform, sublicense, and distribute the
71
72
  Work and such Derivative Works in Source or Object form.
72
-
73
+
73
74
  3. Grant of Patent License. Subject to the terms and conditions of
74
75
  this License, each Contributor hereby grants to You a perpetual,
75
76
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
@@ -85,24 +86,24 @@
85
86
  or contributory patent infringement, then any patent licenses
86
87
  granted to You under this License for that Work shall terminate
87
88
  as of the date such litigation is filed.
88
-
89
+
89
90
  4. Redistribution. You may reproduce and distribute copies of the
90
91
  Work or Derivative Works thereof in any medium, with or without
91
92
  modifications, and in Source or Object form, provided that You
92
93
  meet the following conditions:
93
-
94
+
94
95
  (a) You must give any other recipients of the Work or
95
96
  Derivative Works a copy of this License; and
96
-
97
+
97
98
  (b) You must cause any modified files to carry prominent notices
98
99
  stating that You changed the files; and
99
-
100
+
100
101
  (c) You must retain, in the Source form of any Derivative Works
101
102
  that You distribute, all copyright, patent, trademark, and
102
103
  attribution notices from the Source form of the Work,
103
104
  excluding those notices that do not pertain to any part of
104
105
  the Derivative Works; and
105
-
106
+
106
107
  (d) If the Work includes a "NOTICE" text file as part of its
107
108
  distribution, then any Derivative Works that You distribute must
108
109
  include a readable copy of the attribution notices contained
@@ -119,14 +120,14 @@
119
120
  or as an addendum to the NOTICE text from the Work, provided
120
121
  that such additional attribution notices cannot be construed
121
122
  as modifying the License.
122
-
123
+
123
124
  You may add Your own copyright statement to Your modifications and
124
125
  may provide additional or different license terms and conditions
125
126
  for use, reproduction, or distribution of Your modifications, or
126
127
  for any such Derivative Works as a whole, provided Your use,
127
128
  reproduction, and distribution of the Work otherwise complies with
128
129
  the conditions stated in this License.
129
-
130
+
130
131
  5. Submission of Contributions. Unless You explicitly state otherwise,
131
132
  any Contribution intentionally submitted for inclusion in the Work
132
133
  by You to the Licensor shall be under the terms and conditions of
@@ -134,12 +135,12 @@
134
135
  Notwithstanding the above, nothing herein shall supersede or modify
135
136
  the terms of any separate license agreement you may have executed
136
137
  with Licensor regarding such Contributions.
137
-
138
+
138
139
  6. Trademarks. This License does not grant permission to use the trade
139
140
  names, trademarks, service marks, or product names of the Licensor,
140
141
  except as required for reasonable and customary use in describing the
141
142
  origin of the Work and reproducing the content of the NOTICE file.
142
-
143
+
143
144
  7. Disclaimer of Warranty. Unless required by applicable law or
144
145
  agreed to in writing, Licensor provides the Work (and each
145
146
  Contributor provides its Contributions) on an "AS IS" BASIS,
@@ -149,7 +150,7 @@
149
150
  PARTICULAR PURPOSE. You are solely responsible for determining the
150
151
  appropriateness of using or redistributing the Work and assume any
151
152
  risks associated with Your exercise of permissions under this License.
152
-
153
+
153
154
  8. Limitation of Liability. In no event and under no legal theory,
154
155
  whether in tort (including negligence), contract, or otherwise,
155
156
  unless required by applicable law (such as deliberate and grossly
@@ -161,7 +162,7 @@
161
162
  work stoppage, computer failure or malfunction, or any and all
162
163
  other commercial damages or losses), even if such Contributor
163
164
  has been advised of the possibility of such damages.
164
-
165
+
165
166
  9. Accepting Warranty or Additional Liability. While redistributing
166
167
  the Work or Derivative Works thereof, You may choose to offer,
167
168
  and charge a fee for, acceptance of support, warranty, indemnity,
@@ -171,31 +172,4 @@
171
172
  of any other Contributor, and only if You agree to indemnify,
172
173
  defend, and hold each Contributor harmless for any liability
173
174
  incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
175
+ of your accepting any such warranty or additional liability.
@@ -21,54 +21,54 @@ ext_dir = __dir__
21
21
 
22
22
  # Set the mkmf lib paths so we have no issues linking to
23
23
  # the SolarWindsAPM libs.
24
- ao_lib_dir = File.join(ext_dir, 'lib')
25
- ao_include = File.join(ext_dir, 'src')
24
+ swo_lib_dir = File.join(ext_dir, 'lib')
25
+ swo_include = File.join(ext_dir, 'src')
26
26
 
27
27
  # Download the appropriate liboboe from Staging or Production
28
- version = File.read(File.join(ao_include, 'VERSION')).strip
28
+ version = File.read(File.join(swo_include, 'VERSION')).strip
29
29
  if ENV['OBOE_DEV'].to_s.downcase == 'true'
30
- 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"
31
31
  puts 'Fetching c-lib from DEVELOPMENT Build'
32
32
  elsif ENV['OBOE_STAGING'].to_s.downcase == 'true'
33
- 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)
34
34
  puts 'Fetching c-lib from STAGING'
35
35
  else
36
- 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)
37
37
  end
38
38
 
39
- ao_arch = 'x86_64'
39
+ swo_arch = 'x86_64'
40
40
  system_arch = `uname -m` # for mac, the command is `uname` # "Darwin\n"; try `uname -a`
41
41
  case system_arch.gsub("\n","")
42
42
  when 'x86_64'
43
- ao_arch = 'x86_64'
43
+ swo_arch = 'x86_64'
44
44
  when 'aarch64'
45
- ao_arch = 'aarch64'
45
+ swo_arch = 'aarch64'
46
46
  end
47
47
 
48
48
  if File.exist?('/etc/alpine-release')
49
49
  version = File.read('/etc/alpine-release').strip
50
50
 
51
- tmp_ao_arch = ao_arch.clone
52
- ao_arch =
51
+ tmp_swo_arch = swo_arch.clone
52
+ swo_arch =
53
53
  if Gem::Version.new(version) < Gem::Version.new('3.9')
54
- "alpine-libressl-#{tmp_ao_arch}"
54
+ "alpine-libressl-#{tmp_swo_arch}"
55
55
  else # openssl
56
- "alpine-#{tmp_ao_arch}"
56
+ "alpine-#{tmp_swo_arch}"
57
57
  end
58
58
  end
59
59
 
60
- ao_clib = "liboboe-1.0-#{ao_arch}.so"
61
- ao_item = File.join(ao_path, ao_clib)
62
- ao_checksum_file = File.join(ao_lib_dir, "#{ao_clib}.sha256")
63
- 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)
64
64
 
65
65
  retries = 3
66
66
  success = false
67
67
  while retries > 0
68
68
  begin
69
- IO.copy_stream(URI.parse(ao_item).open, clib)
69
+ IO.copy_stream(URI.parse(swo_item).open, clib)
70
70
  clib_checksum = Digest::SHA256.file(clib).hexdigest
71
- checksum = File.read(ao_checksum_file).strip
71
+ checksum = File.read(swo_checksum_file).strip
72
72
 
73
73
  # unfortunately these messages only show if the install command is run
74
74
  # with the `--verbose` flag
@@ -93,7 +93,7 @@ while retries > 0
93
93
  $stderr.puts 'Download of the c-extension for the solarwinds_apm gem failed.'
94
94
  $stderr.puts 'solarwinds_apm will not instrument the code. No tracing will occur.'
95
95
  $stderr.puts 'Contact technicalsupport@solarwinds.com if the problem persists.'
96
- $stderr.puts "error: #{ao_item}\n#{e.message}"
96
+ $stderr.puts "error: #{swo_item}\n#{e.message}"
97
97
  $stderr.puts '==================================================================='
98
98
  create_makefile('oboe_noop', 'noop')
99
99
  end
@@ -103,9 +103,9 @@ end
103
103
 
104
104
  if success
105
105
  # Create relative symlinks for the SolarWindsAPM library
106
- Dir.chdir(ao_lib_dir) do
107
- File.symlink(ao_clib, 'liboboe.so')
108
- 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')
109
109
  end
110
110
 
111
111
  dir_config('oboe', 'src', 'lib')
@@ -1 +1 @@
1
- b931c715d8ddaa9f2b91c72ad708ed3467e6e68ee4255756123b2ca96f1b98d0
1
+ 86a0c98301b157fd2ec184e585d70e40753c721c52fbc596ab09aa3d422d5f1f
@@ -1 +1 @@
1
- c8189fe6f5b31c15c31d3b005aebcff90f97ff82e92d9e0d3b254bbbe2a7367d
1
+ 534122daed4a1a81a9e66828f206662ea8f6bf891fb84438cc3daef5f78a7af4
@@ -1 +1 @@
1
- 2824ba630ba794ff6280358922b54e8e1be4ccdb145376f90601e6652d149525
1
+ 89936e04f0b8cddf3fb94c8a4c21d16aa780d6e4fbf4bb66eba42eb33fe15cc6
@@ -1 +1 @@
1
- 82a003ec82e3703260cdc215ef4c0c0bc7bc916cef27ef509034b60fd5ef9b35
1
+ 623f5b308759754c8d771567d5346c46e1d9b53739995a9b5594cc08f8bc6e54
@@ -1,2 +1 @@
1
- 12.4.0
2
-
1
+ 13.0.0
@@ -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
@@ -432,16 +432,6 @@ int oboe_init_reporter(const char *protocol, oboe_init_options_t *options);
432
432
  */
433
433
  int oboe_init_options_set_defaults(oboe_init_options_t *options);
434
434
 
435
- /**
436
- * Disconnect or shut down the Oboe reporter, but allow it to be reconnect()ed.
437
- */
438
- void oboe_reporter_disconnect(); /* TODO: Need implementation. */
439
-
440
- /**
441
- * Reconnect or restart the Oboe reporter.
442
- */
443
- void oboe_reporter_reconnect(); /* TODO: Need implementation. */
444
-
445
435
  /**
446
436
  * tell reporter to flush all messages that are currently buffered
447
437
  */
@@ -712,8 +702,6 @@ void oboe_settings_rate_set(int sample_rate);
712
702
  void oboe_settings_mode_set(int tracing_mode);
713
703
  void oboe_settings_trigger_set(int trigger_mode);
714
704
 
715
- int oboe_rand_get_value();
716
-
717
705
  /**
718
706
  * Convert a tracing mode to a printable string.
719
707
  */
@@ -1932,7 +1932,7 @@ SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2))
1932
1932
  }
1933
1933
 
1934
1934
 
1935
- /*@SWIG:/usr/local/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1935
+ /*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1936
1936
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE arg)
1937
1937
  {
1938
1938
  VALUE *args = (VALUE *)arg;
@@ -2120,7 +2120,7 @@ SWIG_From_std_string (const std::string& s)
2120
2120
  #define SWIG_From_double rb_float_new
2121
2121
 
2122
2122
 
2123
- /*@SWIG:/usr/local/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2123
+ /*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2124
2124
  SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE arg)
2125
2125
  {
2126
2126
  VALUE *args = (VALUE *)arg;
@@ -2172,7 +2172,7 @@ SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
2172
2172
 
2173
2173
 
2174
2174
  #ifdef SWIG_LONG_LONG_AVAILABLE
2175
- /*@SWIG:/usr/local/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2175
+ /*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2176
2176
  SWIGINTERN VALUE SWIG_AUX_NUM2LL(VALUE arg)
2177
2177
  {
2178
2178
  VALUE *args = (VALUE *)arg;
@@ -2203,7 +2203,7 @@ SWIG_AsVal_long_SS_long (VALUE obj, long long *val)
2203
2203
  #endif
2204
2204
 
2205
2205
 
2206
- /*@SWIG:/usr/local/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2206
+ /*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2207
2207
  SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE arg)
2208
2208
  {
2209
2209
  VALUE *args = (VALUE *)arg;
@@ -2234,7 +2234,7 @@ SWIG_AsVal_double (VALUE obj, double *val)
2234
2234
 
2235
2235
 
2236
2236
  #ifdef SWIG_LONG_LONG_AVAILABLE
2237
- /*@SWIG:/usr/local/share/swig/4.0.2/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2237
+ /*@SWIG:/usr/share/swig4.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2238
2238
  SWIGINTERN VALUE SWIG_AUX_NUM2ULL(VALUE arg)
2239
2239
  {
2240
2240
  VALUE *args = (VALUE *)arg;
data/lib/oboe_metal.rb CHANGED
@@ -97,7 +97,7 @@ module SolarWindsAPM
97
97
  end
98
98
 
99
99
  private
100
-
100
+
101
101
  # Internal: Report that instrumentation for the given layer has been
102
102
  # installed, as well as the version of instrumentation and version of
103
103
  # layer.
@@ -105,7 +105,7 @@ module SolarWindsAPM
105
105
  def report_init(layer=:rack) # :nodoc:
106
106
  # Don't send __Init in test or if SolarWindsAPM
107
107
  # isn't fully loaded (e.g. missing c-extension)
108
- return if ENV.has_key?('SW_APM_GEM_TEST') || !SolarWindsAPM.loaded
108
+ return unless SolarWindsAPM.loaded
109
109
 
110
110
  platform_info = build_swo_init_report
111
111
  log_init(layer, platform_info)
@@ -148,7 +148,7 @@ module SolarWindsAPM
148
148
  begin
149
149
  platform_info['APM.Version'] = SolarWindsAPM::Version::STRING
150
150
  platform_info['APM.Extension.Version'] = extension_lib_version
151
-
151
+
152
152
  # OTel Resource Attributes (Optional)
153
153
  platform_info['process.executable.path'] = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
154
154
  platform_info['process.executable.name'] = RbConfig::CONFIG['ruby_install_name']
@@ -10,9 +10,6 @@ module SolarWindsAPM
10
10
  @namespace = "solarwinds_apm:install"
11
11
 
12
12
  def copy_initializer
13
- # Set defaults
14
- @verbose = 'false'
15
-
16
13
  print_header
17
14
  print_footer
18
15
 
@@ -69,15 +69,6 @@ if defined?(SolarWindsAPM::Config)
69
69
  # The Ruby logger can afterwards be changed to a different level, e.g:
70
70
  # SolarWindsAPM.logger.level = Logger::INFO
71
71
 
72
- #
73
- # Set SW_APM_GEM_VERBOSE
74
- # This setting will be overridden if SW_APM_GEM_VERBOSE is set as an environment variable
75
- #
76
- # On startup the components that are being instrumented will be reported if this is set to true.
77
- # If true and the log level is 4 or higher this may create extra debug log messages
78
- #
79
- SolarWindsAPM::Config[:verbose] = false
80
-
81
72
  #
82
73
  # Turn Tracing on or off
83
74
  #
@@ -115,12 +106,8 @@ if defined?(SolarWindsAPM::Config)
115
106
  # disable/enable metrics and traces for certain transactions.
116
107
  #
117
108
  # Currently allowed array of hash
118
- #
119
- # and the hashes within the :url list either:
120
- # :extensions takes an array of strings for filtering (not regular expressions!)
121
- # :tracing defaults to :disabled, can be set to :enabled to override
122
- # the global :disabled setting
123
- # or:
109
+ #
110
+ # and the hashes within the :transaction_settings list:
124
111
  # :regexp is a regular expression that is applied to the incoming path
125
112
  # :opts (optional) nil(default) or Regexp::IGNORECASE (options for regexp)
126
113
  # :tracing defaults to :disabled, can be set to :enabled to override
@@ -130,10 +117,6 @@ if defined?(SolarWindsAPM::Config)
130
117
  # down execution.
131
118
  #
132
119
  SolarWindsAPM::Config[:transaction_settings] = [
133
- # {
134
- # extensions: %w[long_job],
135
- # tracing: :disabled
136
- # },
137
120
  # {
138
121
  # regexp: '^.*\/long_job\/.*$',
139
122
  # opts: Regexp::IGNORECASE,
@@ -156,8 +139,8 @@ if defined?(SolarWindsAPM::Config)
156
139
 
157
140
  #
158
141
  # Trigger Trace Mode
159
- #
160
- # Trace options is a custom HTTP header X-Trace-Options that can be set on a request to carry additional information
142
+ #
143
+ # Trace options is a custom HTTP header X-Trace-Options that can be set on a request to carry additional information
161
144
  # to the agents, one such option being trigger-trace which we’ll call a trigger trace request.
162
145
  #
163
146
  SolarWindsAPM::Config[:trigger_tracing_mode] = 'enabled'
@@ -178,12 +161,12 @@ if defined?(SolarWindsAPM::Config)
178
161
  # Appending trace contenxt (i.e. traceparent) as an sql comment
179
162
  # at the beginning or end of sql. This modified sql will be
180
163
  # sent to sql server for trace correlation.
181
- #
164
+ #
182
165
  # Example:
183
166
  # SELECT `posts`.* FROM `posts` /*traceparent=00-a448f096d441e167d12ebd32a927c1a5-a29655a47e430119-01*/
184
- #
185
- # This option can add a small overhead for prepared statements since the traceparent value is unique per execution.
186
- # This feature uses marginalia, see its caveat and possible workaround
167
+ #
168
+ # This option can add a small overhead for prepared statements since the traceparent value is unique per execution.
169
+ # This feature uses marginalia, see its caveat and possible workaround
187
170
  # https://github.com/basecamp/marginalia/blob/master/README.md#prepared-statements
188
171
  #
189
172
  SolarWindsAPM::Config[:tag_sql] = false
@@ -49,7 +49,7 @@ module SolarWindsAPM
49
49
  class TraceInfo
50
50
  attr_reader :tracestring, :trace_id, :span_id, :trace_flags, :do_log
51
51
 
52
- REGEXP = /^(?<tracestring>(?<version>[a-f0-9]{2})-(?<trace_id>[a-f0-9]{32})-(?<span_id>[a-f0-9]{16})-(?<flags>[a-f0-9]{2}))$/.freeze
52
+ REGEXP = /^(?<tracestring>(?<version>[a-f0-9]{2})-(?<trace_id>[a-f0-9]{32})-(?<span_id>[a-f0-9]{16})-(?<flags>[a-f0-9]{2}))$/
53
53
  private_constant :REGEXP
54
54
 
55
55
  def initialize
@@ -108,7 +108,6 @@ module SolarWindsAPM
108
108
  span_id = span.context.hex_span_id
109
109
  trace_flags = span.context.trace_flags.sampled?? '01' : '00'
110
110
  tracestring = "00-#{trace_id}-#{span_id}-#{trace_flags}"
111
-
112
111
  [trace_id, span_id, trace_flags, tracestring]
113
112
  end
114
113
 
@@ -0,0 +1,39 @@
1
+ module SolarWindsAPM
2
+ module API
3
+ module OpenTelemetry
4
+ # Create custom span based on current last span
5
+ #
6
+ # Wrap OpenTelemetry function OpenTelemetry.tracer_provider.tracer.in_span
7
+ #
8
+ # === Argument:
9
+ #
10
+ # * +name+ - (int, default 3000) the maximum time to wait in milliseconds
11
+ # * +attributes+ - (hash, default nil)
12
+ # * +links+ - (string, default nil)
13
+ # * +start_timestamp+ - (int, default nil)
14
+ # * +kind+ - (symbol, default nil)
15
+ #
16
+ # === Example:
17
+ #
18
+ # SolarWindsAPM::API.in_span('custom_span') do |span|
19
+ # url = URI.parse("http://www.google.ca/")
20
+ # req = Net::HTTP::Get.new(url.to_s)
21
+ # res = Net::HTTP.start(url.host, url.port) {|http| http.request(req)}
22
+ # end
23
+ #
24
+ # === Returns:
25
+ # * Objective
26
+ #
27
+ def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, &block)
28
+ if block.nil?
29
+ SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] please provide block when using in_span function"}
30
+ return
31
+ end
32
+
33
+ SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] solarwinds_apm in_span with OTEL_SERVICE_NAME #{ENV['OTEL_SERVICE_NAME']}"}
34
+ current_tracer = ::OpenTelemetry.tracer_provider.tracer(ENV['OTEL_SERVICE_NAME'])
35
+ current_tracer.in_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind, &block)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -31,26 +31,27 @@ module SolarWindsAPM
31
31
  #
32
32
  def set_transaction_name(custom_name=nil)
33
33
 
34
- return false if custom_name.nil? || custom_name.empty?
34
+ status = true
35
+ if custom_name.nil? || custom_name.empty?
36
+ status = false
37
+ elsif SolarWindsAPM::Context.toString == '99-00000000000000000000000000000000-0000000000000000-00' # noop
38
+ status = true
39
+ elsif SolarWindsAPM::OTelConfig.class_variable_get(:@@config)[:span_processor].nil?
40
+ SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Solarwinds processor is missing. Set transaction name failed."}
41
+ status = false
42
+ else
43
+ solarwinds_processor = SolarWindsAPM::OTelConfig.class_variable_get(:@@config)[:span_processor]
44
+ current_span = ::OpenTelemetry::Trace.current_span
45
+ entry_trace_id = current_span.context.hex_trace_id
46
+ entry_span_id, trace_flags = solarwinds_processor.txn_manager.get_root_context_h(entry_trace_id)&.split('-')
35
47
 
36
- solarwinds_processor = SolarWindsAPM::OTelConfig.class_variable_get(:@@config)[:span_processor]
37
- if solarwinds_processor.nil?
38
- SolarWindsAPM.logger.warn {"[#{self.name}/#{__method__}] Solarwinds processor is missing. Set transaction name failed."}
39
- return false
40
- end
41
-
42
- entry_trace_id = ::OpenTelemetry::Baggage.value(::SolarWindsAPM::Constants::INTL_SWO_CURRENT_TRACE_ID)
43
- entry_span_id = ::OpenTelemetry::Baggage.value(::SolarWindsAPM::Constants::INTL_SWO_CURRENT_SPAN_ID)
48
+ status = false if entry_trace_id.nil? || entry_span_id.nil? || trace_flags.nil?
49
+ status = false if entry_trace_id == '0'*32 || entry_span_id == '0'*16 || trace_flags == '00' # not sampled
44
50
 
45
- if entry_trace_id.nil? || entry_span_id.nil?
46
- SolarWindsAPM.logger.warn {"[#{self.name}/#{__method__}] Cannot cache custom transaction name #{custom_name} because OTel service entry span not started; ignoring"}
47
- return false
51
+ solarwinds_processor.txn_manager.set("#{entry_trace_id}-#{entry_span_id}",custom_name)
52
+ SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] Cached custom transaction name for #{entry_trace_id}-#{entry_span_id} as #{custom_name}"}
48
53
  end
49
-
50
- trace_span_id = "#{entry_trace_id}-#{entry_span_id}"
51
- solarwinds_processor.txn_manager.set(trace_span_id,custom_name)
52
- SolarWindsAPM.logger.debug {"[#{self.name}/#{__method__}] Cached custom transaction name for #{trace_span_id} as #{custom_name}"}
53
- true
54
+ status
54
55
  end
55
56
  end
56
57
  end
@@ -4,11 +4,13 @@
4
4
  require_relative './api/transaction_name'
5
5
  require_relative './api/current_trace_info'
6
6
  require_relative './api/tracing'
7
+ require_relative './api/opentelemetry'
7
8
 
8
9
  module SolarWindsAPM
9
10
  module API
10
11
  extend SolarWindsAPM::API::TransactionName
11
12
  extend SolarWindsAPM::API::CurrentTraceInfo
12
13
  extend SolarWindsAPM::API::Tracing
14
+ extend SolarWindsAPM::API::OpenTelemetry
13
15
  end
14
16
  end