solarwinds_apm 6.1.1 → 7.0.0.prev1
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 +53 -4
- data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +0 -4
- data/lib/solarwinds_apm/api/current_trace_info.rb +10 -6
- data/lib/solarwinds_apm/api/custom_instrumentation.rb +80 -0
- data/lib/solarwinds_apm/api/custom_metrics.rb +8 -25
- data/lib/solarwinds_apm/api/tracing.rb +12 -27
- data/lib/solarwinds_apm/api/transaction_name.rb +6 -10
- data/lib/solarwinds_apm/api.rb +2 -0
- data/lib/solarwinds_apm/config.rb +1 -1
- data/lib/solarwinds_apm/constants.rb +1 -0
- data/lib/solarwinds_apm/noop/api.rb +5 -2
- data/lib/solarwinds_apm/noop.rb +0 -24
- data/lib/solarwinds_apm/opentelemetry/otlp_processor.rb +90 -69
- data/lib/solarwinds_apm/opentelemetry/solarwinds_propagator.rb +0 -2
- data/lib/solarwinds_apm/opentelemetry/solarwinds_response_propagator.rb +5 -4
- data/lib/solarwinds_apm/opentelemetry.rb +5 -7
- data/lib/solarwinds_apm/otel_native_config.rb +177 -0
- data/lib/solarwinds_apm/patch/README.md +15 -0
- data/lib/solarwinds_apm/patch/tag_sql/sw_dbo_utils.rb +35 -0
- data/lib/solarwinds_apm/patch/tag_sql/sw_mysql2_patch.rb +1 -12
- data/lib/solarwinds_apm/patch/tag_sql/sw_pg_patch.rb +39 -0
- data/lib/solarwinds_apm/patch/tag_sql_patch.rb +2 -0
- data/lib/solarwinds_apm/{noop/metadata.rb → sampling/dice.rb} +19 -17
- data/lib/solarwinds_apm/sampling/http_sampler.rb +87 -0
- data/lib/solarwinds_apm/sampling/json_sampler.rb +52 -0
- data/lib/solarwinds_apm/sampling/metrics.rb +38 -0
- data/lib/solarwinds_apm/sampling/oboe_sampler.rb +348 -0
- data/lib/solarwinds_apm/sampling/sampler.rb +197 -0
- data/lib/solarwinds_apm/sampling/sampling_constants.rb +127 -0
- data/lib/solarwinds_apm/sampling/sampling_patch.rb +49 -0
- data/lib/solarwinds_apm/sampling/setting_example.txt +1 -0
- data/lib/solarwinds_apm/{noop/context.rb → sampling/settings.rb} +14 -25
- data/lib/solarwinds_apm/sampling/token_bucket.rb +126 -0
- data/lib/solarwinds_apm/sampling/trace_options.rb +100 -0
- data/lib/solarwinds_apm/{patch.rb → sampling.rb} +20 -4
- data/lib/solarwinds_apm/{noop/span.rb → support/aws_resource_detector.rb} +5 -18
- data/lib/solarwinds_apm/support/logger_formatter.rb +1 -1
- data/lib/solarwinds_apm/support/logging_log_event.rb +1 -1
- data/lib/solarwinds_apm/support/lumberjack_formatter.rb +1 -1
- data/lib/solarwinds_apm/support/otlp_endpoint.rb +99 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/beanstalk.rb +51 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/ec2.rb +145 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/ecs.rb +173 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/eks.rb +174 -0
- data/lib/solarwinds_apm/support/resource_detector/aws/lambda.rb +66 -0
- data/lib/solarwinds_apm/support/resource_detector.rb +192 -0
- data/lib/solarwinds_apm/support/service_key_checker.rb +12 -6
- data/lib/solarwinds_apm/support/transaction_settings.rb +6 -0
- data/lib/solarwinds_apm/support/txn_name_manager.rb +54 -9
- data/lib/solarwinds_apm/support/utils.rb +9 -0
- data/lib/solarwinds_apm/support.rb +3 -4
- data/lib/solarwinds_apm/version.rb +4 -4
- data/lib/solarwinds_apm.rb +27 -73
- metadata +105 -50
- data/ext/oboe_metal/extconf.rb +0 -168
- data/ext/oboe_metal/lib/liboboe-1.0-aarch64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-alpine-aarch64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-lambda-aarch64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-lambda-x86_64.so.sha256 +0 -1
- data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.sha256 +0 -1
- data/ext/oboe_metal/src/VERSION +0 -1
- data/ext/oboe_metal/src/bson/bson.h +0 -220
- data/ext/oboe_metal/src/bson/platform_hacks.h +0 -91
- data/ext/oboe_metal/src/init_solarwinds_apm.cc +0 -18
- data/ext/oboe_metal/src/oboe.h +0 -930
- data/ext/oboe_metal/src/oboe_api.cpp +0 -793
- data/ext/oboe_metal/src/oboe_api.h +0 -621
- data/ext/oboe_metal/src/oboe_debug.h +0 -17
- data/ext/oboe_metal/src/oboe_swig_wrap.cc +0 -10954
- data/lib/oboe_metal.rb +0 -187
- data/lib/solarwinds_apm/cert/star.appoptics.com.issuer.crt +0 -24
- data/lib/solarwinds_apm/oboe_init_options.rb +0 -222
- data/lib/solarwinds_apm/opentelemetry/solarwinds_exporter.rb +0 -239
- data/lib/solarwinds_apm/opentelemetry/solarwinds_processor.rb +0 -174
- data/lib/solarwinds_apm/opentelemetry/solarwinds_sampler.rb +0 -333
- data/lib/solarwinds_apm/otel_config.rb +0 -174
- data/lib/solarwinds_apm/otel_lambda_config.rb +0 -56
- data/lib/solarwinds_apm/patch/dummy_patch.rb +0 -12
- data/lib/solarwinds_apm/support/oboe_tracing_mode.rb +0 -33
- data/lib/solarwinds_apm/support/support_report.rb +0 -99
- data/lib/solarwinds_apm/support/swomarginalia/LICENSE +0 -20
- data/lib/solarwinds_apm/support/swomarginalia/README.md +0 -46
- data/lib/solarwinds_apm/support/swomarginalia/comment.rb +0 -206
- data/lib/solarwinds_apm/support/swomarginalia/formatter.rb +0 -20
- data/lib/solarwinds_apm/support/swomarginalia/load_swomarginalia.rb +0 -55
- data/lib/solarwinds_apm/support/swomarginalia/railtie.rb +0 -24
- data/lib/solarwinds_apm/support/swomarginalia/swomarginalia.rb +0 -89
- data/lib/solarwinds_apm/support/transaction_cache.rb +0 -57
- data/lib/solarwinds_apm/support/x_trace_options.rb +0 -138
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d66514bebfccf2f3c5a2b2e6924fe7fc7abe6a33fa90ce2dcc94de968e64018
|
4
|
+
data.tar.gz: 55cd6df597c8db22130b6322ede1deae4911c1409674734cb11ccf9223734dcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa5dd5bb46399211d816833f257b69fec64a325cb6ee3c256d612d64be0e4cb50e5b1e195025afad69dee4d5c79726d9e5b6ff8f5a25d952724b01521e8d9331
|
7
|
+
data.tar.gz: 6b9e3f5bc1e8e35b419d9a2c04c43bca23268ea9fed3832368d5f0c708925abd1e46d9f2e215833fae5e6154fa77c7ec696e3819a0ff37188c1c407aa4965522
|
data/README.md
CHANGED
@@ -64,9 +64,11 @@ Note that if `OpenTelemetry::SDK.configure` is used to set up a `TracerProvider`
|
|
64
64
|
|
65
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
66
|
|
67
|
-
#### Convenience Method
|
67
|
+
#### Convenience Method: `in_span` and `add_tracer`
|
68
68
|
|
69
|
-
|
69
|
+
`in_span` acquires the correct `Tracer` so a new span can be created in a single call.
|
70
|
+
|
71
|
+
For example, using it in a Rails controller:
|
70
72
|
|
71
73
|
```ruby
|
72
74
|
class StaticController < ApplicationController
|
@@ -78,6 +80,53 @@ class StaticController < ApplicationController
|
|
78
80
|
end
|
79
81
|
```
|
80
82
|
|
83
|
+
`add_tracer` can add a custom span to the specified instance or class method that is already defined. It can optionally set the span kind and additional attributes provided in hash format:
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
add_tracer :method_name, 'custom_span_name', { attributes: { 'any' => 'attributes' }, kind: :span_kind }
|
87
|
+
```
|
88
|
+
|
89
|
+
For example, if you want to instrument class or instance method `create_session` inside an application controller:
|
90
|
+
|
91
|
+
To instrument instance method
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
class SessionsController < ApplicationController
|
95
|
+
include SolarWindsAPM::API::Tracer
|
96
|
+
|
97
|
+
def create
|
98
|
+
user = User.find_by(email: params[:session][:email].downcase)
|
99
|
+
create_session(user)
|
100
|
+
end
|
101
|
+
|
102
|
+
def create_session(user)
|
103
|
+
end
|
104
|
+
|
105
|
+
# instrument instance method create_session
|
106
|
+
add_tracer :create_session, 'custom_name', { attributes: { 'foo' => 'bar' }, kind: :consumer }
|
107
|
+
end
|
108
|
+
```
|
109
|
+
|
110
|
+
To instrument class method
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
class SessionsController < ApplicationController
|
114
|
+
def create
|
115
|
+
user = User.find_by(email: params[:session][:email].downcase)
|
116
|
+
create_session(user)
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.create_session(user)
|
120
|
+
end
|
121
|
+
|
122
|
+
# instrument class method create_session
|
123
|
+
class << self
|
124
|
+
include SolarWindsAPM::API::Tracer
|
125
|
+
add_tracer :create_session, 'custom_name', { attributes: { 'foo' => 'bar' }, kind: :consumer }
|
126
|
+
end
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
81
130
|
#### Get Curent Trace Context Information
|
82
131
|
|
83
132
|
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`.
|
@@ -95,10 +144,10 @@ trace.trace_flags # 01
|
|
95
144
|
|
96
145
|
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
146
|
|
98
|
-
A call to the `solarwinds_ready
|
147
|
+
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
148
|
|
100
149
|
```ruby
|
101
|
-
SolarWindsAPM::API.solarwinds_ready(wait_milliseconds=3000)
|
150
|
+
SolarWindsAPM::API.solarwinds_ready?(wait_milliseconds=3000)
|
102
151
|
```
|
103
152
|
|
104
153
|
#### Set a Custom Transaction Name
|
@@ -169,9 +169,5 @@ if defined?(SolarWindsAPM::Config)
|
|
169
169
|
# Example:
|
170
170
|
# SELECT `posts`.* FROM `posts` /*traceparent=00-a448f096d441e167d12ebd32a927c1a5-a29655a47e430119-01*/
|
171
171
|
#
|
172
|
-
# This option can add a small overhead for prepared statements since the traceparent value is unique per execution.
|
173
|
-
# This feature uses marginalia, see its caveat and possible workaround
|
174
|
-
# https://github.com/basecamp/marginalia/blob/master/README.md#prepared-statements
|
175
|
-
#
|
176
172
|
SolarWindsAPM::Config[:tag_sql] = false
|
177
173
|
end
|
@@ -111,12 +111,16 @@ module SolarWindsAPM
|
|
111
111
|
private
|
112
112
|
|
113
113
|
def current_span
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
114
|
+
if defined?(::OpenTelemetry::Trace)
|
115
|
+
span = ::OpenTelemetry::Trace.current_span
|
116
|
+
trace_id = span.context.hex_trace_id
|
117
|
+
span_id = span.context.hex_span_id
|
118
|
+
trace_flags = span.context.trace_flags.sampled? ? '01' : '00'
|
119
|
+
tracestring = "00-#{trace_id}-#{span_id}-#{trace_flags}"
|
120
|
+
[trace_id, span_id, trace_flags, tracestring]
|
121
|
+
else
|
122
|
+
%w[00000000000000000000000000000000 00000000 00 00-00000000000000000000000000000000-00000000-00]
|
123
|
+
end
|
120
124
|
end
|
121
125
|
|
122
126
|
# if true the trace info should be added to the log message
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# © 2024 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 API
|
11
|
+
module Tracer
|
12
|
+
def self.included(base)
|
13
|
+
base.extend(ClassMethods)
|
14
|
+
end
|
15
|
+
|
16
|
+
module ClassMethods
|
17
|
+
# Helper method to instrument custom method
|
18
|
+
#
|
19
|
+
# `add_tracer` can add a custom span to the specified instance or class method that is already defined.
|
20
|
+
# It requires the custom span name and optionally takes the span kind and additional attributes
|
21
|
+
# in hash format.
|
22
|
+
#
|
23
|
+
# === Argument:
|
24
|
+
#
|
25
|
+
# * +method_name+ - (String) A non-empty string that match the method name that need to be instrumented
|
26
|
+
# * +span_name+ - (String, optional, default = method_name) A non-empty string that define the span name (default to method_name)
|
27
|
+
# * +options+ - (Hash, optional, default = {}) A hash with desired options include attributes and span kind e.g. {attributes: {}, kind: :consumer}
|
28
|
+
#
|
29
|
+
# === Example:
|
30
|
+
#
|
31
|
+
# class DogfoodsController < ApplicationController
|
32
|
+
# include SolarWindsAPM::API::Tracer
|
33
|
+
#
|
34
|
+
# def create
|
35
|
+
# @dogfood = Dogfood.new(params.permit(:brand, :name))
|
36
|
+
# @dogfood.save
|
37
|
+
# custom_method
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# def custom_method
|
41
|
+
# end
|
42
|
+
# add_tracer :custom_method, 'custom_name', { attributes: { 'foo' => 'bar' }, kind: :consumer }
|
43
|
+
#
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# class DogfoodsController < ApplicationController
|
47
|
+
# def create
|
48
|
+
# @dogfood = Dogfood.new(params.permit(:brand, :name))
|
49
|
+
# @dogfood.save
|
50
|
+
# custom_method
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# def self.custom_method
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# class << self
|
57
|
+
# include SolarWindsAPM::API::Tracer
|
58
|
+
# add_tracer :custom_method, 'custom_name', { attributes: { 'foo' => 'bar' }, kind: :consumer }
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# === Returns:
|
64
|
+
# * nil
|
65
|
+
#
|
66
|
+
def add_tracer(method_name, span_name = nil, options = {})
|
67
|
+
span_name = name.nil? ? "#{to_s.split(':').last&.tr('>', '')}/#{__method__}" : "#{name}/#{__method__}" if span_name.nil?
|
68
|
+
|
69
|
+
original_method = instance_method(method_name)
|
70
|
+
|
71
|
+
define_method(method_name) do |*args, &block|
|
72
|
+
SolarWindsAPM::API.in_span(span_name, **options) do |_span|
|
73
|
+
original_method.bind_call(self, *args, &block)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -32,12 +32,9 @@ module SolarWindsAPM
|
|
32
32
|
# === Returns:
|
33
33
|
# * Boolean
|
34
34
|
#
|
35
|
-
def increment_metric(
|
36
|
-
|
37
|
-
|
38
|
-
with_hostname = with_hostname ? 1 : 0
|
39
|
-
tags, tags_count = make_tags(tags_kvs)
|
40
|
-
SolarWindsAPM::CustomMetrics.increment(name.to_s, count, with_hostname, nil, tags, tags_count).zero?
|
35
|
+
def increment_metric(_name, _count = 1, _with_hostname = false, _tags_kvs = {}) # rubocop:disable Style/OptionalBooleanParameter
|
36
|
+
SolarWindsAPM.logger.warn { 'increment_metric have been deprecated. Please use opentelemetry metrics-sdk to log metrics data.' }
|
37
|
+
false
|
41
38
|
end
|
42
39
|
|
43
40
|
# Send values with counts
|
@@ -66,29 +63,15 @@ module SolarWindsAPM
|
|
66
63
|
# === Returns:
|
67
64
|
# * Boolean
|
68
65
|
#
|
69
|
-
def summary_metric(
|
70
|
-
|
71
|
-
|
72
|
-
with_hostname = with_hostname ? 1 : 0
|
73
|
-
tags, tags_count = make_tags(tags_kvs)
|
74
|
-
SolarWindsAPM::CustomMetrics.summary(name.to_s, value, count, with_hostname, nil, tags, tags_count).zero?
|
66
|
+
def summary_metric(_name, _value, _count = 1, _with_hostname = false, _tags_kvs = {}) # rubocop:disable Style/OptionalBooleanParameter
|
67
|
+
SolarWindsAPM.logger.warn { 'summary_metric have been deprecated. Please use opentelemetry metrics-sdk to log metrics data.' }
|
68
|
+
false
|
75
69
|
end
|
76
70
|
|
77
71
|
private
|
78
72
|
|
79
|
-
def make_tags(
|
80
|
-
|
81
|
-
SolarWindsAPM.logger.warn("[solarwinds_apm/metrics] CustomMetrics received tags_kvs that are not a Hash (found #{tags_kvs.class}), setting tags_kvs = {}")
|
82
|
-
tags_kvs = {}
|
83
|
-
end
|
84
|
-
count = tags_kvs.size
|
85
|
-
tags = SolarWindsAPM::MetricTags.new(count)
|
86
|
-
|
87
|
-
tags_kvs.each_with_index do |(k, v), i|
|
88
|
-
tags.add(i, k.to_s, v.to_s)
|
89
|
-
end
|
90
|
-
|
91
|
-
[tags, count]
|
73
|
+
def make_tags(_tags_kvs)
|
74
|
+
nil
|
92
75
|
end
|
93
76
|
end
|
94
77
|
end
|
@@ -12,22 +12,12 @@ module SolarWindsAPM
|
|
12
12
|
# Wait for SolarWinds to be ready to send traces.
|
13
13
|
#
|
14
14
|
# This may be useful in short lived background processes when it is important to capture
|
15
|
-
# information during the whole time the process is running.
|
16
|
-
# and it will return integer if setting <tt>integer_response</tt> as true.
|
15
|
+
# information during the whole time the process is running.
|
17
16
|
# Usually SolarWinds doesn't block an application while it is starting up.
|
18
17
|
#
|
19
|
-
# For status code reference:
|
20
|
-
# 0: unknown error
|
21
|
-
# 1: is ready
|
22
|
-
# 2: not ready yet, try later
|
23
|
-
# 3: limit exceeded
|
24
|
-
# 4: invalid API key
|
25
|
-
# 5: connection error
|
26
|
-
#
|
27
18
|
# === Argument:
|
28
19
|
#
|
29
20
|
# * +wait_milliseconds+ - (int, default 3000) the maximum time to wait in milliseconds
|
30
|
-
# * +integer_response+ - (boolean, default false) determine whether return status code of reporter or not
|
31
21
|
#
|
32
22
|
# === Example:
|
33
23
|
#
|
@@ -35,24 +25,19 @@ module SolarWindsAPM
|
|
35
25
|
# Logger.info "SolarWindsAPM not ready after 10 seconds, no metrics will be sent"
|
36
26
|
# end
|
37
27
|
#
|
38
|
-
# # with status code print out
|
39
|
-
# status = SolarWindsAPM::API.solarwinds_ready?(10_000, integer_response: true)
|
40
|
-
# unless status == 1
|
41
|
-
# Logger.info "SolarWindsAPM not ready after 10 seconds, no metrics will be sent. Error code "#{status}"
|
42
|
-
# end
|
43
|
-
#
|
44
28
|
# === Returns:
|
45
|
-
# * Boolean
|
46
|
-
#
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
return is_ready if integer_response
|
29
|
+
# * Boolean
|
30
|
+
#
|
31
|
+
def solarwinds_ready?(wait_milliseconds = 3000, integer_response: nil)
|
32
|
+
unless integer_response.nil?
|
33
|
+
SolarWindsAPM.logger.warn do
|
34
|
+
'Deprecation: solarwinds_ready? no longer accepts integer_response, this parameter will be removed in the next release.'
|
35
|
+
end
|
36
|
+
end
|
54
37
|
|
55
|
-
|
38
|
+
root_sampler = ::OpenTelemetry.tracer_provider.sampler.instance_variable_get(:@root)
|
39
|
+
is_ready = root_sampler.wait_until_ready(wait_milliseconds / 1000)
|
40
|
+
!!is_ready
|
56
41
|
end
|
57
42
|
end
|
58
43
|
end
|
@@ -39,23 +39,19 @@ module SolarWindsAPM
|
|
39
39
|
#
|
40
40
|
def set_transaction_name(custom_name = nil)
|
41
41
|
status = true
|
42
|
-
if ENV.fetch('SW_APM_ENABLED', 'true') == 'false'
|
43
|
-
SolarWindsAPM::Context.toString == '99-00000000000000000000000000000000-0000000000000000-00'
|
44
|
-
# library disabled or noop, just log and skip work.
|
45
|
-
# TODO: can we have a single indicator that the API is in noop mode?
|
42
|
+
if ENV.fetch('SW_APM_ENABLED', 'true') == 'false'
|
46
43
|
SolarWindsAPM.logger.debug { "[#{name}/#{__method__}] SolarWindsAPM is in disabled or noop mode." }
|
47
|
-
elsif
|
44
|
+
elsif SolarWindsAPM::OTelNativeConfig[:metrics_processor].nil?
|
48
45
|
SolarWindsAPM.logger.warn do
|
49
|
-
"[#{name}/#{__method__}] Set transaction name failed:
|
46
|
+
"[#{name}/#{__method__}] Set transaction name failed: Solarwinds processor is missing. Noop mode."
|
50
47
|
end
|
51
|
-
|
52
|
-
elsif SolarWindsAPM::OTelConfig[:metrics_processor].nil?
|
48
|
+
elsif custom_name.nil? || custom_name.empty?
|
53
49
|
SolarWindsAPM.logger.warn do
|
54
|
-
"[#{name}/#{__method__}] Set transaction name failed:
|
50
|
+
"[#{name}/#{__method__}] Set transaction name failed: custom_name is either nil or empty string."
|
55
51
|
end
|
56
52
|
status = false
|
57
53
|
else
|
58
|
-
solarwinds_processor = SolarWindsAPM::
|
54
|
+
solarwinds_processor = SolarWindsAPM::OTelNativeConfig[:metrics_processor]
|
59
55
|
current_span = ::OpenTelemetry::Trace.current_span
|
60
56
|
|
61
57
|
if current_span.context.valid?
|
data/lib/solarwinds_apm/api.rb
CHANGED
@@ -11,6 +11,7 @@ require_relative 'api/current_trace_info'
|
|
11
11
|
require_relative 'api/tracing'
|
12
12
|
require_relative 'api/opentelemetry'
|
13
13
|
require_relative 'api/custom_metrics'
|
14
|
+
require_relative 'api/custom_instrumentation'
|
14
15
|
|
15
16
|
module SolarWindsAPM
|
16
17
|
module API
|
@@ -19,5 +20,6 @@ module SolarWindsAPM
|
|
19
20
|
extend SolarWindsAPM::API::Tracing
|
20
21
|
extend SolarWindsAPM::API::OpenTelemetry
|
21
22
|
extend SolarWindsAPM::API::CustomMetrics
|
23
|
+
extend SolarWindsAPM::API::Tracer
|
22
24
|
end
|
23
25
|
end
|
@@ -212,7 +212,7 @@ module SolarWindsAPM
|
|
212
212
|
|
213
213
|
# Assure value is an integer
|
214
214
|
@@config[key.to_sym] = new_value.to_i
|
215
|
-
SolarWindsAPM.sample_rate(new_value)
|
215
|
+
SolarWindsAPM.sample_rate(new_value)
|
216
216
|
|
217
217
|
when :transaction_settings
|
218
218
|
compile_settings(value)
|
@@ -19,8 +19,9 @@ module NoopAPI
|
|
19
19
|
# Tracing
|
20
20
|
module Tracing
|
21
21
|
# (wait_milliseconds=3000, integer_response: false)
|
22
|
-
def solarwinds_ready?(
|
23
|
-
|
22
|
+
def solarwinds_ready?(_wait_milliseconds = 3000, integer_response: false)
|
23
|
+
_noop = integer_response
|
24
|
+
false
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
@@ -55,10 +56,12 @@ module NoopAPI
|
|
55
56
|
# CustomMetrics
|
56
57
|
module CustomMetrics
|
57
58
|
def increment_metric(*)
|
59
|
+
SolarWindsAPM.logger.warn { 'increment_metric have been deprecated. Please use opentelemetry metrics-sdk to log metrics data.' }
|
58
60
|
false
|
59
61
|
end
|
60
62
|
|
61
63
|
def summary_metric(*)
|
64
|
+
SolarWindsAPM.logger.warn { 'summary_metric have been deprecated. Please use opentelemetry metrics-sdk to log metrics data.' }
|
62
65
|
false
|
63
66
|
end
|
64
67
|
end
|
data/lib/solarwinds_apm/noop.rb
CHANGED
@@ -6,28 +6,4 @@
|
|
6
6
|
#
|
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
|
-
require_relative 'noop/context'
|
10
|
-
require_relative 'noop/metadata'
|
11
|
-
require_relative 'noop/span'
|
12
9
|
require_relative 'noop/api'
|
13
|
-
|
14
|
-
module SolarWindsAPM
|
15
|
-
include Oboe_metal
|
16
|
-
# Reporter noop
|
17
|
-
class Reporter
|
18
|
-
##
|
19
|
-
# noop version of :send_report
|
20
|
-
#
|
21
|
-
def self.send_report(event, with_system_timestamp: false); end
|
22
|
-
|
23
|
-
##
|
24
|
-
# noop version of :send_status
|
25
|
-
#
|
26
|
-
def self.send_status(event, context = nil, with_system_timestamp: false); end
|
27
|
-
|
28
|
-
##
|
29
|
-
# noop version of :start
|
30
|
-
#
|
31
|
-
def self.start; end
|
32
|
-
end
|
33
|
-
end
|