solarwinds_apm 5.1.9 → 6.0.0.preV1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +0 -1
- data/ext/oboe_metal/extconf.rb +19 -23
- 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_debug.h +1 -0
- data/lib/oboe_metal.rb +116 -80
- data/lib/rails/generators/solarwinds_apm/install_generator.rb +1 -2
- data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +44 -260
- data/lib/solarwinds_apm/api/current_trace_info.rb +148 -0
- data/lib/solarwinds_apm/api/tracing.rb +30 -0
- data/lib/solarwinds_apm/api/transaction_name.rb +57 -0
- data/lib/solarwinds_apm/api.rb +8 -15
- data/lib/solarwinds_apm/base.rb +4 -131
- data/lib/solarwinds_apm/config.rb +128 -175
- data/lib/solarwinds_apm/constants.rb +32 -0
- data/lib/solarwinds_apm/logger.rb +1 -1
- data/lib/solarwinds_apm/noop/context.rb +2 -5
- data/lib/solarwinds_apm/noop/metadata.rb +1 -2
- data/lib/solarwinds_apm/noop/profiling.rb +3 -7
- data/lib/solarwinds_apm/oboe_init_options.rb +71 -33
- data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +204 -0
- data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +163 -0
- data/lib/solarwinds_apm/opentelemetry/solarwinds_propagator.rb +92 -0
- data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +72 -0
- data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +330 -0
- data/lib/solarwinds_apm/opentelemetry.rb +8 -0
- data/lib/solarwinds_apm/otel_config.rb +161 -0
- data/lib/solarwinds_apm/{inst → support}/logger_formatter.rb +5 -6
- data/lib/solarwinds_apm/{inst → support}/logging_log_event.rb +3 -6
- data/lib/solarwinds_apm/{inst → support}/lumberjack_formatter.rb +1 -4
- data/lib/solarwinds_apm/support/oboe_tracing_mode.rb +27 -0
- data/lib/solarwinds_apm/support/swomarginalia/LICENSE +20 -0
- data/lib/solarwinds_apm/support/swomarginalia/README.md +41 -0
- data/lib/solarwinds_apm/support/swomarginalia/comment.rb +205 -0
- data/lib/solarwinds_apm/support/swomarginalia/load_swomarginalia.rb +48 -0
- data/lib/solarwinds_apm/support/swomarginalia/railtie.rb +22 -0
- data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +86 -0
- data/lib/solarwinds_apm/support/transaction_cache.rb +24 -0
- data/lib/solarwinds_apm/support/transaction_settings.rb +26 -209
- data/lib/solarwinds_apm/support/transformer.rb +56 -0
- data/lib/solarwinds_apm/support/txn_name_manager.rb +25 -0
- data/lib/solarwinds_apm/support/x_trace_options.rb +42 -26
- data/lib/solarwinds_apm/support.rb +33 -10
- data/lib/solarwinds_apm/support_report.rb +10 -32
- data/lib/solarwinds_apm/thread_local.rb +1 -1
- data/lib/solarwinds_apm/version.rb +4 -4
- data/lib/solarwinds_apm.rb +31 -26
- metadata +76 -121
- data/.dockerignore +0 -5
- data/.gitignore +0 -58
- data/.rubocop.yml +0 -29
- data/.whitesource +0 -22
- data/.yardopts +0 -7
- data/CHANGELOG-appoptics.md +0 -766
- data/CHANGELOG.md +0 -82
- data/CONFIG.md +0 -31
- data/Gemfile +0 -15
- data/README.md +0 -385
- data/bin/solarwinds_apm_config +0 -15
- data/examples/prepend.rb +0 -13
- data/examples/sdk_examples.rb +0 -158
- data/ext/oboe_metal/README.md +0 -69
- data/ext/oboe_metal/extconf_local.rb +0 -75
- data/ext/oboe_metal/lib/.keep +0 -0
- data/ext/oboe_metal/noop/noop.c +0 -8
- data/ext/oboe_metal/src/README.md +0 -6
- data/ext/oboe_metal/src/frames.cc +0 -247
- data/ext/oboe_metal/src/frames.h +0 -40
- data/ext/oboe_metal/src/logging.cc +0 -97
- data/ext/oboe_metal/src/logging.h +0 -34
- data/ext/oboe_metal/src/profiling.cc +0 -435
- data/ext/oboe_metal/src/profiling.h +0 -78
- data/ext/oboe_metal/test/CMakeLists.txt +0 -53
- data/ext/oboe_metal/test/FindGMock.cmake +0 -43
- data/ext/oboe_metal/test/README.md +0 -56
- data/ext/oboe_metal/test/frames_test.cc +0 -164
- data/ext/oboe_metal/test/profiling_test.cc +0 -93
- data/ext/oboe_metal/test/ruby_inc_dir.rb +0 -8
- data/ext/oboe_metal/test/ruby_prefix.rb +0 -8
- data/ext/oboe_metal/test/ruby_test_helper.rb +0 -67
- data/ext/oboe_metal/test/test.h +0 -11
- data/ext/oboe_metal/test/test_main.cc +0 -32
- data/init.rb +0 -4
- data/lib/solarwinds_apm/api/layerinit.rb +0 -41
- data/lib/solarwinds_apm/api/logging.rb +0 -356
- data/lib/solarwinds_apm/api/memcache.rb +0 -37
- data/lib/solarwinds_apm/api/metrics.rb +0 -63
- data/lib/solarwinds_apm/api/util.rb +0 -98
- data/lib/solarwinds_apm/frameworks/grape.rb +0 -96
- data/lib/solarwinds_apm/frameworks/padrino.rb +0 -78
- data/lib/solarwinds_apm/frameworks/rails/inst/action_controller.rb +0 -100
- data/lib/solarwinds_apm/frameworks/rails/inst/action_controller5.rb +0 -50
- data/lib/solarwinds_apm/frameworks/rails/inst/action_controller_api.rb +0 -50
- data/lib/solarwinds_apm/frameworks/rails/inst/action_view.rb +0 -88
- data/lib/solarwinds_apm/frameworks/rails/inst/active_record.rb +0 -26
- data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/mysql2.rb +0 -29
- data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/postgresql.rb +0 -22
- data/lib/solarwinds_apm/frameworks/rails/inst/connection_adapters/utils5x.rb +0 -103
- data/lib/solarwinds_apm/frameworks/rails/inst/logger_formatters.rb +0 -14
- data/lib/solarwinds_apm/frameworks/rails.rb +0 -100
- data/lib/solarwinds_apm/frameworks/sinatra.rb +0 -96
- data/lib/solarwinds_apm/inst/bunny-client.rb +0 -157
- data/lib/solarwinds_apm/inst/bunny-consumer.rb +0 -102
- data/lib/solarwinds_apm/inst/curb.rb +0 -289
- data/lib/solarwinds_apm/inst/dalli.rb +0 -89
- data/lib/solarwinds_apm/inst/delayed_job.rb +0 -100
- data/lib/solarwinds_apm/inst/excon.rb +0 -113
- data/lib/solarwinds_apm/inst/faraday.rb +0 -96
- data/lib/solarwinds_apm/inst/graphql.rb +0 -206
- data/lib/solarwinds_apm/inst/grpc_client.rb +0 -147
- data/lib/solarwinds_apm/inst/grpc_server.rb +0 -119
- data/lib/solarwinds_apm/inst/httpclient.rb +0 -182
- data/lib/solarwinds_apm/inst/memcached.rb +0 -86
- data/lib/solarwinds_apm/inst/mongo.rb +0 -246
- data/lib/solarwinds_apm/inst/mongo2.rb +0 -225
- data/lib/solarwinds_apm/inst/moped.rb +0 -466
- data/lib/solarwinds_apm/inst/net_http.rb +0 -60
- data/lib/solarwinds_apm/inst/rack.rb +0 -223
- data/lib/solarwinds_apm/inst/rack_cache.rb +0 -35
- data/lib/solarwinds_apm/inst/redis.rb +0 -280
- data/lib/solarwinds_apm/inst/redis_v4.rb +0 -273
- data/lib/solarwinds_apm/inst/resque.rb +0 -129
- data/lib/solarwinds_apm/inst/rest-client.rb +0 -43
- data/lib/solarwinds_apm/inst/sequel.rb +0 -241
- data/lib/solarwinds_apm/inst/sidekiq-client.rb +0 -63
- data/lib/solarwinds_apm/inst/sidekiq-worker.rb +0 -64
- data/lib/solarwinds_apm/inst/typhoeus.rb +0 -90
- data/lib/solarwinds_apm/instrumentation.rb +0 -22
- data/lib/solarwinds_apm/loading.rb +0 -65
- data/lib/solarwinds_apm/ruby.rb +0 -35
- data/lib/solarwinds_apm/sdk/current_trace_info.rb +0 -123
- data/lib/solarwinds_apm/sdk/custom_metrics.rb +0 -94
- data/lib/solarwinds_apm/sdk/logging.rb +0 -37
- data/lib/solarwinds_apm/sdk/trace_context_headers.rb +0 -69
- data/lib/solarwinds_apm/sdk/tracing.rb +0 -432
- data/lib/solarwinds_apm/support/profiling.rb +0 -25
- data/lib/solarwinds_apm/support/trace_context.rb +0 -53
- data/lib/solarwinds_apm/support/trace_state.rb +0 -69
- data/lib/solarwinds_apm/support/trace_string.rb +0 -89
- data/lib/solarwinds_apm/support/transaction_metrics.rb +0 -67
- data/lib/solarwinds_apm/test.rb +0 -165
- data/lib/solarwinds_apm/util.rb +0 -426
- data/log/.keep +0 -0
- data/log/postgresql/.keep +0 -0
- data/solarwinds_apm.gemspec +0 -55
- data/yardoc_frontpage.md +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b2c4b54eaff62c93db5c06ebd9e85f73aea61943fa8eb90f0ba157dc81ab01
|
4
|
+
data.tar.gz: 2133540e0d8ec4ab097cd638d0cfd834649bc4898555ffb9cbfd7fa58a6e2355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2731e533815670079641e91865a502157162a4924d4c1c0950b50f3e42d7417619305f51a2db22f12ef45ea9111b826d59bcd091f9201b1375afdb06e940421a
|
7
|
+
data.tar.gz: 6c2053e792310de17c09a58b68e8b74ba100a01c025d703d8cee315b7c3ad7ae6f23da08fe0b5dda2a6328a710330c6ce1468db12703c4d16ce98f1564df5436
|
data/LICENSE
CHANGED
data/ext/oboe_metal/extconf.rb
CHANGED
@@ -6,19 +6,18 @@
|
|
6
6
|
require 'mkmf'
|
7
7
|
require 'rbconfig'
|
8
8
|
require 'open-uri'
|
9
|
-
require 'no_proxy_fix'
|
10
9
|
|
11
10
|
CONFIG['warnflags'] = CONFIG['warnflags'].gsub(/-Wdeclaration-after-statement/, '')
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
.gsub(/-Wimplicit-function-declaration/, '')
|
12
|
+
.gsub(/-Wimplicit-int/, '')
|
13
|
+
.gsub(/-Wno-tautological-compare/, '')
|
14
|
+
.gsub(/-Wno-self-assign/, '')
|
15
|
+
.gsub(/-Wno-parentheses-equality/, '')
|
16
|
+
.gsub(/-Wno-constant-logical-operand/, '')
|
17
|
+
.gsub(/-Wno-cast-function-type/, '')
|
19
18
|
init_mkmf(CONFIG)
|
20
19
|
|
21
|
-
ext_dir =
|
20
|
+
ext_dir = __dir__
|
22
21
|
|
23
22
|
# Set the mkmf lib paths so we have no issues linking to
|
24
23
|
# the SolarWindsAPM libs.
|
@@ -37,13 +36,13 @@ else
|
|
37
36
|
ao_path = File.join('https://agent-binaries.cloud.solarwinds.com/apm/c-lib/', version)
|
38
37
|
end
|
39
38
|
|
40
|
-
ao_arch =
|
39
|
+
ao_arch = 'x86_64'
|
41
40
|
system_arch = `uname -m` # for mac, the command is `uname` # "Darwin\n"; try `uname -a`
|
42
41
|
case system_arch.gsub("\n","")
|
43
|
-
when
|
44
|
-
ao_arch =
|
45
|
-
when
|
46
|
-
ao_arch =
|
42
|
+
when 'x86_64'
|
43
|
+
ao_arch = 'x86_64'
|
44
|
+
when 'aarch64'
|
45
|
+
ao_arch = 'aarch64'
|
47
46
|
end
|
48
47
|
|
49
48
|
if File.exist?('/etc/alpine-release')
|
@@ -67,12 +66,9 @@ retries = 3
|
|
67
66
|
success = false
|
68
67
|
while retries > 0
|
69
68
|
begin
|
70
|
-
|
71
|
-
IO.copy_stream(download, clib)
|
72
|
-
|
69
|
+
IO.copy_stream(URI.parse(ao_item).open, clib)
|
73
70
|
clib_checksum = Digest::SHA256.file(clib).hexdigest
|
74
|
-
|
75
|
-
checksum = File.read(ao_checksum_file).strip
|
71
|
+
checksum = File.read(ao_checksum_file).strip
|
76
72
|
|
77
73
|
# unfortunately these messages only show if the install command is run
|
78
74
|
# with the `--verbose` flag
|
@@ -89,7 +85,7 @@ while retries > 0
|
|
89
85
|
success = true
|
90
86
|
retries = 0
|
91
87
|
end
|
92
|
-
rescue => e
|
88
|
+
rescue StandardError => e
|
93
89
|
File.write(clib, '')
|
94
90
|
retries -= 1
|
95
91
|
if retries == 0
|
@@ -139,15 +135,15 @@ if success
|
|
139
135
|
|
140
136
|
create_makefile('libsolarwinds_apm', 'src')
|
141
137
|
else
|
142
|
-
$stderr.puts
|
138
|
+
$stderr.puts '== ERROR ========================================================='
|
143
139
|
if have_library('oboe')
|
144
140
|
$stderr.puts "The c-library either needs to be updated or doesn't match the OS."
|
145
141
|
$stderr.puts 'No tracing will occur.'
|
146
142
|
else
|
147
143
|
$stderr.puts 'Could not find a matching c-library. No tracing will occur.'
|
148
144
|
end
|
149
|
-
$stderr.puts
|
150
|
-
$stderr.puts
|
145
|
+
$stderr.puts 'Contact technicalsupport@solarwinds.com if the problem persists.'
|
146
|
+
$stderr.puts '=================================================================='
|
151
147
|
create_makefile('oboe_noop', 'noop')
|
152
148
|
end
|
153
149
|
end
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
b931c715d8ddaa9f2b91c72ad708ed3467e6e68ee4255756123b2ca96f1b98d0
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
c8189fe6f5b31c15c31d3b005aebcff90f97ff82e92d9e0d3b254bbbe2a7367d
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2824ba630ba794ff6280358922b54e8e1be4ccdb145376f90601e6652d149525
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
82a003ec82e3703260cdc215ef4c0c0bc7bc916cef27ef509034b60fd5ef9b35
|
data/ext/oboe_metal/src/VERSION
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
12.
|
1
|
+
12.4.0
|
2
2
|
|
data/lib/oboe_metal.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# Copyright (c) 2016 SolarWinds, LLC.
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
|
-
require 'thread'
|
5
|
-
|
6
4
|
# Disable docs and Camelcase warns since we're implementing
|
7
5
|
# an interface here. See OboeBase for details.
|
8
|
-
# rubocop:disable Style/Documentation, Naming/MethodName
|
9
6
|
module SolarWindsAPM
|
10
7
|
extend SolarWindsAPMBase
|
11
8
|
include Oboe_metal
|
12
9
|
|
10
|
+
# Reporter that send span data to SWO
|
13
11
|
class Reporter
|
14
12
|
class << self
|
15
13
|
##
|
@@ -26,13 +24,8 @@ module SolarWindsAPM
|
|
26
24
|
|
27
25
|
SolarWindsAPM.reporter = Oboe_metal::Reporter.new(*options)
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
unless defined?(::Rails) || defined?(::Sinatra) || defined?(::Padrino) || defined?(::Grape)
|
32
|
-
SolarWindsAPM::API.report_init
|
33
|
-
end
|
34
|
-
|
35
|
-
rescue => e
|
27
|
+
report_init
|
28
|
+
rescue StandardError=> e
|
36
29
|
$stderr.puts e.message
|
37
30
|
raise
|
38
31
|
end
|
@@ -44,8 +37,8 @@ module SolarWindsAPM
|
|
44
37
|
#
|
45
38
|
# Send the report for the given event
|
46
39
|
#
|
47
|
-
def
|
48
|
-
SolarWindsAPM.reporter.sendReport(evt)
|
40
|
+
def send_report(evt, with_system_timestamp: true)
|
41
|
+
SolarWindsAPM.reporter.sendReport(evt, with_system_timestamp)
|
49
42
|
end
|
50
43
|
|
51
44
|
##
|
@@ -53,8 +46,8 @@ module SolarWindsAPM
|
|
53
46
|
#
|
54
47
|
# Send the report for the given event
|
55
48
|
#
|
56
|
-
def
|
57
|
-
SolarWindsAPM.reporter.sendStatus(evt, context)
|
49
|
+
def send_status(evt, context=nil, with_system_timestamp: true)
|
50
|
+
SolarWindsAPM.reporter.sendStatus(evt, context, with_system_timestamp)
|
58
51
|
end
|
59
52
|
|
60
53
|
##
|
@@ -67,20 +60,11 @@ module SolarWindsAPM
|
|
67
60
|
end
|
68
61
|
|
69
62
|
##
|
70
|
-
#
|
71
|
-
#
|
72
|
-
# Truncates the trace output file to zero by deleting the original bson file
|
73
|
-
#
|
74
|
-
def hard_clear_all_traces
|
75
|
-
File.delete(SolarWindsAPM::OboeInitOptions.instance.host) if File.exist?(SolarWindsAPM::OboeInitOptions.instance.host)
|
76
|
-
end
|
77
|
-
|
78
|
-
##
|
79
|
-
# get_all_traces
|
63
|
+
# obtain_all_traces
|
80
64
|
#
|
81
65
|
# Retrieves all traces written to the trace file
|
82
66
|
#
|
83
|
-
def
|
67
|
+
def obtain_all_traces
|
84
68
|
io = File.open(SolarWindsAPM::OboeInitOptions.instance.host, 'r')
|
85
69
|
contents = io.readlines(nil)
|
86
70
|
io.close
|
@@ -106,68 +90,121 @@ module SolarWindsAPM
|
|
106
90
|
end
|
107
91
|
else
|
108
92
|
bbb = ::BSON::ByteBuffer.new(contents[0])
|
109
|
-
until bbb.length == 0
|
110
|
-
traces << Hash.from_bson(bbb)
|
111
|
-
end
|
93
|
+
traces << Hash.from_bson(bbb) until bbb.length == 0
|
112
94
|
end
|
113
95
|
|
114
96
|
traces
|
115
97
|
end
|
116
|
-
end
|
117
|
-
end
|
118
98
|
|
119
|
-
|
120
|
-
|
121
|
-
|
99
|
+
private
|
100
|
+
|
101
|
+
# Internal: Report that instrumentation for the given layer has been
|
102
|
+
# installed, as well as the version of instrumentation and version of
|
103
|
+
# layer.
|
104
|
+
#
|
105
|
+
def report_init(layer=:rack) # :nodoc:
|
106
|
+
# Don't send __Init in test or if SolarWindsAPM
|
107
|
+
# isn't fully loaded (e.g. missing c-extension)
|
108
|
+
return if ENV.has_key?('SW_APM_GEM_TEST') || !SolarWindsAPM.loaded
|
109
|
+
|
110
|
+
platform_info = build_swo_init_report
|
111
|
+
log_init(layer, platform_info)
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# :nodoc:
|
116
|
+
# Internal: Reports agent init to the collector
|
117
|
+
#
|
118
|
+
# ==== Arguments
|
119
|
+
#
|
120
|
+
# * +layer+ - The layer the reported event belongs to
|
121
|
+
# * +kvs+ - A hash containing key/value pairs that will be reported along with this event
|
122
|
+
def log_init(layer=:rack, kvs={})
|
123
|
+
context = SolarWindsAPM::Metadata.makeRandom
|
124
|
+
return SolarWindsAPM::Context.toString unless context.isValid
|
125
|
+
|
126
|
+
event = context.createEvent
|
127
|
+
event.addInfo('Layer', layer.to_s)
|
128
|
+
event.addInfo('Label', 'single')
|
129
|
+
kvs.each do |k, v|
|
130
|
+
event.addInfo(k, v.to_s)
|
131
|
+
end
|
132
|
+
|
133
|
+
SolarWindsAPM::Reporter.send_status(event, context, with_system_timestamp: true)
|
134
|
+
SolarWindsAPM::Context.toString
|
135
|
+
end
|
136
|
+
|
137
|
+
##
|
138
|
+
# build_swo_init_report
|
139
|
+
#
|
140
|
+
# Internal: Build a hash of KVs that reports on the status of the
|
141
|
+
# running environment for swo only. This is used on stack boot in __Init reporting
|
142
|
+
# and for SolarWindsAPM.support_report.
|
143
|
+
#
|
144
|
+
def build_swo_init_report
|
145
|
+
|
146
|
+
platform_info = {'__Init' => true}
|
147
|
+
|
148
|
+
begin
|
149
|
+
platform_info['APM.Version'] = SolarWindsAPM::Version::STRING
|
150
|
+
platform_info['APM.Extension.Version'] = extension_lib_version
|
151
|
+
|
152
|
+
# OTel Resource Attributes (Optional)
|
153
|
+
platform_info['process.executable.path'] = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')
|
154
|
+
platform_info['process.executable.name'] = RbConfig::CONFIG['ruby_install_name']
|
155
|
+
platform_info['process.command_line'] = $PROGRAM_NAME
|
156
|
+
platform_info['process.telemetry.path'] = Gem::Specification.find_by_name('solarwinds_apm')&.full_gem_path
|
157
|
+
platform_info['os.type'] = RUBY_PLATFORM
|
158
|
+
|
159
|
+
platform_info.merge!(report_gem_in_use)
|
160
|
+
|
161
|
+
# Collect up opentelemetry sdk version (Instrumented Library Versions) (Required)
|
162
|
+
begin
|
163
|
+
require 'opentelemetry/sdk'
|
164
|
+
::OpenTelemetry::SDK::Resources::Resource.telemetry_sdk.attribute_enumerator.each {|k,v| platform_info[k] = v}
|
165
|
+
::OpenTelemetry::SDK::Resources::Resource.process.attribute_enumerator.each {|k,v| platform_info[k] = v}
|
166
|
+
rescue StandardError => e
|
167
|
+
SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] Fail to extract telemetry attributes. Error: #{e.message}"}
|
168
|
+
end
|
169
|
+
rescue StandardError, ScriptError => e
|
170
|
+
# Also rescue ScriptError (aka SyntaxError) in case one of the expected
|
171
|
+
# version defines don't exist
|
172
|
+
|
173
|
+
platform_info['Error'] = "Error in build_report: #{e.message}"
|
174
|
+
|
175
|
+
SolarWindsAPM.logger.warn {"[#{self.class}/#{__method__}] Error in build_init_report: #{e.message}"}
|
176
|
+
SolarWindsAPM.logger.debug {e.backtrace}
|
177
|
+
end
|
178
|
+
platform_info
|
179
|
+
end
|
180
|
+
|
181
|
+
##
|
182
|
+
# Collect up the loaded gems
|
183
|
+
##
|
184
|
+
def report_gem_in_use
|
185
|
+
platform_info = {}
|
186
|
+
if defined?(Gem) && Gem.respond_to?(:loaded_specs)
|
187
|
+
Gem.loaded_specs.each_pair {|k, v| platform_info["Ruby.#{k}.Version"] = v.version.to_s}
|
188
|
+
else
|
189
|
+
platform_info.merge!(legacy_build_init_report)
|
190
|
+
end
|
191
|
+
platform_info
|
192
|
+
end
|
193
|
+
|
194
|
+
##
|
195
|
+
# get extension library version by looking at the VERSION file
|
196
|
+
# oboe not loaded yet, can't use oboe_api function to read oboe VERSION
|
197
|
+
##
|
198
|
+
def extension_lib_version
|
199
|
+
gem_location = Gem::Specification.find_by_name('solarwinds_apm')
|
200
|
+
clib_version_file = File.join(gem_location&.gem_dir, 'ext', 'oboe_metal', 'src', 'VERSION')
|
201
|
+
File.read(clib_version_file).strip
|
202
|
+
end
|
122
203
|
end
|
123
204
|
end
|
124
205
|
|
125
206
|
class << self
|
126
|
-
|
127
|
-
# # Return false if no-op mode
|
128
|
-
# return false unless SolarWindsAPM.loaded
|
129
|
-
#
|
130
|
-
# # Assure defaults since SWIG enforces Strings
|
131
|
-
# xtrace = opts[:xtrace] ? opts[:xtrace].to_s.strip : SW_APM_STR_BLANK
|
132
|
-
#
|
133
|
-
# # the first arg has changed to be the service name, blank means to use the default (from the service key)
|
134
|
-
# rv = SolarWindsAPM::Context.sampleRequest(SW_APM_STR_BLANK, xtrace)
|
135
|
-
#
|
136
|
-
# if rv == 0
|
137
|
-
# SolarWindsAPM.sample_rate = -1
|
138
|
-
# SolarWindsAPM.sample_source = -1
|
139
|
-
# false
|
140
|
-
# else
|
141
|
-
# # liboboe version > 1.3.1 returning a bit masked integer with SampleRate and
|
142
|
-
# # source embedded
|
143
|
-
# SolarWindsAPM.sample_rate = (rv & SAMPLE_RATE_MASK)
|
144
|
-
# SolarWindsAPM.sample_source = (rv & SAMPLE_SOURCE_MASK) >> 24
|
145
|
-
# true
|
146
|
-
# end
|
147
|
-
# rescue StandardError => e
|
148
|
-
# SolarWindsAPM.logger.debug "[oboe/error] sample? error: #{e.inspect}"
|
149
|
-
# false
|
150
|
-
# end
|
151
|
-
|
152
|
-
# def set_tracing_mode(mode)
|
153
|
-
# return unless SolarWindsAPM.loaded
|
154
|
-
#
|
155
|
-
# value = mode.to_sym
|
156
|
-
#
|
157
|
-
# case value
|
158
|
-
# when :disabled, :never
|
159
|
-
# SolarWindsAPM::Context.setTracingMode(SW_APM_TRACE_DISABLED)
|
160
|
-
#
|
161
|
-
# when :enabled, :always
|
162
|
-
# SolarWindsAPM::Context.setTracingMode(SW_APM_TRACE_ENABLED)
|
163
|
-
#
|
164
|
-
# else
|
165
|
-
# SolarWindsAPM.logger.fatal "[oboe/error] Invalid tracing mode set: #{mode}"
|
166
|
-
# SolarWindsAPM::Context.setTracingMode(SW_APM_TRACE_DISABLED)
|
167
|
-
# end
|
168
|
-
# end
|
169
|
-
|
170
|
-
def set_sample_rate(rate)
|
207
|
+
def sample_rate(rate)
|
171
208
|
return unless SolarWindsAPM.loaded
|
172
209
|
|
173
210
|
# Update liboboe with the new SampleRate value
|
@@ -175,7 +212,6 @@ module SolarWindsAPM
|
|
175
212
|
end
|
176
213
|
end
|
177
214
|
end
|
178
|
-
# rubocop:enable Style/Documentation
|
179
215
|
|
180
216
|
SolarWindsAPM.loaded = true
|
181
|
-
|
217
|
+
# rubocop:enable Style/Documentation
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
4
|
module SolarWindsAPM
|
5
|
+
# InstallGenerator
|
5
6
|
class InstallGenerator < ::Rails::Generators::Base
|
6
7
|
source_root File.join(File.dirname(__FILE__), 'templates')
|
7
8
|
desc "Copies a SolarWindsAPM gem initializer file to your application."
|
@@ -20,7 +21,6 @@ module SolarWindsAPM
|
|
20
21
|
|
21
22
|
private
|
22
23
|
|
23
|
-
# rubocop:disable Metrics/MethodLength
|
24
24
|
def print_header
|
25
25
|
say ""
|
26
26
|
say shell.set_color "Welcome to the SolarWindsAPM Ruby instrumentation setup.", :green, :bold
|
@@ -34,7 +34,6 @@ module SolarWindsAPM
|
|
34
34
|
say "More information on instrumenting Ruby applications can be found here:"
|
35
35
|
say "https://documentation.solarwinds.com/en/success_center/observability/default.htm#cshid=config-ruby-agent"
|
36
36
|
end
|
37
|
-
# rubocop:enable Metrics/MethodLength
|
38
37
|
|
39
38
|
def print_footer
|
40
39
|
say ""
|