solarwinds_apm 6.0.0.preV5 → 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/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +1 -1
- data/lib/solarwinds_apm/api/current_trace_info.rb +2 -3
- data/lib/solarwinds_apm/base.rb +0 -12
- data/lib/solarwinds_apm/config.rb +53 -15
- data/lib/solarwinds_apm/oboe_init_options.rb +26 -16
- data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +1 -1
- data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +1 -1
- data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +2 -1
- data/lib/solarwinds_apm/otel_config.rb +12 -29
- data/lib/solarwinds_apm/support/logger_formatter.rb +1 -1
- data/lib/solarwinds_apm/support/oboe_tracing_mode.rb +4 -4
- 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 +1 -5
- data/lib/solarwinds_apm/version.rb +1 -1
- data/lib/solarwinds_apm.rb +2 -7
- metadata +3 -2
@@ -147,7 +147,7 @@ if defined?(SolarWindsAPM::Config)
|
|
147
147
|
# Trace options is a custom HTTP header X-Trace-Options that can be set on a request to carry additional information
|
148
148
|
# to the agents, one such option being trigger-trace which we’ll call a trigger trace request.
|
149
149
|
#
|
150
|
-
SolarWindsAPM::Config[:trigger_tracing_mode] =
|
150
|
+
SolarWindsAPM::Config[:trigger_tracing_mode] = :enabled
|
151
151
|
|
152
152
|
#
|
153
153
|
# Argument logging
|
@@ -51,7 +51,7 @@ module SolarWindsAPM
|
|
51
51
|
class TraceInfo
|
52
52
|
attr_reader :tracestring, :trace_id, :span_id, :trace_flags, :do_log
|
53
53
|
|
54
|
-
REGEXP = /^(?<tracestring>(?<version>[a-f0-9]{2})-(?<trace_id>[a-f0-9]{32})-(?<span_id>[a-f0-9]{16})-(?<flags>[a-f0-9]{2}))
|
54
|
+
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 # rubocop:disable Style/RedundantFreeze
|
55
55
|
private_constant :REGEXP
|
56
56
|
|
57
57
|
def initialize
|
@@ -98,8 +98,7 @@ module SolarWindsAPM
|
|
98
98
|
# * Hash
|
99
99
|
#
|
100
100
|
def hash_for_log
|
101
|
-
@hash_for_log = {}
|
102
|
-
@hash_for_log = {trace_id: @trace_id, span_id: @span_id, trace_flags: @trace_flags, service_name: @service_name} if @do_log
|
101
|
+
@hash_for_log = @do_log ? {'trace_id' => @trace_id, 'span_id' => @span_id, 'trace_flags' => @trace_flags, 'resource.service.name' => @service_name} : {}
|
103
102
|
end
|
104
103
|
|
105
104
|
private
|
data/lib/solarwinds_apm/base.rb
CHANGED
@@ -11,18 +11,6 @@ module SolarWindsAPMBase
|
|
11
11
|
extend SolarWindsAPM::ThreadLocal
|
12
12
|
|
13
13
|
attr_accessor :reporter, :loaded
|
14
|
-
|
15
|
-
##
|
16
|
-
# Determines if we are running under a forking webserver
|
17
|
-
#
|
18
|
-
def forking_webserver?
|
19
|
-
if (defined?(::Unicorn) && ($PROGRAM_NAME =~ /unicorn/i)) ||
|
20
|
-
(defined?(::Puma) && ($PROGRAM_NAME =~ /puma/i))
|
21
|
-
true
|
22
|
-
else
|
23
|
-
false
|
24
|
-
end
|
25
|
-
end
|
26
14
|
end
|
27
15
|
|
28
16
|
module SolarWindsAPM
|
@@ -12,6 +12,15 @@ module SolarWindsAPM
|
|
12
12
|
# Use SolarWindsAPM::Config.show to view the entire nested hash.
|
13
13
|
#
|
14
14
|
module Config
|
15
|
+
LOGGER_LEVEL_MAPPING = {-1 => ::Logger::FATAL,
|
16
|
+
0 => ::Logger::FATAL,
|
17
|
+
1 => ::Logger::ERROR,
|
18
|
+
2 => ::Logger::WARN,
|
19
|
+
3 => ::Logger::INFO,
|
20
|
+
4 => ::Logger::DEBUG,
|
21
|
+
5 => ::Logger::DEBUG,
|
22
|
+
6 => ::Logger::DEBUG}.freeze
|
23
|
+
|
15
24
|
@@config = {}
|
16
25
|
@@instrumentation = [:action_controller, :action_controller_api, :action_view,
|
17
26
|
:active_record, :bunnyclient, :bunnyconsumer, :curb,
|
@@ -44,19 +53,20 @@ module SolarWindsAPM
|
|
44
53
|
config_files << config_file if File.exist?(config_file)
|
45
54
|
|
46
55
|
# Check for file set by env variable
|
47
|
-
config_files <<
|
56
|
+
config_files << config_file_from_env if ENV.has_key?('SW_APM_CONFIG_RUBY')
|
48
57
|
|
49
58
|
# Check for default config file
|
50
59
|
config_file = File.join(Dir.pwd, 'solarwinds_apm_config.rb')
|
51
60
|
config_files << config_file if File.exist?(config_file)
|
52
61
|
|
62
|
+
SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] Available config_files: #{config_files.join(', ')}" }
|
53
63
|
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Multiple configuration files configured, using the first one listed: #{config_files.join(', ')}"} if config_files.size > 1
|
54
64
|
load(config_files[0]) if config_files.size > 0
|
55
65
|
|
56
66
|
set_log_level # sets SolarWindsAPM::Config[:debug_level], SolarWindsAPM.logger.level
|
57
67
|
end
|
58
68
|
|
59
|
-
def self.
|
69
|
+
def self.config_file_from_env
|
60
70
|
if File.exist?(ENV['SW_APM_CONFIG_RUBY']) && !File.directory?(ENV['SW_APM_CONFIG_RUBY'])
|
61
71
|
config_file = ENV['SW_APM_CONFIG_RUBY']
|
62
72
|
elsif File.exist?(File.join(ENV['SW_APM_CONFIG_RUBY'], 'solarwinds_apm_config.rb'))
|
@@ -68,11 +78,40 @@ module SolarWindsAPM
|
|
68
78
|
end
|
69
79
|
|
70
80
|
def self.set_log_level
|
71
|
-
|
81
|
+
log_level = (ENV['SW_APM_DEBUG_LEVEL'] || SolarWindsAPM::Config[:debug_level] || 3).to_i
|
82
|
+
|
83
|
+
SolarWindsAPM.logger = ::Logger.new(nil) if log_level == -1
|
84
|
+
|
85
|
+
SolarWindsAPM.logger.level = LOGGER_LEVEL_MAPPING[log_level] || ::Logger::INFO # default log level info
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.enable_disable_config(env_var, key, value, default, bool: false)
|
89
|
+
env_value = ENV[env_var.to_s]&.downcase
|
90
|
+
valid_env_values = bool ? %w[true false] : %w[enabled disabled]
|
91
|
+
|
92
|
+
if env_var && valid_env_values.include?(env_value)
|
93
|
+
value = bool ? true?(env_value) : env_value.to_sym
|
94
|
+
elsif env_var && !env_value.to_s.empty?
|
95
|
+
SolarWindsAPM.logger.warn("[#{name}/#{__method__}] #{env_var} must be #{valid_env_values.join('/')} (current setting is #{ENV[env_var]}). Using default value: #{default}.")
|
96
|
+
return @@config[key.to_sym] = default
|
97
|
+
end
|
98
|
+
|
99
|
+
return @@config[key.to_sym] = value unless (bool && !boolean?(value)) || (!bool && !symbol?(value))
|
72
100
|
|
73
|
-
#
|
74
|
-
|
75
|
-
|
101
|
+
SolarWindsAPM.logger.warn("[#{name}/#{__method__}] :#{key} must be a #{valid_env_values.join('/')}. Using default value: #{default}.")
|
102
|
+
@@config[key.to_sym] = default
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.true?(obj)
|
106
|
+
obj.to_s.casecmp("true").zero?
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.boolean?(obj)
|
110
|
+
[true, false].include?(obj)
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.symbol?(obj)
|
114
|
+
[:enabled, :disabled].include?(obj)
|
76
115
|
end
|
77
116
|
|
78
117
|
##
|
@@ -93,8 +132,9 @@ module SolarWindsAPM
|
|
93
132
|
#
|
94
133
|
# Initializer method to set everything up with a default configuration.
|
95
134
|
# The defaults are read from the template configuration file.
|
135
|
+
# This will be called when require 'solarwinds_apm/config' happen
|
96
136
|
#
|
97
|
-
def self.initialize
|
137
|
+
def self.initialize
|
98
138
|
# for config file backward compatibility
|
99
139
|
@@instrumentation.each {|inst| @@config[inst] = {}}
|
100
140
|
@@config[:transaction_name] = {}
|
@@ -123,6 +163,7 @@ module SolarWindsAPM
|
|
123
163
|
#
|
124
164
|
# Config variable assignment method. Here we validate and store the
|
125
165
|
# assigned value(s) and trigger any secondary action needed.
|
166
|
+
# ENV always have higher precedence
|
126
167
|
#
|
127
168
|
def self.[]=(key, value)
|
128
169
|
key = key.to_sym
|
@@ -151,17 +192,14 @@ module SolarWindsAPM
|
|
151
192
|
when :transaction_settings
|
152
193
|
compile_settings(value)
|
153
194
|
|
195
|
+
when :trigger_tracing_mode
|
196
|
+
enable_disable_config('SW_APM_TRIGGER_TRACING_MODE', key, value, :enabled)
|
197
|
+
|
154
198
|
when :tracing_mode
|
155
|
-
|
156
|
-
# Make sure that the mode is stored as a symbol
|
157
|
-
@@config[key.to_sym] = value.to_sym
|
199
|
+
enable_disable_config(nil, key, value, :enabled)
|
158
200
|
|
159
201
|
when :tag_sql
|
160
|
-
|
161
|
-
@@config[key.to_sym] = (ENV['SW_APM_TAG_SQL'] == 'true')
|
162
|
-
else
|
163
|
-
@@config[key.to_sym] = value
|
164
|
-
end
|
202
|
+
enable_disable_config('SW_APM_TAG_SQL', key, value, false, bool: true)
|
165
203
|
|
166
204
|
else
|
167
205
|
@@config[key.to_sym] = value
|
@@ -21,7 +21,7 @@ module SolarWindsAPM
|
|
21
21
|
@debug_level = (ENV['SW_APM_DEBUG_LEVEL'] || SolarWindsAPM::Config[:debug_level] || 3).to_i
|
22
22
|
# file name including path for log file
|
23
23
|
# TODO eventually find better way to combine ruby and oboe logs
|
24
|
-
@log_file_path = ENV['
|
24
|
+
@log_file_path = ENV['SW_APM_LOG_FILEPATH'] || ''
|
25
25
|
# maximum number of transaction names to track
|
26
26
|
@max_transactions = (ENV['SW_APM_MAX_TRANSACTIONS'] || -1).to_i
|
27
27
|
# maximum wait time for flushing data before terminating in milli seconds
|
@@ -50,7 +50,7 @@ module SolarWindsAPM
|
|
50
50
|
# custom token bucket rate
|
51
51
|
@token_bucket_rate = (ENV['SW_APM_TOKEN_BUCKET_RATE'] || -1).to_i
|
52
52
|
# use single files in file reporter for each event
|
53
|
-
@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
|
54
54
|
# timeout for ec2 metadata
|
55
55
|
@ec2_md_timeout = read_and_validate_ec2_md_timeout
|
56
56
|
@grpc_proxy = read_and_validate_proxy
|
@@ -59,6 +59,8 @@ module SolarWindsAPM
|
|
59
59
|
# hardcoded arg for trace id format to use w3c format
|
60
60
|
# flag for format of metric (0 = Both; 1 = AppOptics only; 2 = SWO only; default = 0)
|
61
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
|
62
64
|
end
|
63
65
|
|
64
66
|
# for testing with changed ENV vars
|
@@ -75,7 +77,6 @@ module SolarWindsAPM
|
|
75
77
|
@max_flush_wait_time, # 4
|
76
78
|
@events_flush_interval, # 5
|
77
79
|
@event_flush_batch_size, # 6
|
78
|
-
|
79
80
|
@reporter, # 7
|
80
81
|
@host, # 8
|
81
82
|
@service_key, # 9
|
@@ -89,7 +90,8 @@ module SolarWindsAPM
|
|
89
90
|
@ec2_md_timeout, #17
|
90
91
|
@grpc_proxy, #18
|
91
92
|
0, #19 arg for lambda (no lambda for ruby yet)
|
92
|
-
@metric_format
|
93
|
+
@metric_format, #20
|
94
|
+
@log_type #21
|
93
95
|
]
|
94
96
|
end
|
95
97
|
|
@@ -170,8 +172,9 @@ module SolarWindsAPM
|
|
170
172
|
"#{token}:#{service_name}"
|
171
173
|
end
|
172
174
|
|
175
|
+
# In case of java-collector, please provide a dummy service key
|
173
176
|
def validate_token(token)
|
174
|
-
|
177
|
+
unless /^[0-9a-zA-Z_-]{71}$/.match?(token)
|
175
178
|
masked = "#{token[0..3]}...#{token[-4..]}"
|
176
179
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. API Token in wrong format. Masked token: #{masked}"}
|
177
180
|
return false
|
@@ -181,20 +184,19 @@ module SolarWindsAPM
|
|
181
184
|
end
|
182
185
|
|
183
186
|
def validate_transform_service_name(service_name)
|
184
|
-
service_name = 'test_ssl_collector' if ENV['SW_APM_COLLECTOR'] =~ /java-collector:1222/
|
185
187
|
if service_name.empty?
|
186
188
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. Service Name is missing"}
|
187
189
|
return false
|
188
190
|
end
|
189
191
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
192
|
+
name_ = service_name.dup
|
193
|
+
name_.downcase!
|
194
|
+
name_.gsub!(/[^a-z0-9.:_-]/, '')
|
195
|
+
name_ = name_[0..254]
|
194
196
|
|
195
|
-
if
|
196
|
-
SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. Service Name transformed from #{service_name} to #{
|
197
|
-
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_
|
198
200
|
end
|
199
201
|
@service_name = service_name # instance variable used in testing
|
200
202
|
true
|
@@ -212,7 +214,7 @@ module SolarWindsAPM
|
|
212
214
|
proxy = ENV['SW_APM_PROXY'] || SolarWindsAPM::Config[:http_proxy] || ''
|
213
215
|
return proxy if proxy == ''
|
214
216
|
|
215
|
-
unless
|
217
|
+
unless /http:\/\/.*:\d+$/.match?(proxy)
|
216
218
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_PROXY/http_proxy doesn't start with 'http://', #{proxy}"}
|
217
219
|
return '' # try without proxy, it may work, shouldn't crash but may not report
|
218
220
|
end
|
@@ -221,14 +223,15 @@ module SolarWindsAPM
|
|
221
223
|
end
|
222
224
|
|
223
225
|
def read_certificates
|
226
|
+
certificate = ''
|
227
|
+
|
224
228
|
file = appoptics_collector?? "#{__dir__}/cert/star.appoptics.com.issuer.crt" : ENV['SW_APM_TRUSTEDPATH']
|
225
|
-
return
|
229
|
+
return certificate if file.nil? || file&.empty?
|
226
230
|
|
227
231
|
begin
|
228
232
|
certificate = File.open(file,"r").read
|
229
233
|
rescue StandardError => e
|
230
234
|
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] certificates: #{file} doesn't exist or caused by #{e.message}."}
|
231
|
-
certificate = String.new
|
232
235
|
end
|
233
236
|
|
234
237
|
certificate
|
@@ -256,5 +259,12 @@ module SolarWindsAPM
|
|
256
259
|
end
|
257
260
|
""
|
258
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
|
259
269
|
end
|
260
270
|
end
|
@@ -133,7 +133,7 @@ module SolarWindsAPM
|
|
133
133
|
# helper function that extract gem library version for func add_instrumented_framework
|
134
134
|
def check_framework_version(framework)
|
135
135
|
framework_version = nil
|
136
|
-
if @version_cache.
|
136
|
+
if @version_cache.has_key?(framework)
|
137
137
|
|
138
138
|
framework_version = @version_cache[framework]
|
139
139
|
else
|
@@ -131,7 +131,7 @@ module SolarWindsAPM
|
|
131
131
|
|
132
132
|
# This span from inbound HTTP request if from a SERVER by some http.method
|
133
133
|
def span_http?(span)
|
134
|
-
|
134
|
+
span.kind == ::OpenTelemetry::Trace::SpanKind::SERVER && !span.attributes[HTTP_METHOD].nil?
|
135
135
|
end
|
136
136
|
|
137
137
|
# Calculate if this span instance has_error
|
@@ -272,7 +272,8 @@ module SolarWindsAPM
|
|
272
272
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] trace_state_no_response #{trace_state_no_response.inspect}"}
|
273
273
|
|
274
274
|
trace_state_no_response = parent_span_context.tracestate.delete(XTraceOptions.sw_xtraceoptions_response_key)
|
275
|
-
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
|
+
|
276
277
|
new_attributes[SW_TRACESTATE_CAPTURE_KEY] = Utils.trace_state_header(trace_state_no_response) if no_sw_count > 0
|
277
278
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] new_attributes after add_tracestate_capture_to_new_attributes: #{new_attributes.inspect}"}
|
278
279
|
|
@@ -29,20 +29,12 @@ module SolarWindsAPM
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.resolve_sampler
|
32
|
-
|
33
|
-
resolve_sampler_config
|
32
|
+
sampler_config = {"trigger_trace" => SolarWindsAPM::Config[:trigger_tracing_mode]}
|
34
33
|
@@config[:sampler] =
|
35
34
|
::OpenTelemetry::SDK::Trace::Samplers.parent_based(
|
36
|
-
root: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(
|
37
|
-
remote_parent_sampled: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(
|
38
|
-
remote_parent_not_sampled: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.resolve_sampler_config
|
42
|
-
sampler_config = {}
|
43
|
-
sampler_config["trigger_trace"] = "enabled"
|
44
|
-
sampler_config["trigger_trace"] = nil if ENV["SW_APM_TRIGGER_TRACING_MODE"] == 'disabled'
|
45
|
-
@@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))
|
46
38
|
end
|
47
39
|
|
48
40
|
#
|
@@ -65,20 +57,6 @@ module SolarWindsAPM
|
|
65
57
|
end
|
66
58
|
end
|
67
59
|
|
68
|
-
def self.obfuscate_helper(instrumentation)
|
69
|
-
if @@config_map[instrumentation] # user provided the option
|
70
|
-
@@config_map[instrumentation][:db_statement] = :obfuscate unless @@config_map[instrumentation][:db_statement] # user provided the db_statement, ignore our default setting
|
71
|
-
else
|
72
|
-
@@config_map[instrumentation] = {db_statement: :obfuscate}
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def self.obfuscate_query
|
77
|
-
obfuscate_helper("OpenTelemetry::Instrumentation::Dalli")
|
78
|
-
obfuscate_helper("OpenTelemetry::Instrumentation::Mysql2")
|
79
|
-
obfuscate_helper("OpenTelemetry::Instrumentation::PG")
|
80
|
-
end
|
81
|
-
|
82
60
|
def self.[](key)
|
83
61
|
@@config[key.to_sym]
|
84
62
|
end
|
@@ -132,13 +110,18 @@ module SolarWindsAPM
|
|
132
110
|
resolve_solarwinds_processor
|
133
111
|
resolve_response_propagator
|
134
112
|
|
135
|
-
obfuscate_query
|
136
|
-
|
137
113
|
print_config if SolarWindsAPM.logger.level.zero?
|
138
114
|
|
139
115
|
ENV['OTEL_TRACES_EXPORTER'] = 'none' if ENV['OTEL_TRACES_EXPORTER'].to_s.empty?
|
140
116
|
|
141
|
-
|
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
|
142
125
|
|
143
126
|
validate_propagator(::OpenTelemetry.propagation.instance_variable_get(:@propagators))
|
144
127
|
|
@@ -17,15 +17,15 @@ module SolarWindsAPM
|
|
17
17
|
|
18
18
|
def self.get_oboe_trace_mode(tracing_mode)
|
19
19
|
mode = OBOE_SETTINGS_UNSET
|
20
|
-
mode = OBOE_TRACE_ENABLED if tracing_mode ==
|
21
|
-
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
|
22
22
|
mode
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.get_oboe_trigger_trace_mode(trigger_trace_mode)
|
26
26
|
mode = OBOE_SETTINGS_UNSET
|
27
|
-
mode = OBOE_TRIGGER_ENABLED if trigger_trace_mode ==
|
28
|
-
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
|
29
29
|
mode
|
30
30
|
end
|
31
31
|
end
|
@@ -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
|
@@ -21,15 +21,11 @@ module SolarWindsAPM
|
|
21
21
|
# calculate trace mode to set either 1 or 0 based on url_path and name+kind
|
22
22
|
# first check if url_path match, if not match, then match the name+kind
|
23
23
|
def calculate_trace_mode
|
24
|
-
|
24
|
+
SolarWindsAPM::Config[:tracing_mode] == :enabled && tracing_enabled? ? SWO_TRACING_ENABLED : SWO_TRACING_DISABLED
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
def tracing_mode_enabled?
|
30
|
-
SolarWindsAPM::Config[:tracing_mode] && ![:disabled, :never].include?(SolarWindsAPM::Config[:tracing_mode])
|
31
|
-
end
|
32
|
-
|
33
29
|
def tracing_enabled?
|
34
30
|
span_layer = "#{@kind}:#{@name}"
|
35
31
|
|
@@ -12,7 +12,7 @@ module SolarWindsAPM
|
|
12
12
|
MAJOR = 6 # breaking,
|
13
13
|
MINOR = 0 # feature,
|
14
14
|
PATCH = 0 # fix => BFF
|
15
|
-
PRE = '
|
15
|
+
PRE = 'prev6'.freeze
|
16
16
|
|
17
17
|
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
|
18
18
|
end
|
data/lib/solarwinds_apm.rb
CHANGED
@@ -22,7 +22,7 @@ begin
|
|
22
22
|
SolarWindsAPM::Config.load_config_file
|
23
23
|
SolarWindsAPM.loaded = false
|
24
24
|
begin
|
25
|
-
if
|
25
|
+
if /linux/.match?(RUBY_PLATFORM)
|
26
26
|
require_relative './libsolarwinds_apm.so'
|
27
27
|
require 'solarwinds_apm/oboe_init_options'
|
28
28
|
require_relative './oboe_metal' # initialize Reporter; sets SolarWindsAPM.loaded = true if successful
|
@@ -44,12 +44,6 @@ begin
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
# Auto-start the Reporter unless we are running Unicorn on Heroku
|
48
|
-
# In that case, we start the reporters after fork
|
49
|
-
unless SolarWindsAPM.forking_webserver?
|
50
|
-
SolarWindsAPM::Reporter.start if SolarWindsAPM.loaded
|
51
|
-
end
|
52
|
-
|
53
47
|
if SolarWindsAPM.loaded
|
54
48
|
require 'solarwinds_apm/support'
|
55
49
|
require 'solarwinds_apm/opentelemetry'
|
@@ -64,6 +58,7 @@ begin
|
|
64
58
|
SolarWindsAPM::OTelConfig.initialize
|
65
59
|
end
|
66
60
|
|
61
|
+
SolarWindsAPM::Reporter.start
|
67
62
|
else
|
68
63
|
SolarWindsAPM.logger.warn '=============================================================='
|
69
64
|
SolarWindsAPM.logger.warn 'SolarWindsAPM not loaded. Tracing disabled.'
|
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.prev6
|
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:
|
14
|
+
date: 2024-01-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: opentelemetry-sdk
|
@@ -145,6 +145,7 @@ metadata:
|
|
145
145
|
documentation_uri: https://documentation.solarwinds.com/en/success_center/observability/default.htm#cshid=config-ruby-agent
|
146
146
|
homepage_uri: https://documentation.solarwinds.com/en/success_center/observability/content/intro/landing-page.html
|
147
147
|
source_code_uri: https://github.com/solarwinds/apm-ruby
|
148
|
+
github_repo: https://github.com/solarwinds/apm-ruby.git
|
148
149
|
post_install_message:
|
149
150
|
rdoc_options: []
|
150
151
|
require_paths:
|