solarwinds_apm 6.0.0.prev6 → 6.0.0
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 +1 -1
- data/lib/oboe_metal.rb +23 -64
- data/lib/solarwinds_apm/api/opentelemetry.rb +2 -2
- data/lib/solarwinds_apm/api/tracing.rb +1 -1
- data/lib/solarwinds_apm/api.rb +1 -1
- data/lib/solarwinds_apm/config.rb +12 -11
- data/lib/solarwinds_apm/constants.rb +5 -7
- data/lib/solarwinds_apm/noop/README.md +1 -1
- data/lib/solarwinds_apm/noop/api.rb +83 -0
- data/lib/solarwinds_apm/noop/context.rb +13 -2
- data/lib/solarwinds_apm/noop/metadata.rb +5 -2
- data/lib/solarwinds_apm/{base.rb → noop/span.rb} +14 -15
- data/lib/solarwinds_apm/noop.rb +31 -0
- data/lib/solarwinds_apm/oboe_init_options.rb +6 -75
- data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +1 -1
- data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +2 -2
- data/lib/solarwinds_apm/opentelemetry.rb +1 -1
- data/lib/solarwinds_apm/otel_config.rb +10 -22
- data/lib/solarwinds_apm/patch/dummy_patch.rb +12 -0
- data/lib/solarwinds_apm/{thread_local.rb → patch.rb} +4 -22
- data/lib/solarwinds_apm/support/oboe_tracing_mode.rb +20 -22
- data/lib/solarwinds_apm/support/service_key_checker.rb +94 -0
- data/lib/solarwinds_apm/{support_report.rb → support/support_report.rb} +11 -8
- data/lib/solarwinds_apm/support.rb +1 -0
- data/lib/solarwinds_apm/version.rb +1 -1
- data/lib/solarwinds_apm.rb +69 -49
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dfd38bd4d4e3d70c56b86ffd34d9fe830e0944eb3fd02a82bff26da07900056
|
4
|
+
data.tar.gz: 1ec9662543689c97af6509f2db2bde6e62bd9274fd2b792925d4ebf9fd46c4fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c90b9be36843bf092833fafc3fc16e6f97cf293787fd9551375b39a67c8f057b737c11145764eb47590b060bc22a60c367911bf8e31b3b5718452ad8b0e50234
|
7
|
+
data.tar.gz: 29e352eb73da5c09fc0caf35e73e65facb842d7becab500e0183071ec4aaa563daf0ae2bd483972f0ef2e5b51a780821b0075b432d2a86892e82eedc8c4f71ad
|
data/ext/oboe_metal/extconf.rb
CHANGED
data/lib/oboe_metal.rb
CHANGED
@@ -7,9 +7,22 @@
|
|
7
7
|
# Disable docs and Camelcase warns since we're implementing
|
8
8
|
# an interface here. See OboeBase for details.
|
9
9
|
module SolarWindsAPM
|
10
|
-
extend SolarWindsAPMBase
|
11
10
|
include Oboe_metal
|
12
11
|
|
12
|
+
@loaded = false
|
13
|
+
@reporter = nil
|
14
|
+
|
15
|
+
class << self
|
16
|
+
attr_accessor :reporter, :loaded
|
17
|
+
|
18
|
+
def sample_rate(rate)
|
19
|
+
return unless SolarWindsAPM.loaded
|
20
|
+
|
21
|
+
# Update liboboe with the new SampleRate value
|
22
|
+
SolarWindsAPM::Context.setDefaultSampleRate(rate.to_i)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
13
26
|
# Reporter that send span data to SWO
|
14
27
|
class Reporter
|
15
28
|
class << self
|
@@ -19,18 +32,14 @@ module SolarWindsAPM
|
|
19
32
|
# Start the SolarWindsAPM Reporter
|
20
33
|
#
|
21
34
|
def start
|
22
|
-
SolarWindsAPM.loaded = false unless SolarWindsAPM::OboeInitOptions.instance.service_key_ok?
|
23
|
-
return unless SolarWindsAPM.loaded
|
24
|
-
|
25
35
|
begin
|
26
36
|
options = SolarWindsAPM::OboeInitOptions.instance.array_for_oboe # creates an array with the options in the right order
|
27
|
-
|
28
37
|
SolarWindsAPM.reporter = Oboe_metal::Reporter.new(*options)
|
29
|
-
|
30
38
|
report_init
|
39
|
+
SolarWindsAPM.loaded = true
|
31
40
|
rescue StandardError=> e
|
32
41
|
$stderr.puts e.message
|
33
|
-
|
42
|
+
SolarWindsAPM.loaded = false
|
34
43
|
end
|
35
44
|
end
|
36
45
|
alias :restart :start
|
@@ -53,52 +62,6 @@ module SolarWindsAPM
|
|
53
62
|
SolarWindsAPM.reporter.sendStatus(evt, context, with_system_timestamp)
|
54
63
|
end
|
55
64
|
|
56
|
-
##
|
57
|
-
# clear_all_traces
|
58
|
-
#
|
59
|
-
# Truncates the trace output file to zero
|
60
|
-
#
|
61
|
-
def clear_all_traces
|
62
|
-
File.truncate(SolarWindsAPM::OboeInitOptions.instance.host, 0)
|
63
|
-
end
|
64
|
-
|
65
|
-
##
|
66
|
-
# obtain_all_traces
|
67
|
-
#
|
68
|
-
# Retrieves all traces written to the trace file
|
69
|
-
#
|
70
|
-
def obtain_all_traces
|
71
|
-
io = File.open(SolarWindsAPM::OboeInitOptions.instance.host, 'r')
|
72
|
-
contents = io.readlines(nil)
|
73
|
-
io.close
|
74
|
-
|
75
|
-
return contents if contents.empty?
|
76
|
-
|
77
|
-
traces = []
|
78
|
-
|
79
|
-
# We use Gem.loaded_spec because older versions of the bson
|
80
|
-
# gem didn't even have a version embedded in the gem. If the
|
81
|
-
# gem isn't in the bundle, it should rightfully error out
|
82
|
-
# anyways.
|
83
|
-
#
|
84
|
-
if Gem.loaded_specs['bson'] && Gem.loaded_specs['bson'].version.to_s < '4.0'
|
85
|
-
s = StringIO.new(contents[0])
|
86
|
-
|
87
|
-
until s.eof?
|
88
|
-
traces << if ::BSON.respond_to? :read_bson_document
|
89
|
-
BSON.read_bson_document(s)
|
90
|
-
else
|
91
|
-
BSON::Document.from_bson(s)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
else
|
95
|
-
bbb = ::BSON::ByteBuffer.new(contents[0])
|
96
|
-
traces << Hash.from_bson(bbb) until bbb.length == 0
|
97
|
-
end
|
98
|
-
|
99
|
-
traces
|
100
|
-
end
|
101
|
-
|
102
65
|
private
|
103
66
|
|
104
67
|
# Internal: Report that instrumentation for the given layer has been
|
@@ -205,16 +168,12 @@ module SolarWindsAPM
|
|
205
168
|
end
|
206
169
|
end
|
207
170
|
end
|
208
|
-
|
209
|
-
class << self
|
210
|
-
def sample_rate(rate)
|
211
|
-
return unless SolarWindsAPM.loaded
|
212
|
-
|
213
|
-
# Update liboboe with the new SampleRate value
|
214
|
-
SolarWindsAPM::Context.setDefaultSampleRate(rate.to_i)
|
215
|
-
end
|
216
|
-
end
|
217
171
|
end
|
218
172
|
|
219
|
-
|
220
|
-
|
173
|
+
# rubocop:enable Style/Documentation
|
174
|
+
|
175
|
+
# Setup an alias
|
176
|
+
SolarWindsApm = SolarWindsAPM
|
177
|
+
SolarwindsApm = SolarWindsAPM
|
178
|
+
SolarwindsAPM = SolarWindsAPM
|
179
|
+
Solarwindsapm = SolarWindsAPM
|
@@ -28,7 +28,7 @@ module SolarWindsAPM
|
|
28
28
|
# end
|
29
29
|
#
|
30
30
|
# === Returns:
|
31
|
-
# *
|
31
|
+
# * value returned by block
|
32
32
|
#
|
33
33
|
def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, &block)
|
34
34
|
if block.nil?
|
@@ -42,4 +42,4 @@ module SolarWindsAPM
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
|
-
end
|
45
|
+
end
|
data/lib/solarwinds_apm/api.rb
CHANGED
@@ -12,14 +12,14 @@ module SolarWindsAPM
|
|
12
12
|
# Use SolarWindsAPM::Config.show to view the entire nested hash.
|
13
13
|
#
|
14
14
|
module Config
|
15
|
-
|
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
|
15
|
+
SW_LOG_LEVEL_MAPPING = {-1 => {:stdlib => ::Logger::FATAL, :otel => 'fatal'},
|
16
|
+
0 => {:stdlib => ::Logger::FATAL, :otel => 'fatal'},
|
17
|
+
1 => {:stdlib => ::Logger::ERROR, :otel => 'error'},
|
18
|
+
2 => {:stdlib => ::Logger::WARN, :otel => 'warn'},
|
19
|
+
3 => {:stdlib => ::Logger::INFO, :otel => 'info'},
|
20
|
+
4 => {:stdlib => ::Logger::DEBUG, :otel => 'debug'},
|
21
|
+
5 => {:stdlib => ::Logger::DEBUG, :otel => 'debug'},
|
22
|
+
6 => {:stdlib => ::Logger::DEBUG, :otel => 'debug'}}.freeze
|
23
23
|
|
24
24
|
@@config = {}
|
25
25
|
@@instrumentation = [:action_controller, :action_controller_api, :action_view,
|
@@ -82,7 +82,7 @@ module SolarWindsAPM
|
|
82
82
|
|
83
83
|
SolarWindsAPM.logger = ::Logger.new(nil) if log_level == -1
|
84
84
|
|
85
|
-
SolarWindsAPM.logger.level =
|
85
|
+
SolarWindsAPM.logger.level = SW_LOG_LEVEL_MAPPING.dig(log_level, :stdlib) || ::Logger::INFO # default log level info
|
86
86
|
end
|
87
87
|
|
88
88
|
def self.enable_disable_config(env_var, key, value, default, bool: false)
|
@@ -121,10 +121,11 @@ module SolarWindsAPM
|
|
121
121
|
# to create an output similar to the content of the config file
|
122
122
|
#
|
123
123
|
def self.print_config
|
124
|
-
SolarWindsAPM.logger.
|
124
|
+
SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] General configurations list blow:"}
|
125
125
|
@@config.each do |k,v|
|
126
|
-
SolarWindsAPM.logger.
|
126
|
+
SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] Config Key/Value: #{k}, #{v.inspect}"} unless @@instrumentation.include?(k)
|
127
127
|
end
|
128
|
+
nil
|
128
129
|
end
|
129
130
|
|
130
131
|
##
|
@@ -7,11 +7,10 @@
|
|
7
7
|
module SolarWindsAPM
|
8
8
|
# Constants
|
9
9
|
module Constants
|
10
|
-
HTTP_METHOD
|
11
|
-
HTTP_ROUTE
|
12
|
-
HTTP_STATUS_CODE
|
13
|
-
HTTP_URL
|
14
|
-
|
10
|
+
HTTP_METHOD = "http.method".freeze
|
11
|
+
HTTP_ROUTE = "http.route".freeze
|
12
|
+
HTTP_STATUS_CODE = "http.status_code".freeze
|
13
|
+
HTTP_URL = "http.url".freeze
|
15
14
|
INTL_SWO_AO_COLLECTOR = "collector.appoptics.com".freeze
|
16
15
|
INTL_SWO_AO_STG_COLLECTOR = "collector-stg.appoptics.com".freeze
|
17
16
|
INTL_SWO_COMMA = ",".freeze
|
@@ -30,7 +29,6 @@ module SolarWindsAPM
|
|
30
29
|
INTL_SWO_OTEL_SCOPE_VERSION = "otel.scope.version".freeze
|
31
30
|
INTL_SWO_OTEL_STATUS = "otel.status".freeze
|
32
31
|
INTL_SWO_OTEL_STATUS_DESCRIPTION = "otel.status_description".freeze
|
33
|
-
|
34
32
|
INTERNAL_TRIGGERED_TRACE = "TriggeredTrace".freeze
|
35
33
|
end
|
36
|
-
end
|
34
|
+
end
|
@@ -0,0 +1,83 @@
|
|
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
|
+
|
7
|
+
####
|
8
|
+
# noop version of SolarWindsAPM::API
|
9
|
+
#
|
10
|
+
module SolarWindsAPM
|
11
|
+
# API
|
12
|
+
module API
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module NoopAPI
|
17
|
+
# Tracing
|
18
|
+
module Tracing
|
19
|
+
# (wait_milliseconds=3000, integer_response: false)
|
20
|
+
def solarwinds_ready?(*_args, **options)
|
21
|
+
options && options[:integer_response] ? 0 : false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# CurrentTraceInfo
|
26
|
+
module CurrentTraceInfo
|
27
|
+
def current_trace_info
|
28
|
+
TraceInfo.new
|
29
|
+
end
|
30
|
+
|
31
|
+
class TraceInfo
|
32
|
+
attr_reader :tracestring, :trace_id, :span_id, :trace_flags, :do_log
|
33
|
+
|
34
|
+
def initialize
|
35
|
+
@trace_id = '00000000000000000000000000000000'
|
36
|
+
@span_id = '0000000000000000'
|
37
|
+
@trace_flags = '00'
|
38
|
+
@tracestring = '00-00000000000000000000000000000000-0000000000000000-00'
|
39
|
+
@service_name = ''
|
40
|
+
@do_log = :never
|
41
|
+
end
|
42
|
+
|
43
|
+
def for_log
|
44
|
+
''
|
45
|
+
end
|
46
|
+
|
47
|
+
def hash_for_log
|
48
|
+
{}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# CustomMetrics
|
54
|
+
module CustomMetrics
|
55
|
+
def increment_metric(*)
|
56
|
+
false
|
57
|
+
end
|
58
|
+
|
59
|
+
def summary_metric(*)
|
60
|
+
false
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# OpenTelemetry
|
65
|
+
module OpenTelemetry
|
66
|
+
def in_span(*)
|
67
|
+
yield if block_given?
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# TransactionName
|
72
|
+
module TransactionName
|
73
|
+
def set_transaction_name(*)
|
74
|
+
true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
SolarWindsAPM::API.extend(NoopAPI::Tracing)
|
80
|
+
SolarWindsAPM::API.extend(NoopAPI::CurrentTraceInfo)
|
81
|
+
SolarWindsAPM::API.extend(NoopAPI::CustomMetrics)
|
82
|
+
SolarWindsAPM::API.extend(NoopAPI::OpenTelemetry)
|
83
|
+
SolarWindsAPM::API.extend(NoopAPI::TransactionName)
|
@@ -7,9 +7,12 @@
|
|
7
7
|
####
|
8
8
|
# noop version of SolarWindsAPM::Context
|
9
9
|
#
|
10
|
-
module SolarWindsAPM
|
10
|
+
# module SolarWindsAPM
|
11
|
+
# end
|
12
|
+
|
13
|
+
module Oboe_metal # rubocop:disable Naming/ClassAndModuleCamelCase
|
11
14
|
# Context for noop
|
12
|
-
|
15
|
+
class Context
|
13
16
|
##
|
14
17
|
# noop version of :toString
|
15
18
|
# toString would return the current trace context as string
|
@@ -18,6 +21,14 @@ module SolarWindsAPM
|
|
18
21
|
'99-00000000000000000000000000000000-0000000000000000-00'
|
19
22
|
end
|
20
23
|
|
24
|
+
def self.isReady(*)
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.getDecisions(*)
|
29
|
+
[-1, -1, -1, 0, 0.0, 0.0, -1, -1, '', '', 4]
|
30
|
+
end
|
31
|
+
|
21
32
|
##
|
22
33
|
# noop version of :clear
|
23
34
|
#
|
@@ -7,8 +7,7 @@
|
|
7
7
|
####
|
8
8
|
# noop version of SolarWindsAPM::Metadata
|
9
9
|
#
|
10
|
-
#
|
11
|
-
module SolarWindsAPM
|
10
|
+
module Oboe_metal # rubocop:disable Naming/ClassAndModuleCamelCase
|
12
11
|
# Metadata
|
13
12
|
class Metadata
|
14
13
|
##
|
@@ -20,6 +19,10 @@ module SolarWindsAPM
|
|
20
19
|
Metadata.new
|
21
20
|
end
|
22
21
|
|
22
|
+
def self.fromString(*)
|
23
|
+
Metadata.new
|
24
|
+
end
|
25
|
+
|
23
26
|
def isValid
|
24
27
|
false
|
25
28
|
end
|
@@ -4,21 +4,20 @@
|
|
4
4
|
#
|
5
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
6
|
|
7
|
-
|
8
|
-
#
|
7
|
+
####
|
8
|
+
# noop version of SolarWindsAPM::Span
|
9
9
|
#
|
10
|
-
module
|
11
|
-
|
10
|
+
module Oboe_metal # rubocop:disable Naming/ClassAndModuleCamelCase
|
11
|
+
# Span
|
12
|
+
class Span
|
13
|
+
##
|
14
|
+
# noop version of :createHttpSpan
|
15
|
+
#
|
16
|
+
def self.createHttpSpan(*); end
|
12
17
|
|
13
|
-
|
18
|
+
##
|
19
|
+
# noop version of :createSpan
|
20
|
+
#
|
21
|
+
def self.createSpan(*); end
|
22
|
+
end
|
14
23
|
end
|
15
|
-
|
16
|
-
module SolarWindsAPM
|
17
|
-
extend SolarWindsAPMBase
|
18
|
-
end
|
19
|
-
|
20
|
-
# Setup an alias
|
21
|
-
SolarWindsApm = SolarWindsAPM
|
22
|
-
SolarwindsApm = SolarWindsAPM
|
23
|
-
SolarwindsAPM = SolarWindsAPM
|
24
|
-
Solarwindsapm = SolarWindsAPM
|
@@ -0,0 +1,31 @@
|
|
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
|
+
|
7
|
+
require_relative './noop/context'
|
8
|
+
require_relative './noop/metadata'
|
9
|
+
require_relative './noop/span'
|
10
|
+
require_relative './noop/api'
|
11
|
+
|
12
|
+
module SolarWindsAPM
|
13
|
+
include Oboe_metal
|
14
|
+
# Reporter noop
|
15
|
+
class Reporter
|
16
|
+
##
|
17
|
+
# noop version of :send_report
|
18
|
+
#
|
19
|
+
def self.send_report(event, with_system_timestamp: false); end
|
20
|
+
|
21
|
+
##
|
22
|
+
# noop version of :send_status
|
23
|
+
#
|
24
|
+
def self.send_status(event, context=nil, with_system_timestamp: false); end
|
25
|
+
|
26
|
+
##
|
27
|
+
# noop version of :start
|
28
|
+
#
|
29
|
+
def self.start; end
|
30
|
+
end
|
31
|
+
end
|
@@ -7,6 +7,8 @@
|
|
7
7
|
require 'singleton'
|
8
8
|
require 'uri'
|
9
9
|
|
10
|
+
require_relative './support/service_key_checker'
|
11
|
+
|
10
12
|
module SolarWindsAPM
|
11
13
|
# OboeInitOptions
|
12
14
|
class OboeInitOptions
|
@@ -125,81 +127,10 @@ module SolarWindsAPM
|
|
125
127
|
end
|
126
128
|
|
127
129
|
def read_and_validate_service_key
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY not configured."}
|
133
|
-
return ''
|
134
|
-
end
|
135
|
-
|
136
|
-
match = service_key.match(/([^:]+)(:{0,1})(.*)/)
|
137
|
-
token = match[1]
|
138
|
-
service_name = match[3]
|
139
|
-
|
140
|
-
return '' unless validate_token(token) # return if token is not even valid
|
141
|
-
|
142
|
-
if service_name.empty?
|
143
|
-
ENV.delete('OTEL_SERVICE_NAME')
|
144
|
-
SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY format problem. Service Name is missing."}
|
145
|
-
return ''
|
146
|
-
end
|
147
|
-
|
148
|
-
# check OTEL_RESOURCE_ATTRIBUTES
|
149
|
-
otel_resource_service_name = nil
|
150
|
-
ENV['OTEL_RESOURCE_ATTRIBUTES']&.split(',')&.each do |pair|
|
151
|
-
key, value = pair.split('=')
|
152
|
-
if key == 'service.name'
|
153
|
-
otel_resource_service_name = value
|
154
|
-
break
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] provided otel_resource_service_name #{otel_resource_service_name}"} if otel_resource_service_name
|
159
|
-
service_name = otel_resource_service_name if otel_resource_service_name && validate_transform_service_name(otel_resource_service_name)
|
160
|
-
|
161
|
-
# check OTEL_SERVICE_NAME
|
162
|
-
otel_service_name = ENV['OTEL_SERVICE_NAME']
|
163
|
-
if otel_service_name && validate_transform_service_name(otel_service_name)
|
164
|
-
service_name = otel_service_name
|
165
|
-
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] provided otel_service_name #{otel_service_name}"}
|
166
|
-
elsif ENV['OTEL_SERVICE_NAME'].nil?
|
167
|
-
ENV['OTEL_SERVICE_NAME'] = service_name
|
168
|
-
end
|
169
|
-
|
170
|
-
return '' unless validate_transform_service_name(service_name)
|
171
|
-
|
172
|
-
"#{token}:#{service_name}"
|
173
|
-
end
|
174
|
-
|
175
|
-
# In case of java-collector, please provide a dummy service key
|
176
|
-
def validate_token(token)
|
177
|
-
unless /^[0-9a-zA-Z_-]{71}$/.match?(token)
|
178
|
-
masked = "#{token[0..3]}...#{token[-4..]}"
|
179
|
-
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. API Token in wrong format. Masked token: #{masked}"}
|
180
|
-
return false
|
181
|
-
end
|
182
|
-
|
183
|
-
true
|
184
|
-
end
|
185
|
-
|
186
|
-
def validate_transform_service_name(service_name)
|
187
|
-
if service_name.empty?
|
188
|
-
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. Service Name is missing"}
|
189
|
-
return false
|
190
|
-
end
|
191
|
-
|
192
|
-
name_ = service_name.dup
|
193
|
-
name_.downcase!
|
194
|
-
name_.gsub!(/[^a-z0-9.:_-]/, '')
|
195
|
-
name_ = name_[0..254]
|
196
|
-
|
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_
|
200
|
-
end
|
201
|
-
@service_name = service_name # instance variable used in testing
|
202
|
-
true
|
130
|
+
service_key_checker = SolarWindsAPM::ServiceKeyChecker.new(@reporter)
|
131
|
+
service_key = service_key_checker.read_and_validate_service_key
|
132
|
+
@service_name = service_key.split(':',2).last # instance variable used in testing
|
133
|
+
service_key
|
203
134
|
end
|
204
135
|
|
205
136
|
def read_and_validate_ec2_md_timeout
|
@@ -102,7 +102,7 @@ module SolarWindsAPM
|
|
102
102
|
end
|
103
103
|
|
104
104
|
sw_member_value = parent_span_context.tracestate[SolarWindsAPM::Constants::INTL_SWO_TRACESTATE_KEY]
|
105
|
-
trigger_trace_mode = OboeTracingMode.get_oboe_trigger_trace_mode(@config["trigger_trace"])
|
105
|
+
trigger_trace_mode = SolarWindsAPM::OboeTracingMode.get_oboe_trigger_trace_mode(@config["trigger_trace"])
|
106
106
|
sample_rate = UNSET
|
107
107
|
options = xtraceoptions&.options
|
108
108
|
trigger_trace = xtraceoptions&.intify_trigger_trace || 0
|
@@ -291,4 +291,4 @@ module SolarWindsAPM
|
|
291
291
|
end
|
292
292
|
end
|
293
293
|
end
|
294
|
-
end
|
294
|
+
end
|
@@ -11,4 +11,4 @@ require_relative './opentelemetry/solarwinds_propagator'
|
|
11
11
|
require_relative './opentelemetry/solarwinds_processor'
|
12
12
|
require_relative './opentelemetry/solarwinds_sampler'
|
13
13
|
require_relative './opentelemetry/solarwinds_exporter'
|
14
|
-
require_relative './opentelemetry/solarwinds_response_propagator'
|
14
|
+
require_relative './opentelemetry/solarwinds_response_propagator'
|
@@ -22,12 +22,6 @@ module SolarWindsAPM
|
|
22
22
|
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Agent disabled. No Trace exported."}
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.validate_service_key
|
26
|
-
return unless (ENV['SW_APM_REPORTER'] || 'ssl') == 'ssl'
|
27
|
-
|
28
|
-
disable_agent unless ENV['SW_APM_SERVICE_KEY'] || SolarWindsAPM::Config[:service_key]
|
29
|
-
end
|
30
|
-
|
31
25
|
def self.resolve_sampler
|
32
26
|
sampler_config = {"trigger_trace" => SolarWindsAPM::Config[:trigger_tracing_mode]}
|
33
27
|
@@config[:sampler] =
|
@@ -62,12 +56,13 @@ module SolarWindsAPM
|
|
62
56
|
end
|
63
57
|
|
64
58
|
def self.print_config
|
65
|
-
@@config.each do |
|
66
|
-
SolarWindsAPM.logger.
|
59
|
+
@@config.each do |k,v|
|
60
|
+
SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] Config Key/Value: #{k}, #{v.class}"}
|
67
61
|
end
|
68
|
-
@@config_map.each do |
|
69
|
-
SolarWindsAPM.logger.
|
62
|
+
@@config_map.each do |k,v|
|
63
|
+
SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] Config Key/Value: #{k}, #{v}"}
|
70
64
|
end
|
65
|
+
nil
|
71
66
|
end
|
72
67
|
|
73
68
|
def self.resolve_solarwinds_processor
|
@@ -100,29 +95,22 @@ module SolarWindsAPM
|
|
100
95
|
return
|
101
96
|
end
|
102
97
|
|
103
|
-
validate_service_key
|
104
|
-
|
105
|
-
return unless @@agent_enabled
|
106
|
-
|
107
98
|
resolve_sampler
|
108
|
-
|
109
99
|
resolve_solarwinds_propagator
|
110
100
|
resolve_solarwinds_processor
|
111
101
|
resolve_response_propagator
|
112
102
|
|
113
103
|
print_config if SolarWindsAPM.logger.level.zero?
|
114
104
|
|
105
|
+
# resolve OTEL environmental variables
|
115
106
|
ENV['OTEL_TRACES_EXPORTER'] = 'none' if ENV['OTEL_TRACES_EXPORTER'].to_s.empty?
|
116
|
-
|
117
107
|
if ENV['OTEL_LOG_LEVEL'].to_s.empty?
|
118
|
-
::
|
119
|
-
|
120
|
-
c.use_all(@@config_map)
|
121
|
-
end
|
122
|
-
else
|
123
|
-
::OpenTelemetry::SDK.configure { |c| c.use_all(@@config_map) }
|
108
|
+
log_level = (ENV['SW_APM_DEBUG_LEVEL'] || SolarWindsAPM::Config[:debug_level] || 3).to_i
|
109
|
+
ENV['OTEL_LOG_LEVEL'] = SolarWindsAPM::Config::SW_LOG_LEVEL_MAPPING.dig(log_level, :otel)
|
124
110
|
end
|
125
111
|
|
112
|
+
::OpenTelemetry::SDK.configure { |c| c.use_all(@@config_map) }
|
113
|
+
|
126
114
|
validate_propagator(::OpenTelemetry.propagation.instance_variable_get(:@propagators))
|
127
115
|
|
128
116
|
return unless @@agent_enabled
|
@@ -4,26 +4,8 @@
|
|
4
4
|
#
|
5
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
6
|
|
7
|
-
|
8
|
-
##
|
9
|
-
# Provides thread local storage for SolarWindsAPM.
|
10
|
-
#
|
11
|
-
# Example usage:
|
12
|
-
# module SolarWindsAPMBase
|
13
|
-
# extend SolarWindsAPM::ThreadLocal
|
14
|
-
# thread_local :layer_op
|
15
|
-
# end
|
16
|
-
module ThreadLocal
|
17
|
-
def thread_local(name)
|
18
|
-
key = "__#{self}_#{name}__".intern
|
7
|
+
# This file is for loading any customized patch for upstream
|
19
8
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
define_method("#{name}=") do |value|
|
25
|
-
Thread.current[key] = value
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
9
|
+
# e.g.
|
10
|
+
# require_relative './patch/dummy_patch'
|
11
|
+
# OpenTelemetry::Instrumentation::Registry.prepend(SolarWindsAPM::Patch::DummyPatch) if defined? OpenTelemetry::Instrumentation::Registry && OpenTelemetry::Instrumentation::Registry::VERSION <= '0.3.0'
|
@@ -5,29 +5,27 @@
|
|
5
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
6
|
|
7
7
|
module SolarWindsAPM
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
OBOE_TRIGGER_ENABLED = 1
|
8
|
+
# OboeTracingMode
|
9
|
+
# Used in solarwinds_sampler
|
10
|
+
class OboeTracingMode
|
11
|
+
OBOE_SETTINGS_UNSET = -1
|
12
|
+
OBOE_TRACE_DISABLED = 0
|
13
|
+
OBOE_TRACE_ENABLED = 1
|
14
|
+
OBOE_TRIGGER_DISABLED = 0
|
15
|
+
OBOE_TRIGGER_ENABLED = 1
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
def self.get_oboe_trace_mode(tracing_mode)
|
18
|
+
mode = OBOE_SETTINGS_UNSET
|
19
|
+
mode = OBOE_TRACE_ENABLED if tracing_mode == :enabled
|
20
|
+
mode = OBOE_TRACE_DISABLED if tracing_mode == :disabled
|
21
|
+
mode
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
24
|
+
def self.get_oboe_trigger_trace_mode(trigger_trace_mode)
|
25
|
+
mode = OBOE_SETTINGS_UNSET
|
26
|
+
mode = OBOE_TRIGGER_ENABLED if trigger_trace_mode == :enabled
|
27
|
+
mode = OBOE_TRIGGER_DISABLED if trigger_trace_mode == :disabled
|
28
|
+
mode
|
31
29
|
end
|
32
30
|
end
|
33
|
-
end
|
31
|
+
end
|
@@ -0,0 +1,94 @@
|
|
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
|
+
|
7
|
+
module SolarWindsAPM
|
8
|
+
# ServiceKeyChecker
|
9
|
+
# It is a service that validate the service_key
|
10
|
+
class ServiceKeyChecker
|
11
|
+
def initialize(reporter)
|
12
|
+
@reporter = reporter
|
13
|
+
end
|
14
|
+
|
15
|
+
def read_and_validate_service_key
|
16
|
+
return '' unless @reporter == 'ssl'
|
17
|
+
|
18
|
+
service_key = fetch_service_key
|
19
|
+
if service_key.empty?
|
20
|
+
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY not configured."}
|
21
|
+
return ''
|
22
|
+
end
|
23
|
+
|
24
|
+
token, _, service_name = parse_service_key(service_key)
|
25
|
+
if token.empty? || !validate_token(token)
|
26
|
+
SolarWindsAPM.logger.error {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. API Token in wrong format. Masked token: #{token[0..3]}...#{token[-4..]}"}
|
27
|
+
return ''
|
28
|
+
end
|
29
|
+
|
30
|
+
# if no service_name from service_key, then the SW_APM_SERVICE_KEY is not right format, return
|
31
|
+
if service_name.empty?
|
32
|
+
ENV.delete('OTEL_SERVICE_NAME')
|
33
|
+
SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY format problem. Service Name is missing."}
|
34
|
+
return ''
|
35
|
+
end
|
36
|
+
|
37
|
+
service_name = transform_service_name(service_name)
|
38
|
+
|
39
|
+
# check if otel_resource_service or otel_service_name has service name to override the original service name
|
40
|
+
otel_resource_service_name = fetch_otel_resource_service_name
|
41
|
+
service_name = transform_service_name(otel_resource_service_name) unless otel_resource_service_name.empty?
|
42
|
+
|
43
|
+
otel_service_name = fetch_otel_service_name
|
44
|
+
if otel_service_name.empty?
|
45
|
+
ENV['OTEL_SERVICE_NAME'] = service_name
|
46
|
+
else
|
47
|
+
service_name = transform_service_name(otel_service_name)
|
48
|
+
end
|
49
|
+
|
50
|
+
"#{token}:#{service_name}"
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
# since oboe_init_options init afte config, so [:service_key] will be present at this point
|
56
|
+
def fetch_service_key
|
57
|
+
ENV['SW_APM_SERVICE_KEY'] || SolarWindsAPM::Config[:service_key] || ''
|
58
|
+
end
|
59
|
+
|
60
|
+
def parse_service_key(service_key)
|
61
|
+
match = service_key.match(/([^:]+)(:{0,1})(.*)/)
|
62
|
+
return ['', '', ''] if match.nil?
|
63
|
+
|
64
|
+
[match[1], match[2], match[3]]
|
65
|
+
end
|
66
|
+
|
67
|
+
# precedence: OTEL_SERVICE_NAME > OTEL_RESOURCE_ATTRIBUTES > service_key
|
68
|
+
def fetch_otel_service_name
|
69
|
+
ENV['OTEL_SERVICE_NAME'] || ''
|
70
|
+
end
|
71
|
+
|
72
|
+
def fetch_otel_resource_service_name
|
73
|
+
ENV['OTEL_RESOURCE_ATTRIBUTES']&.split(',')&.find do |pair|
|
74
|
+
key, value = pair.split('=')
|
75
|
+
break value if key == 'service.name'
|
76
|
+
end || ''
|
77
|
+
end
|
78
|
+
|
79
|
+
# In case of java-collector, please provide a dummy service key
|
80
|
+
def validate_token(token)
|
81
|
+
/^[0-9a-zA-Z_-]{71}$/.match?(token)
|
82
|
+
end
|
83
|
+
|
84
|
+
def transform_service_name(service_name)
|
85
|
+
name_ = service_name.dup
|
86
|
+
name_.downcase!
|
87
|
+
name_.gsub!(/[^a-z0-9.:_-]/, '')
|
88
|
+
name_ = name_[0..254]
|
89
|
+
SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] Service Name transformed from #{service_name} to #{name_}"} if name_ != service_name
|
90
|
+
|
91
|
+
name_
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -7,12 +7,11 @@
|
|
7
7
|
require 'rbconfig'
|
8
8
|
require 'logger'
|
9
9
|
|
10
|
+
##
|
11
|
+
# This module is used to debug problematic setups and/or environments.
|
12
|
+
# Depending on the environment, output may be to stdout or the framework
|
13
|
+
# log file (e.g. log/production.log)
|
10
14
|
module SolarWindsAPM
|
11
|
-
##
|
12
|
-
# This module is used to debug problematic setups and/or environments.
|
13
|
-
# Depending on the environment, output may be to stdout or the framework
|
14
|
-
# log file (e.g. log/production.log)
|
15
|
-
|
16
15
|
##
|
17
16
|
# yesno
|
18
17
|
#
|
@@ -71,6 +70,12 @@ module SolarWindsAPM
|
|
71
70
|
SolarWindsAPM.logger.warn '********************************************************'
|
72
71
|
SolarWindsAPM.logger.warn '* SolarWindsAPM::Config Values'
|
73
72
|
SolarWindsAPM.logger.warn '********************************************************'
|
73
|
+
SolarWindsAPM.logger.warn SolarWindsAPM::Config.print_config.to_s
|
74
|
+
|
75
|
+
SolarWindsAPM.logger.warn '********************************************************'
|
76
|
+
SolarWindsAPM.logger.warn '* SolarWindsAPM::OTelConfig Values'
|
77
|
+
SolarWindsAPM.logger.warn '********************************************************'
|
78
|
+
SolarWindsAPM.logger.warn SolarWindsAPM::OTelConfig.print_config.to_s
|
74
79
|
|
75
80
|
SolarWindsAPM.logger.warn '********************************************************'
|
76
81
|
SolarWindsAPM.logger.warn '* OS, Platform + Env'
|
@@ -78,9 +83,7 @@ module SolarWindsAPM
|
|
78
83
|
SolarWindsAPM.logger.warn "host_os: #{RbConfig::CONFIG['host_os']}"
|
79
84
|
SolarWindsAPM.logger.warn "sitearch: #{RbConfig::CONFIG['sitearch']}"
|
80
85
|
SolarWindsAPM.logger.warn "arch: #{RbConfig::CONFIG['arch']}"
|
81
|
-
SolarWindsAPM.logger.warn RUBY_PLATFORM
|
82
|
-
SolarWindsAPM.logger.warn "RACK_ENV: #{ENV['RACK_ENV']}"
|
83
|
-
SolarWindsAPM.logger.warn "RAILS_ENV: #{ENV['RAILS_ENV']}" if using_rails
|
86
|
+
SolarWindsAPM.logger.warn "Platform: #{RUBY_PLATFORM}"
|
84
87
|
|
85
88
|
SolarWindsAPM.logger.warn '********************************************************'
|
86
89
|
SolarWindsAPM.logger.warn '* END SolarWindsAPM Support Report'
|
@@ -15,6 +15,7 @@ require_relative './support/oboe_tracing_mode'
|
|
15
15
|
require_relative './support/txn_name_manager'
|
16
16
|
require_relative './support/utils'
|
17
17
|
require_relative './support/x_trace_options'
|
18
|
+
require_relative './support/support_report'
|
18
19
|
|
19
20
|
if SolarWindsAPM::Config[:tag_sql]
|
20
21
|
if defined?(::Rails)
|
data/lib/solarwinds_apm.rb
CHANGED
@@ -5,69 +5,89 @@
|
|
5
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
6
|
|
7
7
|
begin
|
8
|
+
require 'solarwinds_apm/logger'
|
9
|
+
require 'solarwinds_apm/version'
|
10
|
+
require 'solarwinds_apm/noop'
|
11
|
+
require 'opentelemetry-api'
|
8
12
|
if ENV.fetch('SW_APM_ENABLED', 'true') == 'false'
|
9
|
-
SolarWindsAPM.logger.
|
13
|
+
SolarWindsAPM.logger.info '==================================================================='
|
14
|
+
SolarWindsAPM.logger.info 'SW_APM_ENABLED environment variable detected and was set to false. SolarWindsAPM disabled'
|
15
|
+
SolarWindsAPM.logger.info '==================================================================='
|
10
16
|
return
|
11
17
|
end
|
12
18
|
|
13
|
-
require 'solarwinds_apm/version'
|
14
|
-
require 'solarwinds_apm/thread_local'
|
15
|
-
require 'solarwinds_apm/support_report'
|
16
|
-
require 'solarwinds_apm/constants'
|
17
|
-
require 'solarwinds_apm/api'
|
18
|
-
require 'solarwinds_apm/base'
|
19
|
-
require 'solarwinds_apm/logger'
|
20
|
-
require 'solarwinds_apm/config'
|
21
|
-
|
22
|
-
SolarWindsAPM::Config.load_config_file
|
23
|
-
SolarWindsAPM.loaded = false
|
24
19
|
begin
|
25
20
|
if /linux/.match?(RUBY_PLATFORM)
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
require 'solarwinds_apm/config'
|
22
|
+
SolarWindsAPM::Config.load_config_file
|
23
|
+
|
24
|
+
require 'solarwinds_apm/oboe_init_options' # setup oboe reporter options
|
25
|
+
unless SolarWindsAPM::OboeInitOptions.instance.service_key_ok?
|
26
|
+
SolarWindsAPM.logger.warn '=============================================================='
|
27
|
+
SolarWindsAPM.logger.warn 'SW_APM_SERVICE_KEY Error. SolarWinds APM disabled'
|
28
|
+
SolarWindsAPM.logger.warn 'Please check previous log messages for more details.'
|
29
|
+
SolarWindsAPM.logger.warn '=============================================================='
|
30
|
+
return
|
31
|
+
end
|
32
|
+
|
33
|
+
require_relative './libsolarwinds_apm.so' # load c-lib oboe
|
34
|
+
require_relative './oboe_metal' # initialize reporter: SolarWindsAPM.loaded = true
|
35
|
+
|
36
|
+
require 'opentelemetry/sdk/version' # load otel sdk version
|
37
|
+
require 'opentelemetry/instrumentation/all/version' # load otel instrumentation
|
38
|
+
|
39
|
+
SolarWindsAPM.logger.info '==================================================================='
|
40
|
+
SolarWindsAPM.logger.info "Ruby #{RUBY_VERSION} on platform #{RUBY_PLATFORM}."
|
41
|
+
SolarWindsAPM.logger.info "Current solarwinds_apm version: #{SolarWindsAPM::Version::STRING}."
|
42
|
+
SolarWindsAPM.logger.info "OpenTelemetry version: #{OpenTelemetry::SDK::VERSION}."
|
43
|
+
SolarWindsAPM.logger.info "OpenTelemetry instrumentation version: #{OpenTelemetry::Instrumentation::All::VERSION}."
|
44
|
+
SolarWindsAPM.logger.info '==================================================================='
|
45
|
+
|
46
|
+
SolarWindsAPM::Reporter.start # start the reporter, any issue will be logged
|
47
|
+
|
48
|
+
if SolarWindsAPM.loaded
|
49
|
+
require 'solarwinds_apm/constants'
|
50
|
+
require 'solarwinds_apm/api'
|
51
|
+
require 'solarwinds_apm/support'
|
52
|
+
require 'solarwinds_apm/opentelemetry'
|
53
|
+
require 'solarwinds_apm/patch'
|
54
|
+
require 'solarwinds_apm/otel_config'
|
55
|
+
|
56
|
+
if ENV['SW_APM_AUTO_CONFIGURE'] != 'false'
|
57
|
+
SolarWindsAPM::OTelConfig.initialize
|
58
|
+
elsif ENV['SW_APM_AUTO_CONFIGURE'] == 'false'
|
59
|
+
SolarWindsAPM.logger.warn '=============================================================='
|
60
|
+
SolarWindsAPM.logger.warn 'SW_APM_AUTO_CONFIGURE set to false.'
|
61
|
+
SolarWindsAPM.logger.warn 'You need to initialize Ruby library in application with'
|
62
|
+
SolarWindsAPM.logger.warn 'SolarWindsAPM::OTelConfig.initialize_with_config do |config|'
|
63
|
+
SolarWindsAPM.logger.warn ' # ... your configuration code'
|
64
|
+
SolarWindsAPM.logger.warn 'end'
|
65
|
+
SolarWindsAPM.logger.warn 'See: https://github.com/solarwinds/apm-ruby/blob/main/CONFIGURATION.md#in-code-configuration'
|
66
|
+
SolarWindsAPM.logger.warn "\e[1mPlease discard this message if application have already taken this action.\e[0m"
|
67
|
+
SolarWindsAPM.logger.warn '=============================================================='
|
68
|
+
end
|
69
|
+
else
|
70
|
+
SolarWindsAPM.logger.warn '=============================================================='
|
71
|
+
SolarWindsAPM.logger.warn 'SolarWindsAPM not loaded. SolarWinds APM disabled'
|
72
|
+
SolarWindsAPM.logger.warn 'Please check previous log messages.'
|
73
|
+
SolarWindsAPM.logger.warn '=============================================================='
|
74
|
+
end
|
29
75
|
else
|
30
76
|
SolarWindsAPM.logger.warn '==================================================================='
|
31
|
-
SolarWindsAPM.logger.warn "SolarWindsAPM warning: Platform #{RUBY_PLATFORM} not yet supported
|
77
|
+
SolarWindsAPM.logger.warn "SolarWindsAPM warning: Platform #{RUBY_PLATFORM} not yet supported on current solarwinds_apm #{SolarWindsAPM::Version::STRING}"
|
32
78
|
SolarWindsAPM.logger.warn 'see: https://documentation.solarwinds.com/en/success_center/observability/default.htm#cshid=config-ruby-agent'
|
33
|
-
SolarWindsAPM.logger.warn '
|
79
|
+
SolarWindsAPM.logger.warn 'SolarWinds APM disabled.'
|
34
80
|
SolarWindsAPM.logger.warn 'Contact technicalsupport@solarwinds.com if this is unexpected.'
|
35
81
|
SolarWindsAPM.logger.warn '==================================================================='
|
36
82
|
end
|
37
83
|
rescue LoadError => e
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
SolarWindsAPM.logger.error '=============================================================='
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
if SolarWindsAPM.loaded
|
48
|
-
require 'solarwinds_apm/support'
|
49
|
-
require 'solarwinds_apm/opentelemetry'
|
50
|
-
require 'solarwinds_apm/otel_config'
|
51
|
-
if ENV['SW_APM_AUTO_CONFIGURE'] == 'false'
|
52
|
-
SolarWindsAPM.logger.warn "SolarWindsAPM warning: Ruby library is not initilaized.
|
53
|
-
You may need to initialize Ruby library in application like the following:
|
54
|
-
SolarWindsAPM::OTelConfig.initialize_with_config do |config|
|
55
|
-
...
|
56
|
-
end"
|
57
|
-
else
|
58
|
-
SolarWindsAPM::OTelConfig.initialize
|
59
|
-
end
|
60
|
-
|
61
|
-
SolarWindsAPM::Reporter.start
|
62
|
-
else
|
63
|
-
SolarWindsAPM.logger.warn '=============================================================='
|
64
|
-
SolarWindsAPM.logger.warn 'SolarWindsAPM not loaded. Tracing disabled.'
|
65
|
-
SolarWindsAPM.logger.warn 'There may be a problem with the service key or other settings.'
|
66
|
-
SolarWindsAPM.logger.warn 'Please check previous log messages.'
|
67
|
-
SolarWindsAPM.logger.warn '=============================================================='
|
68
|
-
require 'solarwinds_apm/noop/context'
|
69
|
-
require 'solarwinds_apm/noop/metadata'
|
84
|
+
SolarWindsAPM.logger.error '=============================================================='
|
85
|
+
SolarWindsAPM.logger.error 'Error occurs while loading solarwinds_apm. SolarWinds APM disabled.'
|
86
|
+
SolarWindsAPM.logger.error "Error: #{e.message}"
|
87
|
+
SolarWindsAPM.logger.error 'See: https://documentation.solarwinds.com/en/success_center/observability/default.htm#cshid=config-ruby-agent'
|
88
|
+
SolarWindsAPM.logger.error '=============================================================='
|
70
89
|
end
|
90
|
+
|
71
91
|
rescue StandardError => e
|
72
92
|
$stderr.puts "[solarwinds_apm/error] Problem loading: #{e.inspect}"
|
73
93
|
$stderr.puts e.backtrace
|
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
|
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: 2024-
|
14
|
+
date: 2024-04-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: opentelemetry-sdk
|
@@ -102,14 +102,16 @@ files:
|
|
102
102
|
- lib/solarwinds_apm/api/opentelemetry.rb
|
103
103
|
- lib/solarwinds_apm/api/tracing.rb
|
104
104
|
- lib/solarwinds_apm/api/transaction_name.rb
|
105
|
-
- lib/solarwinds_apm/base.rb
|
106
105
|
- lib/solarwinds_apm/cert/star.appoptics.com.issuer.crt
|
107
106
|
- lib/solarwinds_apm/config.rb
|
108
107
|
- lib/solarwinds_apm/constants.rb
|
109
108
|
- lib/solarwinds_apm/logger.rb
|
109
|
+
- lib/solarwinds_apm/noop.rb
|
110
110
|
- lib/solarwinds_apm/noop/README.md
|
111
|
+
- lib/solarwinds_apm/noop/api.rb
|
111
112
|
- lib/solarwinds_apm/noop/context.rb
|
112
113
|
- lib/solarwinds_apm/noop/metadata.rb
|
114
|
+
- lib/solarwinds_apm/noop/span.rb
|
113
115
|
- lib/solarwinds_apm/oboe_init_options.rb
|
114
116
|
- lib/solarwinds_apm/opentelemetry.rb
|
115
117
|
- lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb
|
@@ -118,11 +120,15 @@ files:
|
|
118
120
|
- lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb
|
119
121
|
- lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb
|
120
122
|
- lib/solarwinds_apm/otel_config.rb
|
123
|
+
- lib/solarwinds_apm/patch.rb
|
124
|
+
- lib/solarwinds_apm/patch/dummy_patch.rb
|
121
125
|
- lib/solarwinds_apm/support.rb
|
122
126
|
- lib/solarwinds_apm/support/logger_formatter.rb
|
123
127
|
- lib/solarwinds_apm/support/logging_log_event.rb
|
124
128
|
- lib/solarwinds_apm/support/lumberjack_formatter.rb
|
125
129
|
- lib/solarwinds_apm/support/oboe_tracing_mode.rb
|
130
|
+
- lib/solarwinds_apm/support/service_key_checker.rb
|
131
|
+
- lib/solarwinds_apm/support/support_report.rb
|
126
132
|
- lib/solarwinds_apm/support/swomarginalia/LICENSE
|
127
133
|
- lib/solarwinds_apm/support/swomarginalia/README.md
|
128
134
|
- lib/solarwinds_apm/support/swomarginalia/comment.rb
|
@@ -134,8 +140,6 @@ files:
|
|
134
140
|
- lib/solarwinds_apm/support/txn_name_manager.rb
|
135
141
|
- lib/solarwinds_apm/support/utils.rb
|
136
142
|
- lib/solarwinds_apm/support/x_trace_options.rb
|
137
|
-
- lib/solarwinds_apm/support_report.rb
|
138
|
-
- lib/solarwinds_apm/thread_local.rb
|
139
143
|
- lib/solarwinds_apm/version.rb
|
140
144
|
homepage: https://documentation.solarwinds.com/en/success_center/observability/content/intro/landing-page.html
|
141
145
|
licenses:
|
@@ -157,9 +161,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
161
|
version: 2.7.0
|
158
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
163
|
requirements:
|
160
|
-
- - "
|
164
|
+
- - ">="
|
161
165
|
- !ruby/object:Gem::Version
|
162
|
-
version:
|
166
|
+
version: '0'
|
163
167
|
requirements: []
|
164
168
|
rubygems_version: 3.3.26
|
165
169
|
signing_key:
|