solarwinds_apm 6.0.0.preV4 → 6.0.0.prev6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/oboe_metal/extconf.rb +4 -3
- data/ext/oboe_metal/lib/liboboe-1.0-aarch64.so.sha256 +1 -1
- data/ext/oboe_metal/lib/liboboe-1.0-alpine-aarch64.so.sha256 +1 -1
- data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.sha256 +1 -1
- data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.sha256 +1 -1
- data/ext/oboe_metal/src/VERSION +1 -1
- data/ext/oboe_metal/src/oboe.h +56 -13
- data/ext/oboe_metal/src/oboe_api.cpp +105 -6
- data/ext/oboe_metal/src/oboe_api.h +121 -2
- data/ext/oboe_metal/src/oboe_debug.h +4 -315
- data/ext/oboe_metal/src/oboe_swig_wrap.cc +2987 -549
- data/lib/oboe_metal.rb +5 -2
- data/lib/rails/generators/solarwinds_apm/install_generator.rb +5 -2
- data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +8 -4
- data/lib/solarwinds_apm/api/current_trace_info.rb +8 -7
- data/lib/solarwinds_apm/api/custom_metrics.rb +93 -0
- data/lib/solarwinds_apm/api/opentelemetry.rb +6 -0
- data/lib/solarwinds_apm/api/tracing.rb +32 -5
- data/lib/solarwinds_apm/api/transaction_name.rb +30 -14
- data/lib/solarwinds_apm/api.rb +7 -2
- data/lib/solarwinds_apm/base.rb +5 -14
- data/lib/solarwinds_apm/config.rb +58 -17
- data/lib/solarwinds_apm/constants.rb +6 -0
- data/lib/solarwinds_apm/logger.rb +5 -2
- data/lib/solarwinds_apm/noop/context.rb +5 -2
- data/lib/solarwinds_apm/noop/metadata.rb +5 -2
- data/lib/solarwinds_apm/oboe_init_options.rb +37 -19
- data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +7 -2
- data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +10 -1
- data/lib/solarwinds_apm/opentelemetry/solarwinds_propagator.rb +6 -0
- data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +6 -0
- data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +8 -1
- data/lib/solarwinds_apm/opentelemetry.rb +6 -0
- data/lib/solarwinds_apm/otel_config.rb +18 -29
- data/lib/solarwinds_apm/support/logger_formatter.rb +6 -3
- data/lib/solarwinds_apm/support/logging_log_event.rb +5 -2
- data/lib/solarwinds_apm/support/lumberjack_formatter.rb +5 -2
- data/lib/solarwinds_apm/support/oboe_tracing_mode.rb +10 -4
- data/lib/solarwinds_apm/support/swomarginalia/README.md +1 -1
- data/lib/solarwinds_apm/support/swomarginalia/comment.rb +3 -3
- data/lib/solarwinds_apm/support/swomarginalia/load_swomarginalia.rb +6 -0
- data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +1 -1
- data/lib/solarwinds_apm/support/transaction_cache.rb +6 -0
- data/lib/solarwinds_apm/support/transaction_settings.rb +6 -7
- data/lib/solarwinds_apm/support/txn_name_manager.rb +6 -0
- data/lib/solarwinds_apm/support/utils.rb +6 -0
- data/lib/solarwinds_apm/support/x_trace_options.rb +5 -2
- data/lib/solarwinds_apm/support.rb +5 -3
- data/lib/solarwinds_apm/support_report.rb +6 -3
- data/lib/solarwinds_apm/thread_local.rb +5 -2
- data/lib/solarwinds_apm/version.rb +6 -3
- data/lib/solarwinds_apm.rb +9 -11
- metadata +6 -4
@@ -1,7 +1,12 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
3
7
|
require 'singleton'
|
4
8
|
require 'uri'
|
9
|
+
|
5
10
|
module SolarWindsAPM
|
6
11
|
# OboeInitOptions
|
7
12
|
class OboeInitOptions
|
@@ -16,7 +21,7 @@ module SolarWindsAPM
|
|
16
21
|
@debug_level = (ENV['SW_APM_DEBUG_LEVEL'] || SolarWindsAPM::Config[:debug_level] || 3).to_i
|
17
22
|
# file name including path for log file
|
18
23
|
# TODO eventually find better way to combine ruby and oboe logs
|
19
|
-
@log_file_path = ENV['
|
24
|
+
@log_file_path = ENV['SW_APM_LOG_FILEPATH'] || ''
|
20
25
|
# maximum number of transaction names to track
|
21
26
|
@max_transactions = (ENV['SW_APM_MAX_TRANSACTIONS'] || -1).to_i
|
22
27
|
# maximum wait time for flushing data before terminating in milli seconds
|
@@ -45,7 +50,7 @@ module SolarWindsAPM
|
|
45
50
|
# custom token bucket rate
|
46
51
|
@token_bucket_rate = (ENV['SW_APM_TOKEN_BUCKET_RATE'] || -1).to_i
|
47
52
|
# use single files in file reporter for each event
|
48
|
-
@file_single = ENV['SW_APM_REPORTER_FILE_SINGLE'].to_s.
|
53
|
+
@file_single = ENV['SW_APM_REPORTER_FILE_SINGLE'].to_s.casecmp('true').zero? ? 1 : 0
|
49
54
|
# timeout for ec2 metadata
|
50
55
|
@ec2_md_timeout = read_and_validate_ec2_md_timeout
|
51
56
|
@grpc_proxy = read_and_validate_proxy
|
@@ -54,6 +59,8 @@ module SolarWindsAPM
|
|
54
59
|
# hardcoded arg for trace id format to use w3c format
|
55
60
|
# flag for format of metric (0 = Both; 1 = AppOptics only; 2 = SWO only; default = 0)
|
56
61
|
@metric_format = determine_the_metric_model
|
62
|
+
# log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
|
63
|
+
@log_type = determine_oboe_log_type
|
57
64
|
end
|
58
65
|
|
59
66
|
# for testing with changed ENV vars
|
@@ -70,7 +77,6 @@ module SolarWindsAPM
|
|
70
77
|
@max_flush_wait_time, # 4
|
71
78
|
@events_flush_interval, # 5
|
72
79
|
@event_flush_batch_size, # 6
|
73
|
-
|
74
80
|
@reporter, # 7
|
75
81
|
@host, # 8
|
76
82
|
@service_key, # 9
|
@@ -84,7 +90,8 @@ module SolarWindsAPM
|
|
84
90
|
@ec2_md_timeout, #17
|
85
91
|
@grpc_proxy, #18
|
86
92
|
0, #19 arg for lambda (no lambda for ruby yet)
|
87
|
-
@metric_format
|
93
|
+
@metric_format, #20
|
94
|
+
@log_type #21
|
88
95
|
]
|
89
96
|
end
|
90
97
|
|
@@ -142,7 +149,10 @@ module SolarWindsAPM
|
|
142
149
|
otel_resource_service_name = nil
|
143
150
|
ENV['OTEL_RESOURCE_ATTRIBUTES']&.split(',')&.each do |pair|
|
144
151
|
key, value = pair.split('=')
|
145
|
-
|
152
|
+
if key == 'service.name'
|
153
|
+
otel_resource_service_name = value
|
154
|
+
break
|
155
|
+
end
|
146
156
|
end
|
147
157
|
|
148
158
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] provided otel_resource_service_name #{otel_resource_service_name}"} if otel_resource_service_name
|
@@ -162,8 +172,9 @@ module SolarWindsAPM
|
|
162
172
|
"#{token}:#{service_name}"
|
163
173
|
end
|
164
174
|
|
175
|
+
# In case of java-collector, please provide a dummy service key
|
165
176
|
def validate_token(token)
|
166
|
-
|
177
|
+
unless /^[0-9a-zA-Z_-]{71}$/.match?(token)
|
167
178
|
masked = "#{token[0..3]}...#{token[-4..]}"
|
168
179
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. API Token in wrong format. Masked token: #{masked}"}
|
169
180
|
return false
|
@@ -173,20 +184,19 @@ module SolarWindsAPM
|
|
173
184
|
end
|
174
185
|
|
175
186
|
def validate_transform_service_name(service_name)
|
176
|
-
service_name = 'test_ssl_collector' if ENV['SW_APM_COLLECTOR'] =~ /java-collector:1222/
|
177
187
|
if service_name.empty?
|
178
188
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. Service Name is missing"}
|
179
189
|
return false
|
180
190
|
end
|
181
191
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
192
|
+
name_ = service_name.dup
|
193
|
+
name_.downcase!
|
194
|
+
name_.gsub!(/[^a-z0-9.:_-]/, '')
|
195
|
+
name_ = name_[0..254]
|
186
196
|
|
187
|
-
if
|
188
|
-
SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. Service Name transformed from #{service_name} to #{
|
189
|
-
service_name =
|
197
|
+
if name_ != service_name
|
198
|
+
SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. Service Name transformed from #{service_name} to #{name_}"}
|
199
|
+
service_name = name_
|
190
200
|
end
|
191
201
|
@service_name = service_name # instance variable used in testing
|
192
202
|
true
|
@@ -204,7 +214,7 @@ module SolarWindsAPM
|
|
204
214
|
proxy = ENV['SW_APM_PROXY'] || SolarWindsAPM::Config[:http_proxy] || ''
|
205
215
|
return proxy if proxy == ''
|
206
216
|
|
207
|
-
unless
|
217
|
+
unless /http:\/\/.*:\d+$/.match?(proxy)
|
208
218
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_PROXY/http_proxy doesn't start with 'http://', #{proxy}"}
|
209
219
|
return '' # try without proxy, it may work, shouldn't crash but may not report
|
210
220
|
end
|
@@ -213,14 +223,15 @@ module SolarWindsAPM
|
|
213
223
|
end
|
214
224
|
|
215
225
|
def read_certificates
|
226
|
+
certificate = ''
|
227
|
+
|
216
228
|
file = appoptics_collector?? "#{__dir__}/cert/star.appoptics.com.issuer.crt" : ENV['SW_APM_TRUSTEDPATH']
|
217
|
-
return
|
229
|
+
return certificate if file.nil? || file&.empty?
|
218
230
|
|
219
231
|
begin
|
220
232
|
certificate = File.open(file,"r").read
|
221
233
|
rescue StandardError => e
|
222
234
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] certificates: #{file} doesn't exist or caused by #{e.message}."}
|
223
|
-
certificate = String.new
|
224
235
|
end
|
225
236
|
|
226
237
|
certificate
|
@@ -248,5 +259,12 @@ module SolarWindsAPM
|
|
248
259
|
end
|
249
260
|
""
|
250
261
|
end
|
262
|
+
|
263
|
+
def determine_oboe_log_type
|
264
|
+
log_type = 0
|
265
|
+
log_type = 2 unless ENV['SW_APM_LOG_FILEPATH'].to_s.empty?
|
266
|
+
log_type = 4 if @debug_level == -1
|
267
|
+
log_type
|
268
|
+
end
|
251
269
|
end
|
252
270
|
end
|
@@ -1,4 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
2
7
|
module SolarWindsAPM
|
3
8
|
module OpenTelemetry
|
4
9
|
# SolarWindsExporter
|
@@ -128,7 +133,7 @@ module SolarWindsAPM
|
|
128
133
|
# helper function that extract gem library version for func add_instrumented_framework
|
129
134
|
def check_framework_version(framework)
|
130
135
|
framework_version = nil
|
131
|
-
if @version_cache.
|
136
|
+
if @version_cache.has_key?(framework)
|
132
137
|
|
133
138
|
framework_version = @version_cache[framework]
|
134
139
|
else
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
module SolarWindsAPM
|
2
8
|
module OpenTelemetry
|
3
9
|
# reference: OpenTelemetry::SDK::Trace::SpanProcessor
|
@@ -125,7 +131,7 @@ module SolarWindsAPM
|
|
125
131
|
|
126
132
|
# This span from inbound HTTP request if from a SERVER by some http.method
|
127
133
|
def span_http?(span)
|
128
|
-
|
134
|
+
span.kind == ::OpenTelemetry::Trace::SpanKind::SERVER && !span.attributes[HTTP_METHOD].nil?
|
129
135
|
end
|
130
136
|
|
131
137
|
# Calculate if this span instance has_error
|
@@ -142,12 +148,15 @@ module SolarWindsAPM
|
|
142
148
|
end
|
143
149
|
|
144
150
|
# Get trans_name and url_tran of this span instance.
|
151
|
+
# Predecessor order: custom SDK > env var SW_APM_TRANSACTION_NAME > automatic naming
|
145
152
|
def calculate_transaction_names(span)
|
146
153
|
trace_span_id = "#{span.context.hex_trace_id}-#{span.context.hex_span_id}"
|
147
154
|
trans_name = @txn_manager.get(trace_span_id)
|
148
155
|
if trans_name
|
149
156
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] found trans name from txn_manager: #{trans_name} by #{trace_span_id}"}
|
150
157
|
@txn_manager.del(trace_span_id)
|
158
|
+
elsif ENV.has_key?('SW_APM_TRANSACTION_NAME') && ENV['SW_APM_TRANSACTION_NAME'] != ''
|
159
|
+
trans_name = ENV['SW_APM_TRANSACTION_NAME']
|
151
160
|
else
|
152
161
|
trans_name = span.attributes[HTTP_ROUTE] || nil
|
153
162
|
trans_name = span.name if span.name && (trans_name.nil? || trans_name.empty?)
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
module SolarWindsAPM
|
2
8
|
module OpenTelemetry
|
3
9
|
module SolarWindsPropagator
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
module SolarWindsAPM
|
2
8
|
module OpenTelemetry
|
3
9
|
module SolarWindsResponsePropagator
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
module SolarWindsAPM
|
2
8
|
module OpenTelemetry
|
3
9
|
# SolarWindsSampler
|
@@ -266,7 +272,8 @@ module SolarWindsAPM
|
|
266
272
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] trace_state_no_response #{trace_state_no_response.inspect}"}
|
267
273
|
|
268
274
|
trace_state_no_response = parent_span_context.tracestate.delete(XTraceOptions.sw_xtraceoptions_response_key)
|
269
|
-
no_sw_count = trace_state_no_response.to_h.
|
275
|
+
no_sw_count = trace_state_no_response.to_h.count { |k, _v| k != 'sw' }
|
276
|
+
|
270
277
|
new_attributes[SW_TRACESTATE_CAPTURE_KEY] = Utils.trace_state_header(trace_state_no_response) if no_sw_count > 0
|
271
278
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] new_attributes after add_tracestate_capture_to_new_attributes: #{new_attributes.inspect}"}
|
272
279
|
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
require 'opentelemetry/sdk'
|
2
8
|
require 'opentelemetry/instrumentation/all'
|
3
9
|
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
module SolarWindsAPM
|
2
8
|
# OTelConfig module
|
3
9
|
# For configure otel component: configurable: propagator, exporter
|
@@ -23,20 +29,12 @@ module SolarWindsAPM
|
|
23
29
|
end
|
24
30
|
|
25
31
|
def self.resolve_sampler
|
26
|
-
|
27
|
-
resolve_sampler_config
|
32
|
+
sampler_config = {"trigger_trace" => SolarWindsAPM::Config[:trigger_tracing_mode]}
|
28
33
|
@@config[:sampler] =
|
29
34
|
::OpenTelemetry::SDK::Trace::Samplers.parent_based(
|
30
|
-
root: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(
|
31
|
-
remote_parent_sampled: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(
|
32
|
-
remote_parent_not_sampled: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.resolve_sampler_config
|
36
|
-
sampler_config = {}
|
37
|
-
sampler_config["trigger_trace"] = "enabled"
|
38
|
-
sampler_config["trigger_trace"] = nil if ENV["SW_APM_TRIGGER_TRACING_MODE"] == 'disabled'
|
39
|
-
@@config[:sampler_config] = sampler_config
|
35
|
+
root: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(sampler_config),
|
36
|
+
remote_parent_sampled: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(sampler_config),
|
37
|
+
remote_parent_not_sampled: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(sampler_config))
|
40
38
|
end
|
41
39
|
|
42
40
|
#
|
@@ -59,20 +57,6 @@ module SolarWindsAPM
|
|
59
57
|
end
|
60
58
|
end
|
61
59
|
|
62
|
-
def self.obfuscate_helper(instrumentation)
|
63
|
-
if @@config_map[instrumentation] # user provided the option
|
64
|
-
@@config_map[instrumentation][:db_statement] = :obfuscate unless @@config_map[instrumentation][:db_statement] # user provided the db_statement, ignore our default setting
|
65
|
-
else
|
66
|
-
@@config_map[instrumentation] = {db_statement: :obfuscate}
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.obfuscate_query
|
71
|
-
obfuscate_helper("OpenTelemetry::Instrumentation::Dalli")
|
72
|
-
obfuscate_helper("OpenTelemetry::Instrumentation::Mysql2")
|
73
|
-
obfuscate_helper("OpenTelemetry::Instrumentation::PG")
|
74
|
-
end
|
75
|
-
|
76
60
|
def self.[](key)
|
77
61
|
@@config[key.to_sym]
|
78
62
|
end
|
@@ -126,13 +110,18 @@ module SolarWindsAPM
|
|
126
110
|
resolve_solarwinds_processor
|
127
111
|
resolve_response_propagator
|
128
112
|
|
129
|
-
obfuscate_query
|
130
|
-
|
131
113
|
print_config if SolarWindsAPM.logger.level.zero?
|
132
114
|
|
133
115
|
ENV['OTEL_TRACES_EXPORTER'] = 'none' if ENV['OTEL_TRACES_EXPORTER'].to_s.empty?
|
134
116
|
|
135
|
-
|
117
|
+
if ENV['OTEL_LOG_LEVEL'].to_s.empty?
|
118
|
+
::OpenTelemetry::SDK.configure do |c|
|
119
|
+
c.logger = ::Logger.new($stdout, level: ::SolarWindsAPM.logger.level) # sync solarwinds_apm logger to otel log
|
120
|
+
c.use_all(@@config_map)
|
121
|
+
end
|
122
|
+
else
|
123
|
+
::OpenTelemetry::SDK.configure { |c| c.use_all(@@config_map) }
|
124
|
+
end
|
136
125
|
|
137
126
|
validate_propagator(::OpenTelemetry.propagation.instance_variable_get(:@propagators))
|
138
127
|
|
@@ -1,5 +1,8 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
3
6
|
|
4
7
|
require 'logger'
|
5
8
|
|
@@ -16,7 +19,7 @@ module SolarWindsAPM
|
|
16
19
|
private
|
17
20
|
|
18
21
|
def insert_trace_id(msg)
|
19
|
-
return msg if
|
22
|
+
return msg if /trace_id=/.match?(msg)
|
20
23
|
|
21
24
|
current_trace = SolarWindsAPM::API.current_trace_info
|
22
25
|
if current_trace.do_log
|
@@ -1,5 +1,8 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
3
6
|
|
4
7
|
require_relative 'logger_formatter'
|
5
8
|
|
@@ -1,5 +1,8 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
3
6
|
|
4
7
|
require_relative 'logger_formatter'
|
5
8
|
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
module SolarWindsAPM
|
2
8
|
module OpenTelemetry
|
3
9
|
# OboeTracingMode
|
@@ -11,15 +17,15 @@ module SolarWindsAPM
|
|
11
17
|
|
12
18
|
def self.get_oboe_trace_mode(tracing_mode)
|
13
19
|
mode = OBOE_SETTINGS_UNSET
|
14
|
-
mode = OBOE_TRACE_ENABLED if tracing_mode ==
|
15
|
-
mode = OBOE_TRACE_DISABLED if tracing_mode ==
|
20
|
+
mode = OBOE_TRACE_ENABLED if tracing_mode == :enabled
|
21
|
+
mode = OBOE_TRACE_DISABLED if tracing_mode == :disabled
|
16
22
|
mode
|
17
23
|
end
|
18
24
|
|
19
25
|
def self.get_oboe_trigger_trace_mode(trigger_trace_mode)
|
20
26
|
mode = OBOE_SETTINGS_UNSET
|
21
|
-
mode = OBOE_TRIGGER_ENABLED if trigger_trace_mode ==
|
22
|
-
mode = OBOE_TRIGGER_DISABLED if trigger_trace_mode ==
|
27
|
+
mode = OBOE_TRIGGER_ENABLED if trigger_trace_mode == :enabled
|
28
|
+
mode = OBOE_TRIGGER_DISABLED if trigger_trace_mode == :disabled
|
23
29
|
mode
|
24
30
|
end
|
25
31
|
end
|
@@ -38,4 +38,4 @@ Post Load (1.1ms) SELECT `posts`.* FROM `posts` /*application=SqlcommenterRails
|
|
38
38
|
```
|
39
39
|
|
40
40
|
## License
|
41
|
-
This project is licensed under the [MIT License](https://github.com/
|
41
|
+
This project is licensed under the [MIT License](https://github.com/solarwinds/apm-ruby/blob/main/lib/solarwinds_apm/support/swomarginalia/LICENSE).
|
@@ -9,7 +9,7 @@ module SolarWindsAPM
|
|
9
9
|
mattr_accessor :components, :lines_to_ignore, :prepend_comment
|
10
10
|
SWOMarginalia::Comment.components ||= [:traceparent]
|
11
11
|
# To add new components:
|
12
|
-
# Create file and load after
|
12
|
+
# Create file and load after loading solarwinds_apm, and add following:
|
13
13
|
# SolarWindsAPM::SWOMarginalia::Comment.component = [:user_defined]
|
14
14
|
|
15
15
|
def self.update!(controller=nil)
|
@@ -25,7 +25,7 @@ module SolarWindsAPM
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.construct_comment
|
28
|
-
ret =
|
28
|
+
ret = +''
|
29
29
|
components.each do |c|
|
30
30
|
component_value = send(c)
|
31
31
|
ret << "#{c}='#{component_value}'," if component_value.present?
|
@@ -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}.freeze # rubocop:disable Style/RedundantFreeze
|
111
111
|
|
112
112
|
def self.line
|
113
113
|
SWOMarginalia::Comment.lines_to_ignore ||= DEFAULT_LINES_TO_IGNORE_REGEX
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
require_relative './swomarginalia'
|
2
8
|
|
3
9
|
module SolarWindsAPM
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
module SolarWindsAPM
|
2
8
|
# LRU TransactionCache with initial limit 1000
|
3
9
|
module TransactionCache
|
@@ -1,6 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# All rights reserved.
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
3
2
|
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
4
7
|
module SolarWindsAPM
|
5
8
|
##
|
6
9
|
# This module helps with setting up the transaction filters and applying them
|
@@ -18,15 +21,11 @@ module SolarWindsAPM
|
|
18
21
|
# calculate trace mode to set either 1 or 0 based on url_path and name+kind
|
19
22
|
# first check if url_path match, if not match, then match the name+kind
|
20
23
|
def calculate_trace_mode
|
21
|
-
|
24
|
+
SolarWindsAPM::Config[:tracing_mode] == :enabled && tracing_enabled? ? SWO_TRACING_ENABLED : SWO_TRACING_DISABLED
|
22
25
|
end
|
23
26
|
|
24
27
|
private
|
25
28
|
|
26
|
-
def tracing_mode_enabled?
|
27
|
-
SolarWindsAPM::Config[:tracing_mode] && ![:disabled, :never].include?(SolarWindsAPM::Config[:tracing_mode])
|
28
|
-
end
|
29
|
-
|
30
29
|
def tracing_enabled?
|
31
30
|
span_layer = "#{@kind}:#{@name}"
|
32
31
|
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
module SolarWindsAPM
|
2
8
|
# SolarWindsTxnNameManager
|
3
9
|
class TxnNameManager
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
1
7
|
module SolarWindsAPM
|
2
8
|
# Utils
|
3
9
|
class Utils
|
@@ -1,5 +1,8 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
3
6
|
|
4
7
|
module SolarWindsAPM
|
5
8
|
# XTraceOptions
|
@@ -1,8 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# All rights reserved.
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
3
2
|
#
|
4
|
-
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
5
4
|
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
6
|
+
|
7
|
+
# This file is for loading support library
|
6
8
|
|
7
9
|
require_relative './support/logger_formatter'
|
8
10
|
require_relative './support/logging_log_event'
|
@@ -1,5 +1,8 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
3
6
|
|
4
7
|
require 'rbconfig'
|
5
8
|
require 'logger'
|
@@ -82,7 +85,7 @@ module SolarWindsAPM
|
|
82
85
|
SolarWindsAPM.logger.warn '********************************************************'
|
83
86
|
SolarWindsAPM.logger.warn '* END SolarWindsAPM Support Report'
|
84
87
|
SolarWindsAPM.logger.warn '* Support Email: technicalsupport@solarwinds.com'
|
85
|
-
SolarWindsAPM.logger.warn '* Github: https://github.com/
|
88
|
+
SolarWindsAPM.logger.warn '* Github: https://github.com/solarwinds/apm-ruby'
|
86
89
|
SolarWindsAPM.logger.warn '********************************************************'
|
87
90
|
|
88
91
|
SolarWindsAPM.logger.level = @logger_level
|
@@ -1,5 +1,8 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
3
6
|
|
4
7
|
module SolarWindsAPM
|
5
8
|
##
|
@@ -1,5 +1,8 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
#
|
5
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
3
6
|
|
4
7
|
module SolarWindsAPM
|
5
8
|
##
|
@@ -9,7 +12,7 @@ module SolarWindsAPM
|
|
9
12
|
MAJOR = 6 # breaking,
|
10
13
|
MINOR = 0 # feature,
|
11
14
|
PATCH = 0 # fix => BFF
|
12
|
-
PRE = '
|
15
|
+
PRE = 'prev6'.freeze
|
13
16
|
|
14
17
|
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
|
15
18
|
end
|