solarwinds_apm 6.0.0.preV2 → 6.0.0.preV4
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/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 -2
- data/ext/oboe_metal/src/oboe.h +0 -12
- data/ext/oboe_metal/src/oboe_swig_wrap.cc +5 -5
- data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +1 -9
- data/lib/solarwinds_apm/api/current_trace_info.rb +0 -1
- data/lib/solarwinds_apm/api/opentelemetry.rb +39 -0
- data/lib/solarwinds_apm/api/transaction_name.rb +17 -17
- data/lib/solarwinds_apm/api.rb +2 -0
- data/lib/solarwinds_apm/config.rb +3 -19
- data/lib/solarwinds_apm/constants.rb +2 -4
- data/lib/solarwinds_apm/noop/context.rb +1 -1
- data/lib/solarwinds_apm/oboe_init_options.rb +2 -5
- data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +92 -87
- data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +18 -17
- data/lib/solarwinds_apm/opentelemetry/solarwinds_propagator.rb +28 -28
- data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +9 -14
- data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +122 -170
- data/lib/solarwinds_apm/otel_config.rb +47 -28
- data/lib/solarwinds_apm/support/lumberjack_formatter.rb +17 -2
- data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +5 -4
- data/lib/solarwinds_apm/support/transaction_cache.rb +27 -2
- data/lib/solarwinds_apm/support/transaction_settings.rb +2 -2
- data/lib/solarwinds_apm/support/txn_name_manager.rb +34 -17
- data/lib/solarwinds_apm/support/utils.rb +24 -0
- data/lib/solarwinds_apm/support.rb +2 -4
- data/lib/solarwinds_apm/version.rb +1 -1
- data/lib/solarwinds_apm.rb +2 -2
- metadata +13 -13
- data/lib/oboe.rb +0 -7
- data/lib/solarwinds_apm/support/transformer.rb +0 -56
@@ -6,12 +6,12 @@ module SolarWindsAPM
|
|
6
6
|
module OTelConfig
|
7
7
|
@@config = {}
|
8
8
|
@@config_map = {}
|
9
|
-
|
9
|
+
|
10
10
|
@@agent_enabled = true
|
11
11
|
|
12
12
|
def self.disable_agent
|
13
13
|
return unless @@agent_enabled # only show the msg once
|
14
|
-
|
14
|
+
|
15
15
|
@@agent_enabled = false
|
16
16
|
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Agent disabled. No Trace exported."}
|
17
17
|
end
|
@@ -25,36 +25,54 @@ module SolarWindsAPM
|
|
25
25
|
def self.resolve_sampler
|
26
26
|
|
27
27
|
resolve_sampler_config
|
28
|
-
@@config[:sampler] =
|
28
|
+
@@config[:sampler] =
|
29
29
|
::OpenTelemetry::SDK::Trace::Samplers.parent_based(
|
30
30
|
root: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(@@config[:sampler_config]),
|
31
31
|
remote_parent_sampled: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(@@config[:sampler_config]),
|
32
32
|
remote_parent_not_sampled: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new(@@config[:sampler_config]))
|
33
33
|
end
|
34
34
|
|
35
|
-
def self.resolve_sampler_config
|
35
|
+
def self.resolve_sampler_config
|
36
36
|
sampler_config = {}
|
37
|
-
sampler_config["trigger_trace"] = "enabled"
|
37
|
+
sampler_config["trigger_trace"] = "enabled"
|
38
38
|
sampler_config["trigger_trace"] = nil if ENV["SW_APM_TRIGGER_TRACING_MODE"] == 'disabled'
|
39
39
|
@@config[:sampler_config] = sampler_config
|
40
40
|
end
|
41
41
|
|
42
42
|
#
|
43
43
|
# append/add solarwinds_response_propagator into rack instrumentation
|
44
|
-
#
|
45
|
-
def self.
|
46
|
-
response_propagator
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
#
|
45
|
+
def self.resolve_response_propagator
|
46
|
+
response_propagator = SolarWindsAPM::OpenTelemetry::SolarWindsResponsePropagator::TextMapPropagator.new
|
47
|
+
rack_setting = @@config_map["OpenTelemetry::Instrumentation::Rack"]
|
48
|
+
|
49
|
+
if rack_setting
|
50
|
+
if rack_setting[:response_propagators].instance_of?(Array)
|
51
|
+
rack_setting[:response_propagators].append(response_propagator)
|
52
|
+
elsif rack_setting[:response_propagators].nil?
|
53
|
+
rack_setting[:response_propagators] = [response_propagator]
|
50
54
|
else
|
51
|
-
|
55
|
+
SolarWindsAPM.logger.warn {"[#{name}/#{__method__}] Rack response propagator resolve failed. Provided type #{rack_setting[:response_propagators].class}, please provide Array e.g. [#{rack_setting[:response_propagators]}]"}
|
52
56
|
end
|
53
57
|
else
|
54
58
|
@@config_map["OpenTelemetry::Instrumentation::Rack"] = {response_propagators: [response_propagator]}
|
55
59
|
end
|
56
60
|
end
|
57
61
|
|
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
|
+
|
58
76
|
def self.[](key)
|
59
77
|
@@config[key.to_sym]
|
60
78
|
end
|
@@ -69,7 +87,7 @@ module SolarWindsAPM
|
|
69
87
|
end
|
70
88
|
|
71
89
|
def self.resolve_solarwinds_processor
|
72
|
-
txn_manager = SolarWindsAPM::
|
90
|
+
txn_manager = SolarWindsAPM::TxnNameManager.new
|
73
91
|
exporter = SolarWindsAPM::OpenTelemetry::SolarWindsExporter.new(txn_manager: txn_manager)
|
74
92
|
@@config[:span_processor] = SolarWindsAPM::OpenTelemetry::SolarWindsProcessor.new(exporter, txn_manager)
|
75
93
|
end
|
@@ -103,39 +121,40 @@ module SolarWindsAPM
|
|
103
121
|
return unless @@agent_enabled
|
104
122
|
|
105
123
|
resolve_sampler
|
106
|
-
|
124
|
+
|
107
125
|
resolve_solarwinds_propagator
|
108
126
|
resolve_solarwinds_processor
|
109
|
-
|
127
|
+
resolve_response_propagator
|
128
|
+
|
129
|
+
obfuscate_query
|
110
130
|
|
111
131
|
print_config if SolarWindsAPM.logger.level.zero?
|
112
132
|
|
113
|
-
ENV['OTEL_TRACES_EXPORTER'] = 'none' if ENV['OTEL_TRACES_EXPORTER'].
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
133
|
+
ENV['OTEL_TRACES_EXPORTER'] = 'none' if ENV['OTEL_TRACES_EXPORTER'].to_s.empty?
|
134
|
+
|
135
|
+
::OpenTelemetry::SDK.configure { |c| c.use_all(@@config_map) }
|
136
|
+
|
118
137
|
validate_propagator(::OpenTelemetry.propagation.instance_variable_get(:@propagators))
|
119
138
|
|
120
139
|
return unless @@agent_enabled
|
121
140
|
|
122
141
|
# append our propagators
|
123
|
-
::OpenTelemetry.propagation.instance_variable_get(:@propagators).append(@@config[:propagators])
|
124
|
-
|
125
|
-
# append our processors (with our exporter)
|
142
|
+
::OpenTelemetry.propagation.instance_variable_get(:@propagators).append(@@config[:propagators])
|
143
|
+
|
144
|
+
# append our processors (with our exporter)
|
126
145
|
::OpenTelemetry.tracer_provider.add_span_processor(@@config[:span_processor])
|
127
|
-
|
146
|
+
|
128
147
|
# configure sampler afterwards
|
129
148
|
::OpenTelemetry.tracer_provider.sampler = @@config[:sampler]
|
130
149
|
nil
|
131
150
|
end
|
132
151
|
|
133
|
-
#
|
152
|
+
#
|
134
153
|
# Allow initialize after set new value to SolarWindsAPM::Config[:key]=value
|
135
|
-
#
|
154
|
+
#
|
136
155
|
# Usage:
|
137
|
-
#
|
138
|
-
# Default using the use_all to load all instrumentation
|
156
|
+
#
|
157
|
+
# Default using the use_all to load all instrumentation
|
139
158
|
# But with specific instrumentation disabled, use {:enabled: false} in config
|
140
159
|
# SolarWindsAPM::OTelConfig.initialize_with_config do |config|
|
141
160
|
# config["OpenTelemetry::Instrumentation::Rack"] = {"a" => "b"}
|
@@ -1,6 +1,21 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2023 SolarWinds, LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
4
|
require_relative 'logger_formatter'
|
5
5
|
|
6
|
-
|
6
|
+
module SolarWindsAPM
|
7
|
+
module Lumberjack
|
8
|
+
module LogEntry
|
9
|
+
include SolarWindsAPM::Logger::Formatter # provides #insert_trace_id
|
10
|
+
|
11
|
+
def initialize(time, severity, message, progname, pid, tags)
|
12
|
+
super if SolarWindsAPM::Config[:log_traceId] == :never
|
13
|
+
|
14
|
+
message = insert_trace_id(message)
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Lumberjack::LogEntry.prepend(SolarWindsAPM::Lumberjack::LogEntry) if SolarWindsAPM.loaded && defined?(Lumberjack::LogEntry)
|
@@ -7,12 +7,13 @@ module SolarWindsAPM
|
|
7
7
|
# This ActiveRecordInstrumentation should only work for activerecord < 7.0 since after rails 7
|
8
8
|
# this module won't be prepend to activerecord
|
9
9
|
module ActiveRecordInstrumentation
|
10
|
-
def execute(sql, *args)
|
11
|
-
super(annotate_sql(sql), *args)
|
10
|
+
def execute(sql, *args, **options)
|
11
|
+
super(annotate_sql(sql), *args, **options)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
# only for postgresql adapter
|
15
|
+
def execute_and_clear(sql, *args, **options)
|
16
|
+
super(annotate_sql(sql), *args, **options)
|
16
17
|
end
|
17
18
|
|
18
19
|
def exec_query(sql, *args, **options)
|
@@ -1,21 +1,46 @@
|
|
1
1
|
module SolarWindsAPM
|
2
|
-
#
|
3
|
-
# TODO: improve cache to have lru mechanism that avoid too many values
|
2
|
+
# LRU TransactionCache with initial limit 1000
|
4
3
|
module TransactionCache
|
4
|
+
attr_reader :capacity
|
5
|
+
|
5
6
|
def self.initialize
|
7
|
+
@capacity = 1000
|
6
8
|
@cache = {}
|
9
|
+
@order = []
|
7
10
|
end
|
8
11
|
|
9
12
|
def self.get(key)
|
13
|
+
return nil unless @cache.has_key?(key)
|
14
|
+
|
15
|
+
@order.delete(key)
|
16
|
+
@order.push(key)
|
10
17
|
@cache[key]
|
11
18
|
end
|
12
19
|
|
13
20
|
def self.del(key)
|
14
21
|
@cache.delete(key)
|
22
|
+
@order.delete(key)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.clear
|
26
|
+
@cache.clear
|
27
|
+
@order.clear
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.size
|
31
|
+
@cache.size
|
15
32
|
end
|
16
33
|
|
17
34
|
def self.set(key, value)
|
35
|
+
if @cache.has_key?(key)
|
36
|
+
@cache.delete(key)
|
37
|
+
elsif @order.size >= @capacity
|
38
|
+
evict_key = @order.shift
|
39
|
+
@cache.delete(evict_key)
|
40
|
+
end
|
41
|
+
|
18
42
|
@cache[key] = value
|
43
|
+
@order.push(key)
|
19
44
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] current TransactionCache #{@cache.inspect}"}
|
20
45
|
end
|
21
46
|
end
|
@@ -28,9 +28,9 @@ module SolarWindsAPM
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def tracing_enabled?
|
31
|
-
span_layer = "#{@
|
31
|
+
span_layer = "#{@kind}:#{@name}"
|
32
32
|
|
33
|
-
enabled_regexps
|
33
|
+
enabled_regexps = SolarWindsAPM::Config[:enabled_regexps]
|
34
34
|
disabled_regexps = SolarWindsAPM::Config[:disabled_regexps]
|
35
35
|
|
36
36
|
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] enabled_regexps: #{enabled_regexps&.inspect}"}
|
@@ -1,25 +1,42 @@
|
|
1
1
|
module SolarWindsAPM
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
# SolarWindsTxnNameManager
|
3
|
+
class TxnNameManager
|
4
|
+
def initialize
|
5
|
+
@cache = {}
|
6
|
+
@root_context_h = {}
|
7
|
+
@mutex = Mutex.new
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
def get(key)
|
11
|
+
@cache[key]
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def del(key)
|
15
|
+
@cache.delete(key)
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def set(key, value)
|
19
|
+
@cache[key] = value
|
20
|
+
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] txn manager current cache #{@cache.inspect}"}
|
21
|
+
end
|
22
|
+
|
23
|
+
alias []= set
|
24
|
+
|
25
|
+
def set_root_context_h(key, value)
|
26
|
+
@mutex.synchronize do
|
27
|
+
@root_context_h[key] = value
|
20
28
|
end
|
29
|
+
SolarWindsAPM.logger.debug {"[#{self.class}/#{__method__}] txn manager current root_context_h #{@root_context_h.inspect}"}
|
30
|
+
end
|
21
31
|
|
22
|
-
|
32
|
+
def get_root_context_h(key)
|
33
|
+
@root_context_h[key]
|
34
|
+
end
|
35
|
+
|
36
|
+
def delete_root_context_h(key)
|
37
|
+
@mutex.synchronize do
|
38
|
+
@root_context_h.delete(key)
|
39
|
+
end
|
23
40
|
end
|
24
41
|
end
|
25
|
-
end
|
42
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module SolarWindsAPM
|
2
|
+
# Utils
|
3
|
+
class Utils
|
4
|
+
VERSION = '00'.freeze
|
5
|
+
|
6
|
+
def self.trace_state_header(trace_state)
|
7
|
+
return nil if trace_state.nil?
|
8
|
+
|
9
|
+
arr = []
|
10
|
+
trace_state.to_h.each { |key, value| arr << "#{key}=#{value}" }
|
11
|
+
header = arr.join(",")
|
12
|
+
SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] generated trace_state_header: #{header}"}
|
13
|
+
header
|
14
|
+
end
|
15
|
+
|
16
|
+
# Generates a liboboe W3C compatible trace_context from provided OTel span context.
|
17
|
+
def self.traceparent_from_context(span_context)
|
18
|
+
flag = span_context.trace_flags.sampled?? 1 : 0
|
19
|
+
xtr = "#{VERSION}-#{span_context.hex_trace_id}-#{span_context.hex_span_id}-0#{flag}"
|
20
|
+
SolarWindsAPM.logger.debug {"[#{name}/#{__method__}] generated traceparent: #{xtr} from #{span_context.inspect}"}
|
21
|
+
xtr
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -11,7 +11,7 @@ require_relative './support/transaction_cache'
|
|
11
11
|
require_relative './support/transaction_settings'
|
12
12
|
require_relative './support/oboe_tracing_mode'
|
13
13
|
require_relative './support/txn_name_manager'
|
14
|
-
require_relative './support/
|
14
|
+
require_relative './support/utils'
|
15
15
|
require_relative './support/x_trace_options'
|
16
16
|
|
17
17
|
if SolarWindsAPM::Config[:tag_sql]
|
@@ -31,10 +31,8 @@ if SolarWindsAPM::Config[:tag_sql]
|
|
31
31
|
SolarWindsAPM.logger.info {"For more information, please check https://api.rubyonrails.org/classes/ActiveRecord/QueryLogs.html"}
|
32
32
|
require_relative './support/swomarginalia/comment'
|
33
33
|
end
|
34
|
-
elsif defined?(::ActiveRecord)
|
34
|
+
elsif defined?(::ActiveRecord)
|
35
35
|
require_relative './support/swomarginalia/load_swomarginalia'
|
36
36
|
SolarWindsAPM::SWOMarginalia::LoadSWOMarginalia.insert
|
37
|
-
else
|
38
|
-
SolarWindsAPM.logger.info {"tag_sql currently is not supported in non-rails app that use active_record > 7"}
|
39
37
|
end
|
40
38
|
end
|
@@ -9,7 +9,7 @@ module SolarWindsAPM
|
|
9
9
|
MAJOR = 6 # breaking,
|
10
10
|
MINOR = 0 # feature,
|
11
11
|
PATCH = 0 # fix => BFF
|
12
|
-
PRE = '
|
12
|
+
PRE = 'preV4'.freeze # for pre-releases into packagecloud, set to nil for production releases into rubygems
|
13
13
|
|
14
14
|
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
|
15
15
|
end
|
data/lib/solarwinds_apm.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
4
|
begin
|
5
|
-
if ENV.has_key?('
|
6
|
-
SolarWindsAPM.logger.warn '
|
5
|
+
if ENV.has_key?('SW_APM_ENABLED') && (ENV['SW_APM_ENABLED'] == 'false' || ENV['SW_APM_ENABLED'] == false)
|
6
|
+
SolarWindsAPM.logger.warn 'SW_APM_ENABLED environment variable detected and was set to false; SolarWindsAPM disabled'
|
7
7
|
return
|
8
8
|
end
|
9
9
|
|
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.preV4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maia Engeli
|
@@ -11,34 +11,34 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2023-
|
14
|
+
date: 2023-09-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: opentelemetry-sdk
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- - "
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.2.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 1.2.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: opentelemetry-instrumentation-all
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- - "
|
34
|
+
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: 0.31.0
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - "
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 0.31.0
|
44
44
|
- !ruby/object:Gem::Dependency
|
@@ -59,16 +59,16 @@ dependencies:
|
|
59
59
|
name: opentelemetry-exporter-otlp
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- - "
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.24.
|
64
|
+
version: 0.24.2
|
65
65
|
type: :development
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- - "
|
69
|
+
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: 0.24.
|
71
|
+
version: 0.24.2
|
72
72
|
description: Automatic tracing and metrics for Ruby applications. Get started at cloud.solarwinds.com
|
73
73
|
email: technicalsupport@solarwinds.com
|
74
74
|
executables: []
|
@@ -92,13 +92,13 @@ files:
|
|
92
92
|
- ext/oboe_metal/src/oboe_api.h
|
93
93
|
- ext/oboe_metal/src/oboe_debug.h
|
94
94
|
- ext/oboe_metal/src/oboe_swig_wrap.cc
|
95
|
-
- lib/oboe.rb
|
96
95
|
- lib/oboe_metal.rb
|
97
96
|
- lib/rails/generators/solarwinds_apm/install_generator.rb
|
98
97
|
- lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb
|
99
98
|
- lib/solarwinds_apm.rb
|
100
99
|
- lib/solarwinds_apm/api.rb
|
101
100
|
- lib/solarwinds_apm/api/current_trace_info.rb
|
101
|
+
- lib/solarwinds_apm/api/opentelemetry.rb
|
102
102
|
- lib/solarwinds_apm/api/tracing.rb
|
103
103
|
- lib/solarwinds_apm/api/transaction_name.rb
|
104
104
|
- lib/solarwinds_apm/base.rb
|
@@ -130,8 +130,8 @@ files:
|
|
130
130
|
- lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb
|
131
131
|
- lib/solarwinds_apm/support/transaction_cache.rb
|
132
132
|
- lib/solarwinds_apm/support/transaction_settings.rb
|
133
|
-
- lib/solarwinds_apm/support/transformer.rb
|
134
133
|
- lib/solarwinds_apm/support/txn_name_manager.rb
|
134
|
+
- lib/solarwinds_apm/support/utils.rb
|
135
135
|
- lib/solarwinds_apm/support/x_trace_options.rb
|
136
136
|
- lib/solarwinds_apm/support_report.rb
|
137
137
|
- lib/solarwinds_apm/thread_local.rb
|
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
152
|
requirements:
|
153
153
|
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version: 2.
|
155
|
+
version: 2.7.0
|
156
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - ">"
|
data/lib/oboe.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
module SolarWindsAPM
|
2
|
-
module OpenTelemetry
|
3
|
-
# Transformer
|
4
|
-
class Transformer
|
5
|
-
VERSION = '00'.freeze
|
6
|
-
|
7
|
-
def self.sw_from_context(span_context)
|
8
|
-
flag = span_context.trace_flags.sampled?? 1 : 0
|
9
|
-
"#{span_context.hex_span_id}-0#{flag}"
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.trace_state_header(trace_state)
|
13
|
-
arr = []
|
14
|
-
trace_state.to_h.each do |key, value|
|
15
|
-
arr << "#{key}=#{value}"
|
16
|
-
end
|
17
|
-
arr.join(",")
|
18
|
-
end
|
19
|
-
|
20
|
-
# Generates a liboboe W3C compatible trace_context from provided OTel span context.
|
21
|
-
def self.traceparent_from_context(span_context)
|
22
|
-
flag = span_context.trace_flags.sampled?? 1 : 0
|
23
|
-
xtr = "#{VERSION}-#{span_context.hex_trace_id}-#{span_context.hex_span_id}-0#{flag}"
|
24
|
-
SolarWindsAPM.logger.debug("Generated traceparent #{xtr} from #{span_context.inspect}")
|
25
|
-
xtr
|
26
|
-
end
|
27
|
-
|
28
|
-
# Formats tracestate sw value from span_id and liboboe decision as 16-byte span_id with 8-bit trace_flags
|
29
|
-
# e.g. 1a2b3c4d5e6f7g8h-01
|
30
|
-
def self.sw_from_span_and_decision(span_id, decision)
|
31
|
-
[span_id, decision].join("-")
|
32
|
-
end
|
33
|
-
|
34
|
-
# trace_flags [Integer]
|
35
|
-
def self.trace_flags_from_int(trace_flags)
|
36
|
-
"0#{trace_flags}"
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.trace_flags_from_boolean(trace_flags)
|
40
|
-
trace_flags == true ? "01" : "00"
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.sampled?(decision)
|
44
|
-
decision == ::OpenTelemetry::SDK::Trace::Samplers::Decision::RECORD_AND_SAMPLE
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.span_id_from_sw(sw_value)
|
48
|
-
sw_value.split("-")[0]
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.create_key(name_)
|
52
|
-
::OpenTelemetry::Context.create_key(name_)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|