solarwinds_apm 6.0.0.preV1 → 6.0.0.preV2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +28 -54
- data/ext/oboe_metal/extconf.rb +23 -23
- data/ext/oboe_metal/src/init_solarwinds_apm.cc +0 -6
- data/lib/oboe_metal.rb +3 -3
- data/lib/rails/generators/solarwinds_apm/install_generator.rb +0 -3
- data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +7 -16
- data/lib/solarwinds_apm/api/current_trace_info.rb +1 -1
- data/lib/solarwinds_apm/api/transaction_name.rb +4 -3
- data/lib/solarwinds_apm/config.rb +18 -44
- data/lib/solarwinds_apm/oboe_init_options.rb +10 -12
- data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +9 -6
- data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +12 -7
- data/lib/solarwinds_apm/otel_config.rb +8 -8
- data/lib/solarwinds_apm/support/swomarginalia/comment.rb +2 -2
- data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +1 -1
- data/lib/solarwinds_apm/support/transaction_settings.rb +8 -8
- data/lib/solarwinds_apm/support.rb +5 -1
- data/lib/solarwinds_apm/version.rb +1 -1
- data/lib/solarwinds_apm.rb +1 -2
- metadata +3 -18
- data/lib/solarwinds_apm/noop/profiling.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f218890396745c5ba75f0819fa07e3717014fe7aa4072136cf62c23bcbadf34
|
4
|
+
data.tar.gz: b02cde4d6b896bc60da7fe2c1ab67fd01500a97073d6b67cae497eca70773fa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f699da24367449958aaff9900c3a0e6ef312917a98df5eda9fd7694a7ccf0f4b27a4f9ff02c3b855d89f2360215b6b0e0b3cfcb541f3b34cc05f7c6de468520f
|
7
|
+
data.tar.gz: 65b88f0502aadd4e1e0fda69e39c73350efc100c5a64d226ccd474aa11409af8fd40a5ee1f5735516a2fd7ac5fc20fb16e5f8140c2550029bf8fafdd049d0002
|
data/LICENSE
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
-
|
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.
|
data/ext/oboe_metal/extconf.rb
CHANGED
@@ -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
|
-
|
25
|
-
|
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(
|
28
|
+
version = File.read(File.join(swo_include, 'VERSION')).strip
|
29
29
|
if ENV['OBOE_DEV'].to_s.downcase == 'true'
|
30
|
-
|
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
|
-
|
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
|
-
|
36
|
+
swo_path = File.join('https://agent-binaries.cloud.solarwinds.com/apm/c-lib/', version)
|
37
37
|
end
|
38
38
|
|
39
|
-
|
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
|
-
|
43
|
+
swo_arch = 'x86_64'
|
44
44
|
when 'aarch64'
|
45
|
-
|
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
|
-
|
52
|
-
|
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-#{
|
54
|
+
"alpine-libressl-#{tmp_swo_arch}"
|
55
55
|
else # openssl
|
56
|
-
"alpine-#{
|
56
|
+
"alpine-#{tmp_swo_arch}"
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
clib = File.join(
|
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(
|
69
|
+
IO.copy_stream(URI.parse(swo_item).open, clib)
|
70
70
|
clib_checksum = Digest::SHA256.file(clib).hexdigest
|
71
|
-
checksum = File.read(
|
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: #{
|
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(
|
107
|
-
File.symlink(
|
108
|
-
File.symlink(
|
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')
|
@@ -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
|
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
|
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']
|
@@ -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,7 +106,7 @@ if defined?(SolarWindsAPM::Config)
|
|
115
106
|
# disable/enable metrics and traces for certain transactions.
|
116
107
|
#
|
117
108
|
# Currently allowed array of hash
|
118
|
-
#
|
109
|
+
#
|
119
110
|
# and the hashes within the :url list either:
|
120
111
|
# :extensions takes an array of strings for filtering (not regular expressions!)
|
121
112
|
# :tracing defaults to :disabled, can be set to :enabled to override
|
@@ -156,8 +147,8 @@ if defined?(SolarWindsAPM::Config)
|
|
156
147
|
|
157
148
|
#
|
158
149
|
# 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
|
150
|
+
#
|
151
|
+
# Trace options is a custom HTTP header X-Trace-Options that can be set on a request to carry additional information
|
161
152
|
# to the agents, one such option being trigger-trace which we’ll call a trigger trace request.
|
162
153
|
#
|
163
154
|
SolarWindsAPM::Config[:trigger_tracing_mode] = 'enabled'
|
@@ -178,12 +169,12 @@ if defined?(SolarWindsAPM::Config)
|
|
178
169
|
# Appending trace contenxt (i.e. traceparent) as an sql comment
|
179
170
|
# at the beginning or end of sql. This modified sql will be
|
180
171
|
# sent to sql server for trace correlation.
|
181
|
-
#
|
172
|
+
#
|
182
173
|
# Example:
|
183
174
|
# 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
|
175
|
+
#
|
176
|
+
# This option can add a small overhead for prepared statements since the traceparent value is unique per execution.
|
177
|
+
# This feature uses marginalia, see its caveat and possible workaround
|
187
178
|
# https://github.com/basecamp/marginalia/blob/master/README.md#prepared-statements
|
188
179
|
#
|
189
180
|
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}))
|
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
|
@@ -32,10 +32,11 @@ module SolarWindsAPM
|
|
32
32
|
def set_transaction_name(custom_name=nil)
|
33
33
|
|
34
34
|
return false if custom_name.nil? || custom_name.empty?
|
35
|
+
return true if SolarWindsAPM::Context.toString == '00-00000000000000000000000000000000-0000000000000000-00' # noop
|
35
36
|
|
36
37
|
solarwinds_processor = SolarWindsAPM::OTelConfig.class_variable_get(:@@config)[:span_processor]
|
37
38
|
if solarwinds_processor.nil?
|
38
|
-
SolarWindsAPM.logger.warn {"[#{
|
39
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Solarwinds processor is missing. Set transaction name failed."}
|
39
40
|
return false
|
40
41
|
end
|
41
42
|
|
@@ -43,13 +44,13 @@ module SolarWindsAPM
|
|
43
44
|
entry_span_id = ::OpenTelemetry::Baggage.value(::SolarWindsAPM::Constants::INTL_SWO_CURRENT_SPAN_ID)
|
44
45
|
|
45
46
|
if entry_trace_id.nil? || entry_span_id.nil?
|
46
|
-
SolarWindsAPM.logger.warn {"[#{
|
47
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Cannot cache custom transaction name #{custom_name} because OTel service entry span not started; ignoring"}
|
47
48
|
return false
|
48
49
|
end
|
49
50
|
|
50
51
|
trace_span_id = "#{entry_trace_id}-#{entry_span_id}"
|
51
52
|
solarwinds_processor.txn_manager.set(trace_span_id,custom_name)
|
52
|
-
SolarWindsAPM.logger.debug {"[#{
|
53
|
+
SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] Cached custom transaction name for #{trace_span_id} as #{custom_name}"}
|
53
54
|
true
|
54
55
|
end
|
55
56
|
end
|
@@ -11,13 +11,13 @@ module SolarWindsAPM
|
|
11
11
|
module Config
|
12
12
|
@@config = {}
|
13
13
|
@@instrumentation = [:action_controller, :action_controller_api, :action_view,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
:active_record, :bunnyclient, :bunnyconsumer, :curb,
|
15
|
+
:dalli, :delayed_jobclient, :delayed_jobworker,
|
16
|
+
:excon, :faraday, :graphql, :grpc_client, :grpc_server, :grape,
|
17
|
+
:httpclient, :nethttp, :memcached, :mongo, :moped, :padrino, :rack, :redis,
|
18
|
+
:resqueclient, :resqueworker, :rest_client,
|
19
|
+
:sequel, :sidekiqclient, :sidekiqworker, :sinatra, :typhoeus,
|
20
|
+
:curb, :excon, :faraday, :httpclient, :nethttp, :rest_client, :typhoeus]
|
21
21
|
|
22
22
|
##
|
23
23
|
# load_config_file
|
@@ -47,28 +47,21 @@ module SolarWindsAPM
|
|
47
47
|
config_file = File.join(Dir.pwd, 'solarwinds_apm_config.rb')
|
48
48
|
config_files << config_file if File.exist?(config_file)
|
49
49
|
|
50
|
-
SolarWindsAPM.logger.warn {"[#{
|
50
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Multiple configuration files configured, using the first one listed: #{config_files.join(', ')}"} if config_files.size > 1
|
51
51
|
load(config_files[0]) if config_files.size > 0
|
52
52
|
|
53
53
|
set_log_level # sets SolarWindsAPM::Config[:debug_level], SolarWindsAPM.logger.level
|
54
|
-
set_verbose_level # the verbose setting is only relevant for ruby, ENV['SW_APM_GEM_VERBOSE'] overrides
|
55
54
|
end
|
56
55
|
|
57
56
|
def self.config_from_env
|
58
|
-
config_files = []
|
59
57
|
if File.exist?(ENV['SW_APM_CONFIG_RUBY']) && !File.directory?(ENV['SW_APM_CONFIG_RUBY'])
|
60
|
-
|
58
|
+
config_file = ENV['SW_APM_CONFIG_RUBY']
|
61
59
|
elsif File.exist?(File.join(ENV['SW_APM_CONFIG_RUBY'], 'solarwinds_apm_config.rb'))
|
62
|
-
|
60
|
+
config_file = File.join(ENV['SW_APM_CONFIG_RUBY'], 'solarwinds_apm_config.rb')
|
63
61
|
else
|
64
|
-
SolarWindsAPM.logger.warn {"[#{
|
62
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Could not find the configuration file set by the SW_APM_CONFIG_RUBY environment variable: #{ENV['SW_APM_CONFIG_RUBY']}"}
|
65
63
|
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.set_verbose_level
|
70
|
-
verbose = ENV.has_key?('SW_APM_GEM_VERBOSE')? ENV['SW_APM_GEM_VERBOSE'].downcase == 'true' : nil
|
71
|
-
SolarWindsAPM::Config[:verbose] = verbose
|
64
|
+
config_file
|
72
65
|
end
|
73
66
|
|
74
67
|
def self.set_log_level
|
@@ -86,9 +79,9 @@ module SolarWindsAPM
|
|
86
79
|
# to create an output similar to the content of the config file
|
87
80
|
#
|
88
81
|
def self.print_config
|
89
|
-
SolarWindsAPM.logger.warn {"[#{
|
82
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] General configurations list blow:"}
|
90
83
|
@@config.each do |k,v|
|
91
|
-
SolarWindsAPM.logger.warn {"[#{
|
84
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Config Key/Value: #{k}, #{v.inspect}"}
|
92
85
|
end
|
93
86
|
end
|
94
87
|
|
@@ -99,9 +92,6 @@ module SolarWindsAPM
|
|
99
92
|
# The defaults are read from the template configuration file.
|
100
93
|
#
|
101
94
|
def self.initialize(_data={})
|
102
|
-
@@config[:profiling] = :disabled
|
103
|
-
@@config[:profiling_interval] = 5
|
104
|
-
|
105
95
|
# for config file backward compatibility
|
106
96
|
@@instrumentation.each {|inst| @@config[inst] = {}}
|
107
97
|
@@config[:transaction_name] = {}
|
@@ -137,40 +127,24 @@ module SolarWindsAPM
|
|
137
127
|
|
138
128
|
case key
|
139
129
|
when :sampling_rate
|
140
|
-
SolarWindsAPM.logger.warn {"[#{
|
130
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] sampling_rate is not a supported setting for SolarWindsAPM::Config. Please use :sample_rate."}
|
141
131
|
|
142
132
|
when :sample_rate
|
143
133
|
unless value.is_a?(Integer) || value.is_a?(Float)
|
144
|
-
SolarWindsAPM.logger.warn {"[#{
|
134
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] :sample_rate must be a number between 0 and 1000000 (1m) (provided: #{value}), corrected to 0"}
|
145
135
|
value = 0
|
146
136
|
end
|
147
137
|
|
148
138
|
# Validate :sample_rate value
|
149
139
|
unless value.between?(0, 1e6)
|
150
140
|
new_value = value < 0 ? 0 : 1_000_000
|
151
|
-
SolarWindsAPM.logger.warn {"[#{
|
141
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] :sample_rate must be between 0 and 1000000 (1m) (provided: #{value}), corrected to #{new_value}"}
|
152
142
|
end
|
153
143
|
|
154
144
|
# Assure value is an integer
|
155
145
|
@@config[key.to_sym] = new_value.to_i
|
156
146
|
SolarWindsAPM.sample_rate(new_value) if SolarWindsAPM.loaded
|
157
147
|
|
158
|
-
when :profiling
|
159
|
-
SolarWindsAPM.logger.warn {"[#{self.name}/#{__method__}] Profiling feature is currently not available." }
|
160
|
-
@@config[:profiling] = :disabled
|
161
|
-
|
162
|
-
when :profiling_interval
|
163
|
-
SolarWindsAPM.logger.warn {"[#{self.name}/#{__method__}] Profiling feature is currently not available. :profiling_interval setting is not configured."}
|
164
|
-
value = if value.is_a?(Integer) && value > 0
|
165
|
-
[100, value].min
|
166
|
-
else
|
167
|
-
10
|
168
|
-
end
|
169
|
-
@@config[:profiling_interval] = value
|
170
|
-
# CProfiler may not be loaded yet, the profiler will send the value
|
171
|
-
# after it is loaded
|
172
|
-
SolarWindsAPM::CProfiler.interval_setup(value) if defined? SolarWindsAPM::CProfiler
|
173
|
-
|
174
148
|
when :transaction_settings
|
175
149
|
compile_settings(value)
|
176
150
|
|
@@ -230,7 +204,7 @@ module SolarWindsAPM
|
|
230
204
|
begin
|
231
205
|
v[:regexp].is_a?(String) ? Regexp.new(v[:regexp], v[:opts]) : Regexp.new(v[:regexp])
|
232
206
|
rescue StandardError => e
|
233
|
-
SolarWindsAPM.logger.warn {"[#{
|
207
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Problem compiling transaction_settings item #{v}, will ignore. Error: #{e.message}"}
|
234
208
|
nil
|
235
209
|
end
|
236
210
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# Copyright (c) 2019 SolarWinds, LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
require 'singleton'
|
4
|
+
require 'uri'
|
4
5
|
module SolarWindsAPM
|
5
6
|
# OboeInitOptions
|
6
7
|
class OboeInitOptions
|
@@ -96,9 +97,6 @@ module SolarWindsAPM
|
|
96
97
|
def reporter_and_host
|
97
98
|
|
98
99
|
reporter = ENV['SW_APM_REPORTER'] || 'ssl'
|
99
|
-
# override with 'file', e.g. when running tests
|
100
|
-
# changed my mind => set the right reporter in the env when running tests !!!
|
101
|
-
# reporter = 'file' if ENV.key?('SW_APM_GEM_TEST')
|
102
100
|
|
103
101
|
host = ''
|
104
102
|
case reporter
|
@@ -123,7 +121,7 @@ module SolarWindsAPM
|
|
123
121
|
return '' unless @reporter == 'ssl'
|
124
122
|
|
125
123
|
service_key = ENV['SW_APM_SERVICE_KEY'] || SolarWindsAPM::Config[:service_key]
|
126
|
-
|
124
|
+
if service_key.nil? || service_key == ''
|
127
125
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY not configured."}
|
128
126
|
return ''
|
129
127
|
end
|
@@ -133,7 +131,7 @@ module SolarWindsAPM
|
|
133
131
|
service_name = match[3]
|
134
132
|
|
135
133
|
return '' unless validate_token(token) # return if token is not even valid
|
136
|
-
|
134
|
+
|
137
135
|
if service_name.empty?
|
138
136
|
ENV.delete('OTEL_SERVICE_NAME')
|
139
137
|
SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY format problem. Service Name is missing."}
|
@@ -197,7 +195,7 @@ module SolarWindsAPM
|
|
197
195
|
def read_and_validate_ec2_md_timeout
|
198
196
|
timeout = ENV['SW_APM_EC2_METADATA_TIMEOUT'] || SolarWindsAPM::Config[:ec2_metadata_timeout]
|
199
197
|
return 1000 unless timeout.is_a?(Integer) || timeout =~ /^\d+$/
|
200
|
-
|
198
|
+
|
201
199
|
timeout = timeout.to_i
|
202
200
|
timeout.between?(0, 3000) ? timeout : 1000
|
203
201
|
end
|
@@ -218,16 +216,16 @@ module SolarWindsAPM
|
|
218
216
|
file = String.new
|
219
217
|
file = "#{__dir__}/cert/star.appoptics.com.issuer.crt" if appoptics_collector?
|
220
218
|
file = ENV['SW_APM_TRUSTEDPATH'] if !ENV['SW_APM_TRUSTEDPATH'].nil? && !ENV['SW_APM_TRUSTEDPATH']&.empty?
|
221
|
-
|
219
|
+
|
222
220
|
return file if file.empty?
|
223
|
-
|
221
|
+
|
224
222
|
begin
|
225
223
|
certificate = File.open(file,"r").read
|
226
224
|
rescue StandardError => e
|
227
225
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] certificates: #{file} doesn't exist or caused by #{e.message}."}
|
228
226
|
certificate = String.new
|
229
227
|
end
|
230
|
-
|
228
|
+
|
231
229
|
certificate
|
232
230
|
end
|
233
231
|
|
@@ -236,7 +234,7 @@ module SolarWindsAPM
|
|
236
234
|
end
|
237
235
|
|
238
236
|
def appoptics_collector?
|
239
|
-
allowed_uri = ['collector.appoptics.com', 'collector-stg.appoptics.com',
|
237
|
+
allowed_uri = ['collector.appoptics.com', 'collector-stg.appoptics.com',
|
240
238
|
'collector.appoptics.com:443', 'collector-stg.appoptics.com:443']
|
241
239
|
|
242
240
|
(allowed_uri.include? ENV["SW_APM_COLLECTOR"])? true : false
|
@@ -246,12 +244,12 @@ module SolarWindsAPM
|
|
246
244
|
return uri if uri.nil? || uri.empty?
|
247
245
|
|
248
246
|
begin
|
249
|
-
sanitized_uri = URI("http://#{uri}").host
|
247
|
+
sanitized_uri = ::URI.parse("http://#{uri}").host
|
250
248
|
return sanitized_uri unless sanitized_uri.nil?
|
251
249
|
rescue StandardError => e
|
252
250
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] uri for collector #{uri} is malformat. Error: #{e.message}"}
|
253
251
|
end
|
254
|
-
""
|
252
|
+
""
|
255
253
|
end
|
256
254
|
end
|
257
255
|
end
|
@@ -64,25 +64,28 @@ module SolarWindsAPM
|
|
64
64
|
status_code = get_http_status_code(span)
|
65
65
|
request_method = span.attributes[HTTP_METHOD]
|
66
66
|
|
67
|
-
SolarWindsAPM.logger.debug
|
67
|
+
SolarWindsAPM.logger.debug do
|
68
|
+
"[#{self.class}/#{__method__}] createHttpSpan with\n
|
68
69
|
trans_name: #{trans_name}\n
|
69
70
|
url_tran: #{url_tran}\n
|
70
71
|
domain: #{domain}\n
|
71
72
|
span_time: #{span_time}\n
|
72
73
|
status_code: #{status_code}\n
|
73
74
|
request_method: #{request_method}\n
|
74
|
-
has_error: #{has_error}"
|
75
|
+
has_error: #{has_error}"
|
76
|
+
end
|
75
77
|
|
76
|
-
liboboe_txn_name = SolarWindsAPM::Span.createHttpSpan(trans_name,url_tran,domain,span_time,status_code,
|
77
|
-
request_method,has_error)
|
78
|
+
liboboe_txn_name = SolarWindsAPM::Span.createHttpSpan(trans_name,url_tran,domain,span_time,status_code,request_method,has_error)
|
78
79
|
|
79
80
|
else
|
80
81
|
|
81
|
-
SolarWindsAPM.logger.debug
|
82
|
+
SolarWindsAPM.logger.debug do
|
83
|
+
"[#{self.class}/#{__method__}] createSpan with \n
|
82
84
|
trans_name: #{trans_name}\n
|
83
85
|
domain: #{domain}\n
|
84
86
|
span_time: #{span_time}\n
|
85
|
-
has_error: #{has_error}"
|
87
|
+
has_error: #{has_error}"
|
88
|
+
end
|
86
89
|
|
87
90
|
liboboe_txn_name = SolarWindsAPM::Span.createSpan(trans_name, domain, span_time, has_error)
|
88
91
|
end
|
@@ -37,14 +37,16 @@ module SolarWindsAPM
|
|
37
37
|
# parent_context: OpenTelemetry::Context
|
38
38
|
def should_sample?(trace_id:, parent_context:, links:, name:, kind:, attributes:)
|
39
39
|
|
40
|
-
SolarWindsAPM.logger.debug
|
40
|
+
SolarWindsAPM.logger.debug do
|
41
|
+
"[#{self.class}/#{__method__}] should_sample? parameters \n
|
41
42
|
trace_id: #{trace_id.unpack1('H*')}\n
|
42
43
|
parent_context: #{parent_context}\n
|
43
44
|
parent_context.inspect: #{parent_context.inspect}\n
|
44
45
|
links: #{links}\n
|
45
46
|
name: #{name}\n
|
46
47
|
kind: #{kind}\n
|
47
|
-
attributes: #{attributes}"
|
48
|
+
attributes: #{attributes}"
|
49
|
+
end
|
48
50
|
|
49
51
|
# if the upstream has tracestate: sw=.... then it should capture it
|
50
52
|
|
@@ -89,14 +91,15 @@ module SolarWindsAPM
|
|
89
91
|
|
90
92
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] name: #{name}, kind: #{kind}, attributes: #{attributes.inspect}"}
|
91
93
|
|
92
|
-
|
93
|
-
|
94
|
+
# otel-ruby contrib use different key to store url info, currently it's using http.target for path
|
95
|
+
url_path = attributes.nil?? '' : attributes['http.target']
|
96
|
+
transaction_naming_key = "#{url_path}-#{name}-#{kind}"
|
94
97
|
|
95
98
|
tracing_mode = SolarWindsAPM::TransactionCache.get(transaction_naming_key)
|
96
99
|
|
97
100
|
if tracing_mode.nil?
|
98
101
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] transaction cache NOT found: #{transaction_naming_key}."}
|
99
|
-
trans_settings = SolarWindsAPM::TransactionSettings.new(
|
102
|
+
trans_settings = SolarWindsAPM::TransactionSettings.new(url_path: url_path, name: name, kind: kind)
|
100
103
|
tracing_mode = trans_settings.calculate_trace_mode == 1 ? SWO_TRACING_ENABLED : SWO_TRACING_DISABLED
|
101
104
|
SolarWindsAPM::TransactionCache.set(transaction_naming_key, tracing_mode)
|
102
105
|
else
|
@@ -120,7 +123,8 @@ module SolarWindsAPM
|
|
120
123
|
timestamp = xtraceoptions.timestamp
|
121
124
|
end
|
122
125
|
|
123
|
-
SolarWindsAPM.logger.debug
|
126
|
+
SolarWindsAPM.logger.debug do
|
127
|
+
"[#{self.class}/#{__method__}] decision parameters \n
|
124
128
|
tracestring: #{tracestring}\n
|
125
129
|
sw_member_value: #{sw_member_value}\n
|
126
130
|
tracing_mode: #{tracing_mode}\n
|
@@ -129,7 +133,8 @@ module SolarWindsAPM
|
|
129
133
|
trigger_trace_mode: #{trigger_trace_mode}\n
|
130
134
|
options: #{options}\n
|
131
135
|
signature: #{signature}\n
|
132
|
-
timestamp: #{timestamp}"
|
136
|
+
timestamp: #{timestamp}"
|
137
|
+
end
|
133
138
|
|
134
139
|
args = [tracestring,sw_member_value,tracing_mode,sample_rate,trigger_trace,trigger_trace_mode,options,signature,timestamp]
|
135
140
|
do_metrics, do_sample, rate, source, bucket_rate, \
|
@@ -13,7 +13,7 @@ module SolarWindsAPM
|
|
13
13
|
return unless @@agent_enabled # only show the msg once
|
14
14
|
|
15
15
|
@@agent_enabled = false
|
16
|
-
SolarWindsAPM.logger.warn {"[#{
|
16
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Agent disabled. No Trace exported."}
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.validate_service_key
|
@@ -61,10 +61,10 @@ module SolarWindsAPM
|
|
61
61
|
|
62
62
|
def self.print_config
|
63
63
|
@@config.each do |config, value|
|
64
|
-
SolarWindsAPM.logger.warn {"[#{
|
64
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] config: #{config} = #{value}"}
|
65
65
|
end
|
66
66
|
@@config_map.each do |config, value|
|
67
|
-
SolarWindsAPM.logger.warn {"[#{
|
67
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] config_map: #{config} = #{value}"}
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -84,16 +84,16 @@ module SolarWindsAPM
|
|
84
84
|
return
|
85
85
|
end
|
86
86
|
|
87
|
-
SolarWindsAPM.logger.debug {"[#{
|
87
|
+
SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] propagators: #{propagators.map(&:class)}"}
|
88
88
|
unless ([::OpenTelemetry::Trace::Propagation::TraceContext::TextMapPropagator, ::OpenTelemetry::Baggage::Propagation::TextMapPropagator] - propagators.map(&:class)).empty? # rubocop:disable Style/GuardClause
|
89
|
-
SolarWindsAPM.logger.warn {"[#{
|
89
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Missing tracecontext propagator."}
|
90
90
|
disable_agent
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
94
|
def self.initialize
|
95
95
|
unless defined?(::OpenTelemetry::SDK::Configurator)
|
96
|
-
SolarWindsAPM.logger.warn {"[#{
|
96
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] missing OpenTelemetry::SDK::Configurator; opentelemetry seems not loaded."}
|
97
97
|
disable_agent
|
98
98
|
return
|
99
99
|
end
|
@@ -144,14 +144,14 @@ module SolarWindsAPM
|
|
144
144
|
#
|
145
145
|
def self.initialize_with_config
|
146
146
|
unless block_given?
|
147
|
-
SolarWindsAPM.logger.warn {"[#{
|
147
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Block not given while doing in-code configuration. Agent disabled."}
|
148
148
|
return
|
149
149
|
end
|
150
150
|
|
151
151
|
yield @@config_map
|
152
152
|
|
153
153
|
if @@config_map.empty?
|
154
|
-
SolarWindsAPM.logger.warn {"[#{
|
154
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] No configuration given for in-code configuration. Agent disabled."}
|
155
155
|
return
|
156
156
|
end
|
157
157
|
|
@@ -107,7 +107,7 @@ module SolarWindsAPM
|
|
107
107
|
marginalia_job["class"] if marginalia_job.respond_to?(:[])
|
108
108
|
end
|
109
109
|
|
110
|
-
DEFAULT_LINES_TO_IGNORE_REGEX = %r{\.rvm|/ruby/gems/|vendor/|marginalia|rbenv|monitor\.rb.*mon_synchronize}
|
110
|
+
DEFAULT_LINES_TO_IGNORE_REGEX = %r{\.rvm|/ruby/gems/|vendor/|marginalia|rbenv|monitor\.rb.*mon_synchronize}
|
111
111
|
|
112
112
|
def self.line
|
113
113
|
SWOMarginalia::Comment.lines_to_ignore ||= DEFAULT_LINES_TO_IGNORE_REGEX
|
@@ -179,7 +179,7 @@ module SolarWindsAPM
|
|
179
179
|
span_id: span_context.hex_span_id,
|
180
180
|
trace_flags: trace_flag)
|
181
181
|
rescue NameError => e
|
182
|
-
SolarWindsAPM.logger.error {"[#{
|
182
|
+
SolarWindsAPM.logger.error {"[#{name}/#{__method__}] Couldn't find OpenTelemetry. Error: #{e.message}"}
|
183
183
|
end
|
184
184
|
|
185
185
|
if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('6.1')
|
@@ -53,7 +53,7 @@ module SolarWindsAPM
|
|
53
53
|
# We don't want to trace framework caches.
|
54
54
|
# Only instrument SQL that directly hits the database.
|
55
55
|
def ignore_payload?(name)
|
56
|
-
%w
|
56
|
+
%w[SCHEMA EXPLAIN CACHE].include?(name.to_s)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -9,14 +9,14 @@ module SolarWindsAPM
|
|
9
9
|
SWO_TRACING_ENABLED = 1
|
10
10
|
SWO_TRACING_DISABLED = 0
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
@
|
14
|
-
@name
|
15
|
-
@kind
|
12
|
+
def initialize(url_path: '', name: '', kind: '')
|
13
|
+
@url_path = url_path
|
14
|
+
@name = name
|
15
|
+
@kind = kind
|
16
16
|
end
|
17
17
|
|
18
|
-
# calculate trace mode to set either 1 or 0 based on
|
19
|
-
# first check if
|
18
|
+
# calculate trace mode to set either 1 or 0 based on url_path and name+kind
|
19
|
+
# first check if url_path match, if not match, then match the name+kind
|
20
20
|
def calculate_trace_mode
|
21
21
|
tracing_mode_enabled? && tracing_enabled? ? SWO_TRACING_ENABLED : SWO_TRACING_DISABLED
|
22
22
|
end
|
@@ -36,8 +36,8 @@ module SolarWindsAPM
|
|
36
36
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] enabled_regexps: #{enabled_regexps&.inspect}"}
|
37
37
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] disabled_regexps: #{disabled_regexps&.inspect}"}
|
38
38
|
|
39
|
-
return false if disabled_regexps.is_a?(Array) && disabled_regexps.any? { |regex| regex.match?(@
|
40
|
-
return true if enabled_regexps.is_a?(Array) && enabled_regexps.any? { |regex| regex.match?(@
|
39
|
+
return false if disabled_regexps.is_a?(Array) && disabled_regexps.any? { |regex| regex.match?(@url_path) }
|
40
|
+
return true if enabled_regexps.is_a?(Array) && enabled_regexps.any? { |regex| regex.match?(@url_path) }
|
41
41
|
return false if disabled_regexps.is_a?(Array) && disabled_regexps.any? { |regex| regex.match?(span_layer) }
|
42
42
|
return true if enabled_regexps.is_a?(Array) && enabled_regexps.any? { |regex| regex.match?(span_layer) }
|
43
43
|
|
@@ -27,10 +27,14 @@ if SolarWindsAPM::Config[:tag_sql]
|
|
27
27
|
# }
|
28
28
|
# }
|
29
29
|
# ]
|
30
|
+
SolarWindsAPM.logger.info {"In Rails 7, tag tracecontext on a query by including SolarWindsAPM::SWOMarginalia::Comment.traceparent as function in config.active_record.query_log_tags."}
|
31
|
+
SolarWindsAPM.logger.info {"For more information, please check https://api.rubyonrails.org/classes/ActiveRecord/QueryLogs.html"}
|
30
32
|
require_relative './support/swomarginalia/comment'
|
31
33
|
end
|
32
|
-
|
34
|
+
elsif defined?(::ActiveRecord) && ::ActiveRecord.version.to_s < '7'
|
33
35
|
require_relative './support/swomarginalia/load_swomarginalia'
|
34
36
|
SolarWindsAPM::SWOMarginalia::LoadSWOMarginalia.insert
|
37
|
+
else
|
38
|
+
SolarWindsAPM.logger.info {"tag_sql currently is not supported in non-rails app that use active_record > 7"}
|
35
39
|
end
|
36
40
|
end
|
@@ -9,7 +9,7 @@ module SolarWindsAPM
|
|
9
9
|
MAJOR = 6 # breaking,
|
10
10
|
MINOR = 0 # feature,
|
11
11
|
PATCH = 0 # fix => BFF
|
12
|
-
PRE = '
|
12
|
+
PRE = 'preV2'.freeze # for pre-releases into packagecloud, set to nil for production releases into rubygems
|
13
13
|
|
14
14
|
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
|
15
15
|
end
|
data/lib/solarwinds_apm.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Copyright (c) 2016 SolarWinds, LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
|
-
begin
|
5
|
-
|
4
|
+
begin
|
6
5
|
if ENV.has_key?('SOLARWINDS_APM_ENABLED') && (ENV['SOLARWINDS_APM_ENABLED'] == 'false' || ENV['SOLARWINDS_APM_ENABLED'] == false)
|
7
6
|
SolarWindsAPM.logger.warn 'SOLARWINDS_APM_ENABLED environment variable detected and was set to false; SolarWindsAPM disabled'
|
8
7
|
return
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solarwinds_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.
|
4
|
+
version: 6.0.0.preV2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maia Engeli
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2023-
|
14
|
+
date: 2023-08-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: opentelemetry-sdk
|
@@ -41,20 +41,6 @@ dependencies:
|
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 0.31.0
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: ruby2_keywords
|
46
|
-
requirement: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - "~>"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 0.0.5
|
51
|
-
type: :runtime
|
52
|
-
prerelease: false
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - "~>"
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 0.0.5
|
58
44
|
- !ruby/object:Gem::Dependency
|
59
45
|
name: json
|
60
46
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +109,6 @@ files:
|
|
123
109
|
- lib/solarwinds_apm/noop/README.md
|
124
110
|
- lib/solarwinds_apm/noop/context.rb
|
125
111
|
- lib/solarwinds_apm/noop/metadata.rb
|
126
|
-
- lib/solarwinds_apm/noop/profiling.rb
|
127
112
|
- lib/solarwinds_apm/oboe_init_options.rb
|
128
113
|
- lib/solarwinds_apm/opentelemetry.rb
|
129
114
|
- lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb
|
@@ -174,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
159
|
- !ruby/object:Gem::Version
|
175
160
|
version: 1.3.1
|
176
161
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.3.26
|
178
163
|
signing_key:
|
179
164
|
specification_version: 4
|
180
165
|
summary: SolarWindsAPM performance instrumentation gem for Ruby
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module SolarWindsAPM
|
2
|
-
# override the Ruby method, so that no code related to profiling gets executed
|
3
|
-
class Profiling
|
4
|
-
def self.run
|
5
|
-
yield
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
# these put the c-functions into "noop"
|
10
|
-
module CProfiler
|
11
|
-
def self.interval_setup(_); end
|
12
|
-
|
13
|
-
def self.tid
|
14
|
-
0
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|