solarwinds_apm 6.0.2 → 6.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +6 -0
- data/README.md +124 -0
- data/ext/oboe_metal/extconf.rb +40 -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-lambda-aarch64.so.sha256 +1 -1
- data/ext/oboe_metal/lib/liboboe-1.0-lambda-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 +2 -1
- data/ext/oboe_metal/src/oboe_api.cpp +5 -3
- data/ext/oboe_metal/src/oboe_api.h +2 -1
- data/ext/oboe_metal/src/oboe_swig_wrap.cc +11 -3
- data/lib/oboe_metal.rb +8 -4
- data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +1 -1
- data/lib/solarwinds_apm/constants.rb +1 -1
- data/lib/solarwinds_apm/noop/README.md +3 -0
- data/lib/solarwinds_apm/oboe_init_options.rb +14 -1
- data/lib/solarwinds_apm/opentelemetry/otlp_processor.rb +7 -5
- data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +2 -2
- data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +4 -3
- data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +2 -0
- data/lib/solarwinds_apm/opentelemetry.rb +2 -0
- data/lib/solarwinds_apm/otel_config.rb +10 -0
- data/lib/solarwinds_apm/otel_lambda_config.rb +6 -3
- data/lib/solarwinds_apm/patch/tag_sql/sw_mysql2_patch.rb +36 -0
- data/lib/solarwinds_apm/patch/tag_sql_patch.rb +9 -0
- data/lib/solarwinds_apm/support/service_key_checker.rb +2 -7
- data/lib/solarwinds_apm/support/swomarginalia/README.md +9 -4
- data/lib/solarwinds_apm/support/swomarginalia/formatter.rb +20 -0
- data/lib/solarwinds_apm/support.rb +0 -25
- data/lib/solarwinds_apm/version.rb +2 -2
- metadata +7 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ab7453d8ca9dc042ac880b99dd8cd11d6344e3372bb84b2fab1e6b4fa3d65ab
|
4
|
+
data.tar.gz: '009803a9d3ad0f678824c57dca3031ef3b9f79989c00fecb16946962cb641f1e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d80d9759f1050927d249d9ac1264eb6bd5407603cf2fee8c09ce27137c6b39773ea3f7b57dd7e5c428890a9ee27f7ba1cc02d20672bef43cfb0470f04de0b70c
|
7
|
+
data.tar.gz: 664ade107e0f49a1709d0d5b87012ea6766094d469b3942afb10100a63c066735f512bb7d2aafae5925b99f4a305f4d2f2a31101090f3bddeee68e722e6efafd
|
data/.yardopts
ADDED
data/README.md
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
# solarwinds_apm
|
2
|
+
|
3
|
+
The `solarwinds_apm` gem starting from version 6.0.0 is an [OpenTelemetry Ruby](https://opentelemetry.io/docs/instrumentation/ruby/) distribution. It provides automatic instrumentation and custom SolarWinds Observability features for Ruby applications.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
Only Linux is supported, the gem will go into no-op mode on other platforms. MRI Ruby version 3 or above is required. The [SolarWinds Observability documentation website](https://documentation.solarwinds.com/en/success_center/observability/content/configure/services/ruby/install.htm) has details on the supported platforms and system dependencies.
|
8
|
+
|
9
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to build for development.
|
10
|
+
|
11
|
+
## Installation and Setup
|
12
|
+
|
13
|
+
`solarwinds_apm` is [available on Rubygems](https://rubygems.org/gems/solarwinds_apm). Install with:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
gem install solarwinds_apm
|
17
|
+
```
|
18
|
+
|
19
|
+
Or add to **the end** of your application Gemfile and run `bundle install` if managing gems with Bundler:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# application dependencies, eg
|
23
|
+
# gem "rails", "~> 7.0.5", ">= 7.0.5.1"
|
24
|
+
|
25
|
+
# end of Gemfile
|
26
|
+
gem 'solarwinds_apm'
|
27
|
+
```
|
28
|
+
|
29
|
+
Ideally all application gems are required by `Bundler.require`, which guarantees loading in the order they appear in the Gemfile. If `Bundler.require` does not require all application gems, call `require 'solarwinds_apm'` after all gems that need instrumentation are loaded.
|
30
|
+
|
31
|
+
The only required configuration is the service key, which can be set in the `SW_APM_SERVICE_KEY` environment variable or in the configuration file as `:service_key`. See [CONFIGURATION.md](CONFIGURATION.md) for the complete reference.
|
32
|
+
|
33
|
+
## Custom Instrumentation
|
34
|
+
|
35
|
+
`solarwinds_apm` supports the standard OpenTelemetry API for tracing and includes a helper to ease its use in manual instrumentation. Additionally, a set of SolarWindsAPM APIs are provided for features specific to SolarWinds Observability.
|
36
|
+
|
37
|
+
### Using the OpenTelemetry API
|
38
|
+
|
39
|
+
This gem installs the dependencies needed to use the OTel API and initializes the globally-registered `TracerProvider`. So the "Setup" and "Acquiring a Tracer" sections of the [OTel Ruby Manual Instrumentation](https://opentelemetry.io/docs/instrumentation/ruby/manual/) should be skipped. Instead, your application code should acquire a `Tracer` from the global `TracerProvider` as follows.
|
40
|
+
|
41
|
+
The `Tracer` object is determined by the service name, which is the portion after the colon (`:`) set in the `SW_APM_SERVICE_KEY` or `:service_key` configuration. The service name is also automatically set into the `OTEL_SERVICE_NAME` environment variable which can be referenced as shown below. The `Tracer` object can then be used as described in the OTel Ruby documentation.
|
42
|
+
|
43
|
+
The example below shows how the standard OTel API to [create a span](https://opentelemetry.io/docs/instrumentation/ruby/manual/#creating-new-spans) and [get the current span](https://opentelemetry.io/docs/instrumentation/ruby/manual/#get-the-current-span) can be used in an application where `solarwinds_apm` has been loaded. See also the convenience [wrapper for in_span provided by the SolarWindsAPM API](#convenience-method-for-in_span):
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# acquire the tracer
|
47
|
+
MyAppTracer = ::OpenTelemetry.tracer_provider.tracer(ENV['OTEL_SERVICE_NAME'])
|
48
|
+
|
49
|
+
# create a new span
|
50
|
+
MyAppTracer.in_span('new.span', attributes: {'key1' => 'value1', 'key2' => 'value2'}) do |span|
|
51
|
+
# do things
|
52
|
+
end
|
53
|
+
|
54
|
+
# work with the current span
|
55
|
+
current_span = ::OpenTelemetry::Trace.current_span
|
56
|
+
# current_span.add_attributes
|
57
|
+
# current_span.add_event
|
58
|
+
# current_span.record_exception
|
59
|
+
```
|
60
|
+
|
61
|
+
Note that if `OpenTelemetry::SDK.configure` is used to set up a `TracerProvider`, it will not be configured with our distribution's customizations and manual instrumentation made with its `Tracer` object will not be reported to SolarWinds Observability.
|
62
|
+
|
63
|
+
### Using the SolarWindsAPM API
|
64
|
+
|
65
|
+
Several convenience and vendor-specific APIs are availabe to an application where `solarwinds_apm` has been loaded, below is a quick overview of the features provided. The full reference can be found at the [RubyDoc page for this gem](https://rubydoc.info/github/solarwinds/apm-ruby).
|
66
|
+
|
67
|
+
#### Convenience Method for in_span
|
68
|
+
|
69
|
+
This method acquires the correct `Tracer` so a new span can be created in a single call, below is a simple Rails controller example:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
class StaticController < ApplicationController
|
73
|
+
def home
|
74
|
+
SolarWindsAPM::API.in_span('custom_span') do |span|
|
75
|
+
# do things
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
#### Get Curent Trace Context Information
|
82
|
+
|
83
|
+
The `current_trace_info` method returns a `TraceInfo` object containing string representations of the current trace context that can be used in logging or manual propagation of context. This is a convenience method that wraps the OTel API `::OpenTelemetry::Trace.current_span`.
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
trace = SolarWindsAPM::API.current_trace_info
|
87
|
+
|
88
|
+
trace.tracestring # 00-7435a9fe510ae4533414d425dadf4e18-49e60702469db05f-01
|
89
|
+
trace.trace_id # 7435a9fe510ae4533414d425dadf4e18
|
90
|
+
trace.span_id # 49e60702469db05f
|
91
|
+
trace.trace_flags # 01
|
92
|
+
```
|
93
|
+
|
94
|
+
#### Check if solarwinds_apm Is Ready
|
95
|
+
|
96
|
+
On startup, this library initializes and maintains a connection to a SolarWinds Observability collector, and receives settings used for making tracing decisions. This process can take up to a few seconds depending on the connection. If the application receives requests before initialization has completed, these requests will not be traced. While this is not critical for long-running server processes, it might be a problem for short-running apps such as cron jobs or CLI apps.
|
97
|
+
|
98
|
+
A call to the `solarwinds_ready` method allows the application to block until initialization has completed and the library is ready for tracing. The method accepts an optional timeout parameter in milliseconds.
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
SolarWindsAPM::API.solarwinds_ready(wait_milliseconds=3000)
|
102
|
+
```
|
103
|
+
|
104
|
+
#### Set a Custom Transaction Name
|
105
|
+
|
106
|
+
By default, transaction names are constructed based on attributes such as the requested route in the server framework, or the span name. If this name is not descriptive enough, you can override it with a custom one. If multiple transaction names are set on the same trace, the last transaction name is used.
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
result = SolarWindsAPM::API.set_transaction_name('my-custom-trace-name')
|
110
|
+
```
|
111
|
+
|
112
|
+
#### Send Custom Metrics
|
113
|
+
|
114
|
+
Service metrics are automatically collected by this library. In addition, the following methods support sending two types of custom metrics:
|
115
|
+
|
116
|
+
* `increment_metric` - counts the number of times something has occurred
|
117
|
+
* `summary_metric` - a specific value for the default count of 1, or the sum of values if count > 1
|
118
|
+
|
119
|
+
The metrics submitted are aggregated by metric name and tag(s), then sent every 60 seconds.
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
SolarWindsAPM::API.increment_metric('loop.iteration')
|
123
|
+
SolarWindsAPM::API.summary_metric('sleep.time', 5000)
|
124
|
+
```
|
data/ext/oboe_metal/extconf.rb
CHANGED
@@ -18,24 +18,33 @@ CONFIG['warnflags'] = CONFIG['warnflags'].gsub('-Wdeclaration-after-statement',
|
|
18
18
|
init_mkmf(CONFIG)
|
19
19
|
|
20
20
|
ext_dir = __dir__
|
21
|
+
oboe_env = ENV.fetch('OBOE_ENV', nil)
|
22
|
+
non_production = %w[dev stg].include? oboe_env.to_s
|
21
23
|
|
22
|
-
# Set the mkmf lib paths so we have no issues linking to
|
23
|
-
# the SolarWindsAPM libs.
|
24
24
|
swo_lib_dir = File.join(ext_dir, 'lib')
|
25
|
-
|
25
|
+
version = File.read(File.join(ext_dir, 'src', 'VERSION')).strip
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
if ENV['OBOE_DEV'].to_s.casecmp('true').zero?
|
27
|
+
case oboe_env
|
28
|
+
when 'dev'
|
30
29
|
swo_path = 'https://solarwinds-apm-staging.s3.us-west-2.amazonaws.com/apm/c-lib/nightly'
|
31
30
|
puts 'Fetching c-lib from DEVELOPMENT Build'
|
32
|
-
|
31
|
+
when 'stg'
|
33
32
|
swo_path = File.join('https://agent-binaries.global.st-ssp.solarwinds.com/apm/c-lib/', version)
|
34
|
-
puts 'Fetching c-lib from STAGING'
|
33
|
+
puts 'Fetching c-lib from STAGING Build'
|
35
34
|
else
|
36
35
|
swo_path = File.join('https://agent-binaries.cloud.solarwinds.com/apm/c-lib/', version)
|
36
|
+
puts 'Fetching c-lib from PRODUCTION Build'
|
37
37
|
end
|
38
38
|
|
39
|
+
oboe_debug = ENV['OBOE_DEBUG'].to_s.casecmp('true').zero?
|
40
|
+
|
41
|
+
if oboe_debug
|
42
|
+
swo_path = File.join(swo_path, 'relwithdebinfo')
|
43
|
+
puts "Fetching DEBUG Build based on #{oboe_env.to_s.empty? ? 'prod' : oboe_env}"
|
44
|
+
end
|
45
|
+
|
46
|
+
puts "final swo_path: #{swo_path}"
|
47
|
+
|
39
48
|
swo_arch = 'x86_64'
|
40
49
|
system_arch = `uname -m` # for mac, the command is `uname` # "Darwin\n"; try `uname -a`
|
41
50
|
system_arch.delete!("\n")
|
@@ -70,14 +79,18 @@ while retries.positive?
|
|
70
79
|
begin
|
71
80
|
IO.copy_stream(URI.parse(swo_item).open, clib)
|
72
81
|
clib_checksum = Digest::SHA256.file(clib).hexdigest
|
73
|
-
checksum =
|
82
|
+
checksum = File.read(swo_checksum_file).strip
|
83
|
+
|
84
|
+
# sha256 always from prod, so no matching for stg or nightly build or debug mode
|
85
|
+
# so ignore the sha comparsion when fetching from development and staging build
|
86
|
+
checksum = clib_checksum if non_production || oboe_debug
|
74
87
|
|
75
88
|
# unfortunately these messages only show if the install command is run
|
76
89
|
# with the `--verbose` flag
|
77
90
|
if clib_checksum == checksum
|
78
91
|
success = true
|
79
|
-
retries = 0
|
80
92
|
else
|
93
|
+
puts 'Checksum Verification Fail' # this is mainly for testing
|
81
94
|
warn '== ERROR ================================================================='
|
82
95
|
warn 'Checksum Verification failed for the c-extension of the solarwinds_apm gem'
|
83
96
|
warn 'Installation cannot continue'
|
@@ -85,8 +98,8 @@ while retries.positive?
|
|
85
98
|
warn "Checksum calculated from lib: #{clib_checksum}"
|
86
99
|
warn 'Contact technicalsupport@solarwinds.com if the problem persists'
|
87
100
|
warn '=========================================================================='
|
88
|
-
exit 1
|
89
101
|
end
|
102
|
+
retries = 0
|
90
103
|
rescue StandardError => e
|
91
104
|
File.write(clib, '')
|
92
105
|
retries -= 1
|
@@ -113,27 +126,31 @@ if success
|
|
113
126
|
dir_config('oboe', 'src', 'lib')
|
114
127
|
|
115
128
|
# create Makefile
|
116
|
-
if have_library('oboe'
|
129
|
+
if have_library('oboe')
|
117
130
|
$libs = append_library($libs, 'oboe')
|
118
131
|
$libs = append_library($libs, 'stdc++')
|
119
132
|
|
120
133
|
$CFLAGS << " #{ENV.fetch('CFLAGS', nil)}"
|
121
|
-
|
122
|
-
#
|
123
|
-
|
124
|
-
|
125
|
-
|
134
|
+
|
135
|
+
# -pg option is used for generating profiling information with gprof
|
136
|
+
$CPPFLAGS << if oboe_debug
|
137
|
+
" #{ENV.fetch('CPPFLAGS', nil)} -std=c++11 -gdwarf-2 -I$$ORIGIN/../ext/oboe_metal/src"
|
138
|
+
else
|
139
|
+
" #{ENV.fetch('CPPFLAGS', nil)} -std=c++11 -I$$ORIGIN/../ext/oboe_metal/src"
|
140
|
+
end
|
141
|
+
|
126
142
|
$LIBS << " #{ENV.fetch('LIBS', nil)}"
|
127
143
|
|
128
|
-
#
|
129
|
-
#
|
144
|
+
# -lrt option is used when linking programs with the GNU Compiler Collection (GCC) to
|
145
|
+
# include the POSIX real-time extensions library, librt.
|
130
146
|
$LDFLAGS << " #{ENV.fetch('LDFLAGS', nil)} '-Wl,-rpath=$$ORIGIN/../ext/oboe_metal/lib' -lrt"
|
131
147
|
$CXXFLAGS += ' -std=c++11 '
|
132
148
|
|
133
|
-
#
|
134
|
-
|
135
|
-
|
136
|
-
|
149
|
+
# OBOE_DEBUG need to be enabled before downloading and installing the gem
|
150
|
+
if oboe_debug
|
151
|
+
CONFIG['debugflags'] = '-ggdb3 '
|
152
|
+
CONFIG['optflags'] = '-O0'
|
153
|
+
end
|
137
154
|
|
138
155
|
create_makefile('libsolarwinds_apm', 'src')
|
139
156
|
else
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
53295ec020a713c5f6fe7c14b150a10ac7db0e5ea692fbd6945ee69f7a581271
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
37407ece6aafcb662fbce8eb23f98a9b017154c66c8ec02eda835702ba14f446
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
925d65c2a940a82315525ea2e82eb357793f7db8a2a8ec529e7c03e2478bc965
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3d49133827a0b6839744231e3ca49f8c9340380063286b8c3794bde585370001
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
e2198827ce86309a59def33be14f17d0474477df33a5d75bd415d73a01c790b3
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
798a7c9551c66af743e1d6d2b736bf5667fa97fdc0ac8eec825fe4f63adaa044
|
data/ext/oboe_metal/src/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
15.0.
|
1
|
+
15.0.3
|
data/ext/oboe_metal/src/oboe.h
CHANGED
@@ -161,7 +161,7 @@ typedef struct oboe_metric_tag {
|
|
161
161
|
} oboe_metric_tag_t;
|
162
162
|
|
163
163
|
typedef struct oboe_init_options {
|
164
|
-
int version; // the version of this structure (currently on version
|
164
|
+
int version; // the version of this structure (currently on version 17)
|
165
165
|
const char *hostname_alias; // optional hostname alias
|
166
166
|
int log_level; // level at which log messages will be written to log file (0-6)
|
167
167
|
// use OBOE_INIT_LOG_LEVEL_INFO(3) for default log level
|
@@ -188,6 +188,7 @@ typedef struct oboe_init_options {
|
|
188
188
|
// only used in lambda reporter (off=0, on=1, default off)
|
189
189
|
int metric_format; // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
|
190
190
|
int log_type; // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
|
191
|
+
int defer_init; // defer init (0 = disable; 1 = enabled, parent process will not init oboe but fork child process will init oboe; default = 0)
|
191
192
|
} oboe_init_options_t;
|
192
193
|
|
193
194
|
typedef struct oboe_span_params {
|
@@ -587,11 +587,12 @@ Reporter::Reporter(
|
|
587
587
|
int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
|
588
588
|
// only used in lambda reporter (off=0, on=1, default off)
|
589
589
|
int metric_format, // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
|
590
|
-
int log_type
|
590
|
+
int log_type, // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
|
591
|
+
int defer_init // defer init (0 = disable; 1 = enabled, parent process will not init oboe but fork child process will init oboe; default = 0)
|
591
592
|
) {
|
592
593
|
oboe_init_options_t options;
|
593
594
|
memset(&options, 0, sizeof(options));
|
594
|
-
options.version =
|
595
|
+
options.version = 17;
|
595
596
|
oboe_init_options_set_defaults(&options);
|
596
597
|
|
597
598
|
if (hostname_alias != "") {
|
@@ -628,6 +629,7 @@ Reporter::Reporter(
|
|
628
629
|
options.stdout_clear_nonblocking = stdout_clear_nonblocking;
|
629
630
|
options.metric_format = metric_format;
|
630
631
|
options.log_type = log_type;
|
632
|
+
options.defer_init = defer_init;
|
631
633
|
init_status = oboe_init(&options);
|
632
634
|
}
|
633
635
|
|
@@ -694,7 +696,7 @@ std::string Config::getVersionString() {
|
|
694
696
|
OboeAPI::OboeAPI(const OboeAPIOptions& options) {
|
695
697
|
oboe_init_options_t oboe_options;
|
696
698
|
memset(&oboe_options, 0, sizeof(oboe_options));
|
697
|
-
oboe_options.version =
|
699
|
+
oboe_options.version = 17;
|
698
700
|
oboe_init_options_set_defaults(&oboe_options);
|
699
701
|
oboe_options.log_level = options.logging_options.level;
|
700
702
|
oboe_options.log_type = options.logging_options.type;
|
@@ -463,7 +463,8 @@ class Reporter : private oboe_reporter_t {
|
|
463
463
|
int stdout_clear_nonblocking, // flag indicating if the O_NONBLOCK flag on stdout should be cleared,
|
464
464
|
// only used in lambda reporter (off=0, on=1, default off)
|
465
465
|
int metric_format, // flag indicating the format of metric (0 = Both; 1 = TransactionResponseTime only; 2 = ResponseTime only; default = 0)
|
466
|
-
int log_type
|
466
|
+
int log_type, // log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
|
467
|
+
int defer_init // defer init (0 = disable; 1 = enabled, parent process will not init oboe but fork child process will init oboe; default = 0)
|
467
468
|
);
|
468
469
|
|
469
470
|
~Reporter();
|
@@ -6870,6 +6870,7 @@ _wrap_new_Reporter(int argc, VALUE *argv, VALUE self) {
|
|
6870
6870
|
int arg20 ;
|
6871
6871
|
int arg21 ;
|
6872
6872
|
int arg22 ;
|
6873
|
+
int arg23 ;
|
6873
6874
|
int val2 ;
|
6874
6875
|
int ecode2 = 0 ;
|
6875
6876
|
int val4 ;
|
@@ -6900,10 +6901,12 @@ _wrap_new_Reporter(int argc, VALUE *argv, VALUE self) {
|
|
6900
6901
|
int ecode21 = 0 ;
|
6901
6902
|
int val22 ;
|
6902
6903
|
int ecode22 = 0 ;
|
6904
|
+
int val23 ;
|
6905
|
+
int ecode23 = 0 ;
|
6903
6906
|
Reporter *result = 0 ;
|
6904
6907
|
|
6905
|
-
if ((argc <
|
6906
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for
|
6908
|
+
if ((argc < 23) || (argc > 23)) {
|
6909
|
+
rb_raise(rb_eArgError, "wrong # of arguments(%d for 23)",argc); SWIG_fail;
|
6907
6910
|
}
|
6908
6911
|
{
|
6909
6912
|
std::string *ptr = (std::string *)0;
|
@@ -7043,7 +7046,12 @@ _wrap_new_Reporter(int argc, VALUE *argv, VALUE self) {
|
|
7043
7046
|
SWIG_exception_fail(SWIG_ArgError(ecode22), Ruby_Format_TypeError( "", "int","Reporter", 22, argv[21] ));
|
7044
7047
|
}
|
7045
7048
|
arg22 = static_cast< int >(val22);
|
7046
|
-
|
7049
|
+
ecode23 = SWIG_AsVal_int(argv[22], &val23);
|
7050
|
+
if (!SWIG_IsOK(ecode23)) {
|
7051
|
+
SWIG_exception_fail(SWIG_ArgError(ecode23), Ruby_Format_TypeError( "", "int","Reporter", 23, argv[22] ));
|
7052
|
+
}
|
7053
|
+
arg23 = static_cast< int >(val23);
|
7054
|
+
result = (Reporter *)new Reporter(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19,arg20,arg21,arg22,arg23);
|
7047
7055
|
DATA_PTR(self) = result;
|
7048
7056
|
return self;
|
7049
7057
|
fail:
|
data/lib/oboe_metal.rb
CHANGED
@@ -14,9 +14,10 @@ module SolarWindsAPM
|
|
14
14
|
@loaded = false
|
15
15
|
@reporter = nil
|
16
16
|
@oboe_api = nil
|
17
|
+
@init_sent = false
|
17
18
|
|
18
19
|
class << self
|
19
|
-
attr_accessor :reporter, :loaded, :oboe_api
|
20
|
+
attr_accessor :reporter, :loaded, :oboe_api, :init_sent
|
20
21
|
|
21
22
|
def sample_rate(rate)
|
22
23
|
return unless SolarWindsAPM.loaded
|
@@ -38,7 +39,7 @@ module SolarWindsAPM
|
|
38
39
|
options = SolarWindsAPM::OboeInitOptions.instance.array_for_oboe # creates an array with the options in the right order
|
39
40
|
SolarWindsAPM.reporter = Oboe_metal::Reporter.new(*options)
|
40
41
|
SolarWindsAPM.loaded = true
|
41
|
-
report_init
|
42
|
+
report_init if (options[22]).zero? # report init at beginning if no after fork enabled
|
42
43
|
rescue StandardError => e
|
43
44
|
warn e.message
|
44
45
|
SolarWindsAPM.loaded = false
|
@@ -70,12 +71,15 @@ module SolarWindsAPM
|
|
70
71
|
# layer.
|
71
72
|
#
|
72
73
|
def report_init(layer = :rack) # :nodoc:
|
73
|
-
# Don't send __Init in test or if SolarWindsAPM
|
74
|
-
#
|
74
|
+
# Don't send __Init in test or if SolarWindsAPM isn't fully loaded (e.g. missing c-extension)
|
75
|
+
# or if already sent (e.g. SolarWindsAPM.init_sent = true)
|
76
|
+
return if SolarWindsAPM.init_sent
|
75
77
|
return unless SolarWindsAPM.loaded
|
76
78
|
|
77
79
|
platform_info = build_swo_init_report
|
78
80
|
log_init(layer, platform_info)
|
81
|
+
|
82
|
+
SolarWindsAPM.init_sent = true
|
79
83
|
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] Init message has been sent." }
|
80
84
|
end
|
81
85
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# 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.
|
8
8
|
|
9
9
|
# SolarWindsAPM Configuration for the Ruby Agent aka solarwinds_apm gem
|
10
|
-
# https://
|
10
|
+
# https://www.solarwinds.com/solarwinds-observability/registration
|
11
11
|
#
|
12
12
|
# More information on configuring the Ruby Agent can be found here:
|
13
13
|
# https://documentation.solarwinds.com/en/success_center/swaas/default.htm#cshid=config-ruby-agent
|
@@ -29,7 +29,7 @@ module SolarWindsAPM
|
|
29
29
|
INTL_SWO_SUPPORT_EMAIL = 'SWO-support@solarwinds.com'
|
30
30
|
INTL_SWO_OTEL_SCOPE_NAME = 'otel.scope.name'
|
31
31
|
INTL_SWO_OTEL_SCOPE_VERSION = 'otel.scope.version'
|
32
|
-
INTL_SWO_OTEL_STATUS = 'otel.
|
32
|
+
INTL_SWO_OTEL_STATUS = 'otel.status_code'
|
33
33
|
INTL_SWO_OTEL_STATUS_DESCRIPTION = 'otel.status_description'
|
34
34
|
INTERNAL_TRIGGERED_TRACE = 'TriggeredTrace'
|
35
35
|
end
|
@@ -67,6 +67,8 @@ module SolarWindsAPM
|
|
67
67
|
@metric_format = determine_the_metric_model
|
68
68
|
# log type (0 = stderr; 1 = stdout; 2 = file; 3 = null; 4 = disabled; default = 0)
|
69
69
|
@log_type = determine_oboe_log_type
|
70
|
+
# after fork enablement (0 = disable; 1 = enabled, parent process will not init oboe but fork child process will init oboe; default = 0)
|
71
|
+
@after_fork = determine_oboe_after_fork
|
70
72
|
end
|
71
73
|
|
72
74
|
# for testing with changed ENV vars
|
@@ -97,7 +99,8 @@ module SolarWindsAPM
|
|
97
99
|
@grpc_proxy, # 18
|
98
100
|
0, # 19 arg for lambda (no lambda for ruby yet)
|
99
101
|
@metric_format, # 20
|
100
|
-
@log_type
|
102
|
+
@log_type, # 21
|
103
|
+
@after_fork # 22
|
101
104
|
]
|
102
105
|
end
|
103
106
|
|
@@ -176,8 +179,14 @@ module SolarWindsAPM
|
|
176
179
|
(allowed_uri.include? ENV.fetch('SW_APM_COLLECTOR', nil))
|
177
180
|
end
|
178
181
|
|
182
|
+
def java_collector?(uri)
|
183
|
+
java_collector_regex = /java-collector:\d+/
|
184
|
+
uri.match?(java_collector_regex)
|
185
|
+
end
|
186
|
+
|
179
187
|
def sanitize_collector_uri(uri)
|
180
188
|
return uri if uri.nil? || uri.empty?
|
189
|
+
return uri if java_collector?(uri)
|
181
190
|
|
182
191
|
begin
|
183
192
|
sanitized_uri = ::URI.parse("http://#{uri}").host
|
@@ -205,5 +214,9 @@ module SolarWindsAPM
|
|
205
214
|
true
|
206
215
|
end
|
207
216
|
end
|
217
|
+
|
218
|
+
def determine_oboe_after_fork
|
219
|
+
ENV['SW_APM_ENABLE_AFTER_FORK'].to_s == 'true' ? 1 : 0
|
220
|
+
end
|
208
221
|
end
|
209
222
|
end
|
@@ -22,7 +22,7 @@ module SolarWindsAPM
|
|
22
22
|
# @param [Context] parent_context the
|
23
23
|
# started span.
|
24
24
|
def on_start(span, parent_context)
|
25
|
-
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] processor on_start span: #{span.inspect}" }
|
25
|
+
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] processor on_start span: #{span.to_span_data.inspect}" }
|
26
26
|
|
27
27
|
return if non_entry_span(parent_context: parent_context)
|
28
28
|
|
@@ -70,10 +70,11 @@ module SolarWindsAPM
|
|
70
70
|
'sw.transaction' => calculate_lambda_transaction_name(span)
|
71
71
|
}
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
if span_http?(span)
|
74
|
+
http_status_code = get_http_status_code(span)
|
75
|
+
meter_attrs['http.status_code'] = http_status_code if http_status_code != 0
|
76
|
+
meter_attrs['http.method'] = span.attributes[HTTP_METHOD] if span.attributes[HTTP_METHOD]
|
77
|
+
end
|
77
78
|
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] meter_attrs: #{meter_attrs.inspect}" }
|
78
79
|
meter_attrs
|
79
80
|
end
|
@@ -100,6 +101,7 @@ module SolarWindsAPM
|
|
100
101
|
def record_request_metrics(span)
|
101
102
|
meter_attrs = meter_attributes(span)
|
102
103
|
span_time = calculate_span_time(start_time: span.start_timestamp, end_time: span.end_timestamp)
|
104
|
+
span_time = (span_time / 1e3).round
|
103
105
|
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] entry span, response_time: #{span_time}." }
|
104
106
|
@metrics[:response_time].record(span_time, attributes: meter_attrs)
|
105
107
|
end
|
@@ -30,7 +30,7 @@ module SolarWindsAPM
|
|
30
30
|
# started span.
|
31
31
|
def on_start(span, parent_context)
|
32
32
|
SolarWindsAPM.logger.debug do
|
33
|
-
"[#{self.class}/#{__method__}] processor on_start span: #{span.inspect}, parent_context: #{parent_context.inspect}"
|
33
|
+
"[#{self.class}/#{__method__}] processor on_start span: #{span.to_span_data.inspect}, parent_context: #{parent_context.inspect}"
|
34
34
|
end
|
35
35
|
|
36
36
|
return if non_entry_span(parent_context: parent_context)
|
@@ -47,7 +47,7 @@ module SolarWindsAPM
|
|
47
47
|
#
|
48
48
|
# @param [Span] span the {Span} that just ended.
|
49
49
|
def on_finish(span)
|
50
|
-
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] processor on_finish span: #{span.inspect}" }
|
50
|
+
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] processor on_finish span: #{span.to_span_data.inspect}" }
|
51
51
|
|
52
52
|
return if non_entry_span(span: span)
|
53
53
|
|
@@ -35,9 +35,10 @@ module SolarWindsAPM
|
|
35
35
|
def inject(carrier, context: ::OpenTelemetry::Context.current,
|
36
36
|
setter: ::OpenTelemetry::Context::Propagation.text_map_setter)
|
37
37
|
span_context = ::OpenTelemetry::Trace.current_span(context).context
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
|
39
|
+
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] context current_span: #{context.instance_variable_get(:@entries)&.values&.first.inspect}" }
|
40
|
+
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] span_context: #{span_context.inspect}" }
|
41
|
+
|
41
42
|
return unless span_context&.valid?
|
42
43
|
|
43
44
|
x_trace = Utils.traceparent_from_context(span_context)
|
@@ -55,6 +55,8 @@ module SolarWindsAPM
|
|
55
55
|
attributes: #{attributes}"
|
56
56
|
end
|
57
57
|
|
58
|
+
SolarWindsAPM::Reporter.send(:report_init) # This only happens if after_fork enabled
|
59
|
+
|
58
60
|
parent_span_context = ::OpenTelemetry::Trace.current_span(parent_context).context
|
59
61
|
xtraceoptions = ::SolarWindsAPM::XTraceOptions.new(parent_context)
|
60
62
|
SolarWindsAPM.logger.debug do
|
@@ -9,6 +9,8 @@
|
|
9
9
|
require 'opentelemetry/sdk'
|
10
10
|
require 'opentelemetry/instrumentation/all'
|
11
11
|
|
12
|
+
# TODO: in future, it should add opentelemetry-metrics-sdk and require it here
|
13
|
+
|
12
14
|
require_relative 'opentelemetry/solarwinds_propagator'
|
13
15
|
require_relative 'opentelemetry/solarwinds_processor'
|
14
16
|
require_relative 'opentelemetry/solarwinds_sampler'
|
@@ -111,6 +111,9 @@ module SolarWindsAPM
|
|
111
111
|
ENV['OTEL_LOG_LEVEL'] = SolarWindsAPM::Config::SW_LOG_LEVEL_MAPPING.dig(log_level, :otel)
|
112
112
|
end
|
113
113
|
|
114
|
+
# for dbo, traceparent injection as comments
|
115
|
+
require_relative 'patch/tag_sql_patch' if SolarWindsAPM::Config[:tag_sql]
|
116
|
+
|
114
117
|
::OpenTelemetry::SDK.configure { |c| c.use_all(@@config_map) }
|
115
118
|
|
116
119
|
validate_propagator(::OpenTelemetry.propagation.instance_variable_get(:@propagators))
|
@@ -126,6 +129,13 @@ module SolarWindsAPM
|
|
126
129
|
|
127
130
|
# configure sampler afterwards
|
128
131
|
::OpenTelemetry.tracer_provider.sampler = @@config[:sampler]
|
132
|
+
|
133
|
+
if ENV['SW_APM_AUTO_CONFIGURE'] == 'false'
|
134
|
+
SolarWindsAPM.logger.info '==================================================================='
|
135
|
+
SolarWindsAPM.logger.info "\e[1mSolarWindsAPM manual initialization was successful.\e[0m"
|
136
|
+
SolarWindsAPM.logger.info '==================================================================='
|
137
|
+
end
|
138
|
+
|
129
139
|
nil
|
130
140
|
end
|
131
141
|
|
@@ -30,7 +30,7 @@ module SolarWindsAPM
|
|
30
30
|
::OpenTelemetry.propagation.instance_variable_get(:@propagators).append(SolarWindsAPM::OpenTelemetry::SolarWindsPropagator::TextMapPropagator.new)
|
31
31
|
|
32
32
|
# register metrics_exporter to meter_provider
|
33
|
-
::OpenTelemetry.meter_provider.add_metric_reader(::OpenTelemetry::Exporter::OTLP::MetricsExporter.new)
|
33
|
+
::OpenTelemetry.meter_provider.add_metric_reader(::OpenTelemetry::Exporter::OTLP::Metrics::MetricsExporter.new)
|
34
34
|
|
35
35
|
# append our processors
|
36
36
|
::OpenTelemetry.tracer_provider.add_span_processor(SolarWindsAPM::OpenTelemetry::OTLPProcessor.new)
|
@@ -42,9 +42,12 @@ module SolarWindsAPM
|
|
42
42
|
remote_parent_not_sampled: SolarWindsAPM::OpenTelemetry::SolarWindsSampler.new
|
43
43
|
)
|
44
44
|
|
45
|
-
SolarWindsAPM.logger.
|
45
|
+
SolarWindsAPM.logger.info do
|
46
46
|
"[#{name}/#{__method__}] SolarWindsAPM lambda configuration initialized \
|
47
|
-
\
|
47
|
+
\n Installed instrumentation: #{::OpenTelemetry.tracer_provider.instance_variable_get(:@registry).keys} \
|
48
|
+
\n SpanProcessor: #{::OpenTelemetry.tracer_provider.instance_variable_get(:@span_processors).map(&:class)} \
|
49
|
+
\n Sampler: #{::OpenTelemetry.tracer_provider.instance_variable_get(:@sampler).inspect} \
|
50
|
+
\n Resource: #{::OpenTelemetry.tracer_provider.instance_variable_get(:@resource).inspect}"
|
48
51
|
end
|
49
52
|
|
50
53
|
nil
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
4
|
+
#
|
5
|
+
# 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
|
6
|
+
#
|
7
|
+
# 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.
|
8
|
+
|
9
|
+
module SolarWindsAPM
|
10
|
+
module Patch
|
11
|
+
module TagSql
|
12
|
+
module SWOMysql2Patch
|
13
|
+
def query(sql, options = {})
|
14
|
+
current_span = ::OpenTelemetry::Trace.current_span
|
15
|
+
|
16
|
+
annotated_sql = ''
|
17
|
+
if current_span.context.trace_flags.sampled?
|
18
|
+
traceparent = SolarWindsAPM::Utils.traceparent_from_context(current_span.context)
|
19
|
+
annotated_traceparent = "/*traceparent='#{traceparent}'*/"
|
20
|
+
current_span.add_attributes({ 'sw.query_tag' => annotated_traceparent })
|
21
|
+
annotated_sql = "#{sql} #{annotated_traceparent}"
|
22
|
+
else
|
23
|
+
annotated_sql = sql
|
24
|
+
end
|
25
|
+
|
26
|
+
super(annotated_sql, options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# need to prepend before mysql2 instrumentation prepend the original function
|
34
|
+
# after entire process, the call sequence will be:
|
35
|
+
# upstream instrumentation -> our patch -> original function
|
36
|
+
Mysql2::Client.prepend(SolarWindsAPM::Patch::TagSql::SWOMysql2Patch) if defined?(Mysql2::Client)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# © 2023 SolarWinds Worldwide, LLC. All rights reserved.
|
4
|
+
#
|
5
|
+
# 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
|
6
|
+
#
|
7
|
+
# 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.
|
8
|
+
|
9
|
+
require_relative 'tag_sql/sw_mysql2_patch'
|
@@ -26,7 +26,7 @@ module SolarWindsAPM
|
|
26
26
|
end
|
27
27
|
|
28
28
|
token, _, service_name = parse_service_key(service_key)
|
29
|
-
if token.empty?
|
29
|
+
if token.empty?
|
30
30
|
SolarWindsAPM.logger.error do
|
31
31
|
"[#{self.class}/#{__method__}] SW_APM_SERVICE_KEY problem. API Token in wrong format. Masked token: #{token[0..3]}...#{token[-4..]}"
|
32
32
|
end
|
@@ -66,7 +66,7 @@ module SolarWindsAPM
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def parse_service_key(service_key)
|
69
|
-
match = service_key.match(/([^:]
|
69
|
+
match = service_key.match(/([^:]*)(:{0,1})(.*)/)
|
70
70
|
return ['', '', ''] if match.nil?
|
71
71
|
|
72
72
|
[match[1], match[2], match[3]]
|
@@ -84,11 +84,6 @@ module SolarWindsAPM
|
|
84
84
|
end || ''
|
85
85
|
end
|
86
86
|
|
87
|
-
# In case of java-collector, please provide a dummy service key
|
88
|
-
def validate_token(token)
|
89
|
-
/^[0-9a-zA-Z_-]{71}$/.match?(token)
|
90
|
-
end
|
91
|
-
|
92
87
|
def transform_service_name(service_name)
|
93
88
|
name_ = service_name.dup
|
94
89
|
name_.downcase!
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# swomarginalia
|
1
|
+
# swomarginalia
|
2
2
|
|
3
3
|
This folder contains the code that is copied from original [marginalia](https://github.com/basecamp/marginalia)
|
4
4
|
|
5
5
|
## File structure
|
6
6
|
|
7
|
-
```
|
7
|
+
```console
|
8
8
|
|-- swomarginalia
|
9
9
|
| |-- LICENSE
|
10
10
|
| |-- README.md
|
@@ -17,25 +17,30 @@ This folder contains the code that is copied from original [marginalia](https://
|
|
17
17
|
## Modification
|
18
18
|
|
19
19
|
### railitie.rb
|
20
|
+
|
20
21
|
1. Moved prepend logic into load_swomarginalia.rb in case that non-rails app using activerecord
|
21
22
|
|
22
23
|
### swomarginlia.rb
|
24
|
+
|
23
25
|
1. Removed the alias_method to achieve function override; instead, we use prepend.
|
24
26
|
2. Added step of cleaning-up previous transparent comments
|
25
27
|
|
26
28
|
### comment.rb
|
29
|
+
|
27
30
|
1. Added the traceparent comment (trace string constructed based on opentelemetry)
|
28
31
|
|
29
32
|
### load_swomarginalia.rb
|
33
|
+
|
30
34
|
1. (new file) prepend the ActiveRecordInstrumentation to activerecord adapter
|
31
35
|
|
32
36
|
## Example
|
33
37
|
|
34
38
|
### Sample output of rails application
|
35
39
|
|
36
|
-
```
|
40
|
+
```console
|
37
41
|
Post Load (1.1ms) SELECT `posts`.* FROM `posts` /*application=SqlcommenterRailsDemo,controller=posts,action=index,traceparent=00-a448f096d441e167d12ebd32a927c1a5-a29655a47e430119-01*/
|
38
42
|
```
|
39
43
|
|
40
44
|
## License
|
41
|
-
|
45
|
+
|
46
|
+
This project is licensed under the [MIT License](https://github.com/solarwinds/apm-ruby/blob/main/lib/solarwinds_apm/support/swomarginalia/LICENSE).
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolarWindsAPM
|
4
|
+
module SWOMarginalia
|
5
|
+
module Formatter
|
6
|
+
def tag_content
|
7
|
+
comment = super
|
8
|
+
comment.tr!(':', '=')
|
9
|
+
comment
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Prepend the Formatter module to the singleton class of ActiveRecord::QueryLogs
|
16
|
+
if defined?(ActiveRecord::QueryLogs)
|
17
|
+
class << ActiveRecord::QueryLogs
|
18
|
+
prepend SolarWindsAPM::SWOMarginalia::Formatter
|
19
|
+
end
|
20
|
+
end
|
@@ -18,28 +18,3 @@ require_relative 'support/txn_name_manager'
|
|
18
18
|
require_relative 'support/utils'
|
19
19
|
require_relative 'support/x_trace_options'
|
20
20
|
require_relative 'support/support_report'
|
21
|
-
|
22
|
-
if SolarWindsAPM::Config[:tag_sql]
|
23
|
-
if defined?(Rails)
|
24
|
-
if Rails.version < '7'
|
25
|
-
require_relative 'support/swomarginalia/railtie'
|
26
|
-
elsif Rails.version >= '7'
|
27
|
-
# User has to define in their config/environments:
|
28
|
-
# config.active_record.query_log_tags = [
|
29
|
-
# {
|
30
|
-
# tracecontext: -> {
|
31
|
-
# SolarWindsAPM::SWOMarginalia::Comment.traceparent
|
32
|
-
# }
|
33
|
-
# }
|
34
|
-
# ]
|
35
|
-
SolarWindsAPM.logger.info do
|
36
|
-
'In Rails 7, tag tracecontext on a query by including SolarWindsAPM::SWOMarginalia::Comment.traceparent as function in config.active_record.query_log_tags.'
|
37
|
-
end
|
38
|
-
SolarWindsAPM.logger.info { 'For more information, please check https://api.rubyonrails.org/classes/ActiveRecord/QueryLogs.html' }
|
39
|
-
require_relative 'support/swomarginalia/comment'
|
40
|
-
end
|
41
|
-
elsif defined?(ActiveRecord)
|
42
|
-
require_relative 'support/swomarginalia/load_swomarginalia'
|
43
|
-
SolarWindsAPM::SWOMarginalia::LoadSWOMarginalia.insert
|
44
|
-
end
|
45
|
-
end
|
@@ -12,8 +12,8 @@ module SolarWindsAPM
|
|
12
12
|
# solarwinds_apm.gemspec during gem build process
|
13
13
|
module Version
|
14
14
|
MAJOR = 6 # breaking,
|
15
|
-
MINOR =
|
16
|
-
PATCH =
|
15
|
+
MINOR = 1 # feature,
|
16
|
+
PATCH = 1 # fix => BFF
|
17
17
|
PRE = nil
|
18
18
|
|
19
19
|
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
|
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.
|
4
|
+
version: 6.1.1
|
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-12-09 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: opentelemetry-instrumentation-all
|
@@ -41,20 +41,6 @@ dependencies:
|
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.2.0
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: json
|
46
|
-
requirement: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - "~>"
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '2.0'
|
51
|
-
type: :runtime
|
52
|
-
prerelease: false
|
53
|
-
version_requirements: !ruby/object:Gem::Requirement
|
54
|
-
requirements:
|
55
|
-
- - "~>"
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '2.0'
|
58
44
|
description: Automatic tracing and metrics for Ruby applications. Get started at cloud.solarwinds.com
|
59
45
|
email: technicalsupport@solarwinds.com
|
60
46
|
executables: []
|
@@ -63,7 +49,9 @@ extensions:
|
|
63
49
|
extra_rdoc_files:
|
64
50
|
- LICENSE
|
65
51
|
files:
|
52
|
+
- ".yardopts"
|
66
53
|
- LICENSE
|
54
|
+
- README.md
|
67
55
|
- ext/oboe_metal/extconf.rb
|
68
56
|
- ext/oboe_metal/lib/liboboe-1.0-aarch64.so.sha256
|
69
57
|
- ext/oboe_metal/lib/liboboe-1.0-alpine-aarch64.so.sha256
|
@@ -112,6 +100,8 @@ files:
|
|
112
100
|
- lib/solarwinds_apm/otel_lambda_config.rb
|
113
101
|
- lib/solarwinds_apm/patch.rb
|
114
102
|
- lib/solarwinds_apm/patch/dummy_patch.rb
|
103
|
+
- lib/solarwinds_apm/patch/tag_sql/sw_mysql2_patch.rb
|
104
|
+
- lib/solarwinds_apm/patch/tag_sql_patch.rb
|
115
105
|
- lib/solarwinds_apm/support.rb
|
116
106
|
- lib/solarwinds_apm/support/logger_formatter.rb
|
117
107
|
- lib/solarwinds_apm/support/logging_log_event.rb
|
@@ -122,6 +112,7 @@ files:
|
|
122
112
|
- lib/solarwinds_apm/support/swomarginalia/LICENSE
|
123
113
|
- lib/solarwinds_apm/support/swomarginalia/README.md
|
124
114
|
- lib/solarwinds_apm/support/swomarginalia/comment.rb
|
115
|
+
- lib/solarwinds_apm/support/swomarginalia/formatter.rb
|
125
116
|
- lib/solarwinds_apm/support/swomarginalia/load_swomarginalia.rb
|
126
117
|
- lib/solarwinds_apm/support/swomarginalia/railtie.rb
|
127
118
|
- lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb
|
@@ -139,7 +130,6 @@ metadata:
|
|
139
130
|
documentation_uri: https://documentation.solarwinds.com/en/success_center/observability/default.htm#cshid=config-ruby-agent
|
140
131
|
homepage_uri: https://documentation.solarwinds.com/en/success_center/observability/content/intro/landing-page.html
|
141
132
|
source_code_uri: https://github.com/solarwinds/apm-ruby
|
142
|
-
github_repo: https://github.com/solarwinds/apm-ruby.git
|
143
133
|
rubygems_mfa_required: 'true'
|
144
134
|
post_install_message:
|
145
135
|
rdoc_options: []
|