solarwinds_apm 7.0.0.prev3 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +27 -3
- data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +3 -25
- data/lib/solarwinds_apm/api/custom_metrics.rb +2 -2
- data/lib/solarwinds_apm/api/transaction_name.rb +2 -2
- data/lib/solarwinds_apm/config.rb +6 -0
- data/lib/solarwinds_apm/noop/api.rb +2 -2
- data/lib/solarwinds_apm/{otel_native_config.rb → otel_config.rb} +3 -3
- data/lib/solarwinds_apm/support/transaction_settings.rb +0 -6
- data/lib/solarwinds_apm/version.rb +1 -1
- data/lib/solarwinds_apm.rb +4 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b86f18a58a518205b6f5d0d8e4054e821d2e2cc22b86366ff0ab13d0b2542322
|
4
|
+
data.tar.gz: 8e6a2c4dbbee0e2689b36086f1f003237d1e6f0adefd36cb13038a782e449e50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1884c401f28f7b57e0df2e2b0784b28964e50785555542376ad0527d72a7c43636115d48d332908a200fff3f2dd42160d8f4e79ec21e3e302e41ae048848f0eb
|
7
|
+
data.tar.gz: 339c983072fc99986d575593a1bbcd84b5ff9728c61a47279de70ba010416b5fdad7cfa2d9b457c206049b1533ad87212f7b4ac26091f3dbcd7c68ad10a4edf1
|
data/README.md
CHANGED
@@ -3,8 +3,10 @@
|
|
3
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
4
|
|
5
5
|
## Requirements
|
6
|
+
> [!NOTE]
|
7
|
+
> Versions before 7.0.0 only support Linux and will go into no-op mode on other platforms.
|
6
8
|
|
7
|
-
|
9
|
+
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
10
|
|
9
11
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to build for development.
|
10
12
|
|
@@ -32,7 +34,7 @@ The only required configuration is the service key, which can be set in the `SW_
|
|
32
34
|
|
33
35
|
## Custom Instrumentation
|
34
36
|
|
35
|
-
`solarwinds_apm` supports the standard OpenTelemetry API
|
37
|
+
`solarwinds_apm` supports the standard OpenTelemetry API and includes a few convenience methods for manual instrumentation. Additionally, a set of SolarWindsAPM APIs are provided for features specific to SolarWinds Observability.
|
36
38
|
|
37
39
|
### Using the OpenTelemetry API
|
38
40
|
|
@@ -60,6 +62,25 @@ current_span = ::OpenTelemetry::Trace.current_span
|
|
60
62
|
|
61
63
|
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
64
|
|
65
|
+
This gem also initializes a global `MeterProvider`, so your application can create Meters and Metric Instruments as follows to collect custom metrics, which will be exported every 60 seconds.
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
# set up meter and create a counter instrument
|
69
|
+
MyAppMeter = ::OpenTelemetry.meter_provider.meter('myapp')
|
70
|
+
counter = MyAppMeter.create_counter('password.resets',
|
71
|
+
description: 'Count of password reset requests to myapp',
|
72
|
+
unit: '{request}'
|
73
|
+
)
|
74
|
+
|
75
|
+
# increment counter
|
76
|
+
def reset
|
77
|
+
counter.add(1, attributes: {'user.id' => user_id})
|
78
|
+
# do things
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
See the [OTel Ruby Metrics README](https://github.com/open-telemetry/opentelemetry-ruby/blob/main/metrics_api/README.md) for more information on the API and links to examples.
|
83
|
+
|
63
84
|
### Using the SolarWindsAPM API
|
64
85
|
|
65
86
|
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).
|
@@ -158,7 +179,10 @@ By default, transaction names are constructed based on attributes such as the re
|
|
158
179
|
result = SolarWindsAPM::API.set_transaction_name('my-custom-trace-name')
|
159
180
|
```
|
160
181
|
|
161
|
-
#### Send Custom Metrics (
|
182
|
+
#### Send Custom Metrics (Deprecated)
|
183
|
+
|
184
|
+
> [!NOTE]
|
185
|
+
> Starting from version 7.0.0 these are no-op, standard OTel API should be used instead.
|
162
186
|
|
163
187
|
Service metrics are automatically collected by this library. In addition, the following methods support sending two types of custom metrics:
|
164
188
|
|
@@ -36,13 +36,11 @@ if defined?(SolarWindsAPM::Config)
|
|
36
36
|
# -1 disabled, 0 fatal, 1 error, 2 warning, 3 info (the default), 4 debug low, 5 debug medium, 6 debug high.
|
37
37
|
# Values out of range (< -1 or > 6) are ignored and the log level is set to the default (info).
|
38
38
|
#
|
39
|
-
|
40
|
-
|
41
|
-
#
|
42
|
-
# :debug_level will be used in the c-extension of the gem and also mapped to the
|
43
|
-
# Ruby logger as DISABLED, FATAL, ERROR, WARN, INFO, or DEBUG
|
39
|
+
# :debug_level will map the Ruby logger as DISABLED, FATAL, ERROR, WARN, INFO, or DEBUG
|
44
40
|
# The Ruby logger can afterwards be changed to a different level, e.g:
|
45
41
|
# SolarWindsAPM.logger.level = Logger::INFO
|
42
|
+
#
|
43
|
+
SolarWindsAPM::Config[:debug_level] = 3
|
46
44
|
|
47
45
|
#
|
48
46
|
# Turn Tracing on or off
|
@@ -102,16 +100,6 @@ if defined?(SolarWindsAPM::Config)
|
|
102
100
|
# }
|
103
101
|
]
|
104
102
|
|
105
|
-
#
|
106
|
-
# EC2 Metadata Fetching Timeout
|
107
|
-
#
|
108
|
-
# The timeout can be in the range 0 - 3000 (milliseconds)
|
109
|
-
# Setting to 0 milliseconds effectively disables fetching from
|
110
|
-
# the metadata URL (not waiting), and should only be used if
|
111
|
-
# not running on EC2 / Openstack to minimize agent start up time.
|
112
|
-
#
|
113
|
-
SolarWindsAPM::Config[:ec2_metadata_timeout] = 1000
|
114
|
-
|
115
103
|
#
|
116
104
|
# Trigger Trace Mode
|
117
105
|
#
|
@@ -120,16 +108,6 @@ if defined?(SolarWindsAPM::Config)
|
|
120
108
|
#
|
121
109
|
SolarWindsAPM::Config[:trigger_tracing_mode] = :enabled
|
122
110
|
|
123
|
-
#
|
124
|
-
# Argument logging
|
125
|
-
#
|
126
|
-
# For http requests:
|
127
|
-
# By default the query string parameters are included in the URLs reported.
|
128
|
-
# Set :log_args to false and instrumentation will stop collecting
|
129
|
-
# and reporting query arguments from URLs.
|
130
|
-
#
|
131
|
-
SolarWindsAPM::Config[:log_args] = true
|
132
|
-
|
133
111
|
#
|
134
112
|
# Tracecontext in sql
|
135
113
|
#
|
@@ -33,7 +33,7 @@ module SolarWindsAPM
|
|
33
33
|
# * Boolean
|
34
34
|
#
|
35
35
|
def increment_metric(_name, _count = 1, _with_hostname = false, _tags_kvs = {}) # rubocop:disable Style/OptionalBooleanParameter
|
36
|
-
SolarWindsAPM.logger.warn { 'increment_metric
|
36
|
+
SolarWindsAPM.logger.warn { 'increment_metric is deprecated, please use the OpenTelemetry API instead.' }
|
37
37
|
false
|
38
38
|
end
|
39
39
|
|
@@ -64,7 +64,7 @@ module SolarWindsAPM
|
|
64
64
|
# * Boolean
|
65
65
|
#
|
66
66
|
def summary_metric(_name, _value, _count = 1, _with_hostname = false, _tags_kvs = {}) # rubocop:disable Style/OptionalBooleanParameter
|
67
|
-
SolarWindsAPM.logger.warn { 'summary_metric
|
67
|
+
SolarWindsAPM.logger.warn { 'summary_metric is deprecated, please use the OpenTelemetry API instead.' }
|
68
68
|
false
|
69
69
|
end
|
70
70
|
|
@@ -41,7 +41,7 @@ module SolarWindsAPM
|
|
41
41
|
status = true
|
42
42
|
if ENV.fetch('SW_APM_ENABLED', 'true') == 'false'
|
43
43
|
SolarWindsAPM.logger.debug { "[#{name}/#{__method__}] SolarWindsAPM is in disabled or noop mode." }
|
44
|
-
elsif SolarWindsAPM::
|
44
|
+
elsif SolarWindsAPM::OTelConfig[:metrics_processor].nil?
|
45
45
|
SolarWindsAPM.logger.warn do
|
46
46
|
"[#{name}/#{__method__}] Set transaction name failed: Solarwinds processor is missing. Noop mode."
|
47
47
|
end
|
@@ -51,7 +51,7 @@ module SolarWindsAPM
|
|
51
51
|
end
|
52
52
|
status = false
|
53
53
|
else
|
54
|
-
solarwinds_processor = SolarWindsAPM::
|
54
|
+
solarwinds_processor = SolarWindsAPM::OTelConfig[:metrics_processor]
|
55
55
|
current_span = ::OpenTelemetry::Trace.current_span
|
56
56
|
|
57
57
|
if current_span.context.valid?
|
@@ -226,12 +226,18 @@ module SolarWindsAPM
|
|
226
226
|
when :tag_sql
|
227
227
|
enable_disable_config('SW_APM_TAG_SQL', key, value, false, bool: true)
|
228
228
|
|
229
|
+
when :ec2_metadata_timeout
|
230
|
+
SolarWindsAPM.logger.warn { ':ec2_metadata_timeout is deprecated' }
|
231
|
+
|
229
232
|
when :http_proxy
|
230
233
|
SolarWindsAPM.logger.warn { ':http_proxy is deprecated' }
|
231
234
|
|
232
235
|
when :hostname_alias
|
233
236
|
SolarWindsAPM.logger.warn { ':hostname_alias is deprecated' }
|
234
237
|
|
238
|
+
when :log_args
|
239
|
+
SolarWindsAPM.logger.warn { ':log_args is deprecated' }
|
240
|
+
|
235
241
|
else
|
236
242
|
@@config[key.to_sym] = value
|
237
243
|
|
@@ -56,12 +56,12 @@ module NoopAPI
|
|
56
56
|
# CustomMetrics
|
57
57
|
module CustomMetrics
|
58
58
|
def increment_metric(*)
|
59
|
-
SolarWindsAPM.logger.warn { 'increment_metric
|
59
|
+
SolarWindsAPM.logger.warn { 'increment_metric is deprecated, please use the OpenTelemetry API instead.' }
|
60
60
|
false
|
61
61
|
end
|
62
62
|
|
63
63
|
def summary_metric(*)
|
64
|
-
SolarWindsAPM.logger.warn { 'summary_metric
|
64
|
+
SolarWindsAPM.logger.warn { 'summary_metric is deprecated, please use the OpenTelemetry API instead.' }
|
65
65
|
false
|
66
66
|
end
|
67
67
|
end
|
@@ -12,8 +12,8 @@ require_relative 'opentelemetry'
|
|
12
12
|
require_relative 'sampling'
|
13
13
|
|
14
14
|
module SolarWindsAPM
|
15
|
-
#
|
16
|
-
module
|
15
|
+
# OTelConfig module
|
16
|
+
module OTelConfig
|
17
17
|
@@config = {}
|
18
18
|
@@config_map = {}
|
19
19
|
@@agent_enabled = false
|
@@ -151,7 +151,7 @@ module SolarWindsAPM
|
|
151
151
|
#
|
152
152
|
# Default using the use_all to load all instrumentation
|
153
153
|
# But with specific instrumentation disabled, use {:enabled: false} in config
|
154
|
-
# SolarWindsAPM::
|
154
|
+
# SolarWindsAPM::OTelConfig.initialize_with_config do |config|
|
155
155
|
# config["OpenTelemetry::Instrumentation::Rack"] = {"a" => "b"}
|
156
156
|
# config["OpenTelemetry::Instrumentation::Dalli"] = {:enabled: false}
|
157
157
|
# config["RESOURCE_ATTRIBUTES"] = ::OpenTelemetry::Resource::Detector::GoogleCloudPlatform.detect
|
@@ -28,12 +28,6 @@ module SolarWindsAPM
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
# def resolve_config
|
32
|
-
# config = SolarWindsAPM::Config if defined?(SolarWindsAPM::Config)
|
33
|
-
# config = SolarWindsAPM::OTelNativeConfig if defined?(SolarWindsAPM::OTelNativeConfig)
|
34
|
-
# config
|
35
|
-
# end
|
36
|
-
|
37
31
|
def tracing_enabled?
|
38
32
|
span_layer = "#{@kind}:#{@name}"
|
39
33
|
|
data/lib/solarwinds_apm.rb
CHANGED
@@ -21,11 +21,11 @@ begin
|
|
21
21
|
|
22
22
|
begin
|
23
23
|
require 'solarwinds_apm/config'
|
24
|
-
require 'solarwinds_apm/
|
24
|
+
require 'solarwinds_apm/otel_config'
|
25
25
|
|
26
26
|
if ENV['SW_APM_AUTO_CONFIGURE'] != 'false'
|
27
|
-
SolarWindsAPM::
|
28
|
-
if SolarWindsAPM::
|
27
|
+
SolarWindsAPM::OTelConfig.initialize
|
28
|
+
if SolarWindsAPM::OTelConfig.agent_enabled
|
29
29
|
SolarWindsAPM.logger.info '==================================================================='
|
30
30
|
SolarWindsAPM.logger.info "Ruby #{RUBY_VERSION} on platform #{RUBY_PLATFORM}."
|
31
31
|
SolarWindsAPM.logger.info "Current solarwinds_apm version: #{SolarWindsAPM::Version::STRING}."
|
@@ -43,7 +43,7 @@ begin
|
|
43
43
|
SolarWindsAPM.logger.warn '=============================================================='
|
44
44
|
SolarWindsAPM.logger.warn 'SW_APM_AUTO_CONFIGURE set to false.'
|
45
45
|
SolarWindsAPM.logger.warn 'You need to initialize Ruby library in application with'
|
46
|
-
SolarWindsAPM.logger.warn 'SolarWindsAPM::
|
46
|
+
SolarWindsAPM.logger.warn 'SolarWindsAPM::OTelConfig.initialize_with_config do |config|'
|
47
47
|
SolarWindsAPM.logger.warn ' # ... your configuration code'
|
48
48
|
SolarWindsAPM.logger.warn 'end'
|
49
49
|
SolarWindsAPM.logger.warn 'See: https://github.com/solarwinds/apm-ruby/blob/main/CONFIGURATION.md#in-code-configuration'
|
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: 7.0.0
|
4
|
+
version: 7.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: 2025-
|
14
|
+
date: 2025-08-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: opentelemetry-exporter-otlp
|
@@ -155,7 +155,7 @@ files:
|
|
155
155
|
- lib/solarwinds_apm/opentelemetry/otlp_processor.rb
|
156
156
|
- lib/solarwinds_apm/opentelemetry/solarwinds_propagator.rb
|
157
157
|
- lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb
|
158
|
-
- lib/solarwinds_apm/
|
158
|
+
- lib/solarwinds_apm/otel_config.rb
|
159
159
|
- lib/solarwinds_apm/patch/README.md
|
160
160
|
- lib/solarwinds_apm/patch/tag_sql/sw_dbo_utils.rb
|
161
161
|
- lib/solarwinds_apm/patch/tag_sql/sw_mysql2_patch.rb
|
@@ -205,9 +205,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: 3.1.0
|
206
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
|
-
- - "
|
208
|
+
- - ">="
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
210
|
+
version: '0'
|
211
211
|
requirements: []
|
212
212
|
rubygems_version: 3.3.27
|
213
213
|
signing_key:
|