solarwinds_apm 6.1.1 → 6.1.2
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 +49 -2
- data/ext/oboe_metal/src/oboe_swig_wrap.cc +208 -117
- data/lib/rails/generators/solarwinds_apm/templates/solarwinds_apm_initializer.rb +0 -4
- data/lib/solarwinds_apm/api/custom_instrumentation.rb +80 -0
- data/lib/solarwinds_apm/api.rb +2 -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/version.rb +1 -1
- metadata +8 -12
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73f2befcea2c555995f79719d36c68d2448ae31f56656741d5c6e8d49e61963b
|
4
|
+
data.tar.gz: 4ba3986285dcda8adc5629c2e08b5221638928d06733dd6fc0c009379b97ab4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 777aebc61cfb1f6776f0640f9b0cbd6005c5c375989a046809ce4f97551a8f2925154496eeef798726ac2242641646bb590c48d23caf71165473b0ac0cfa6b52
|
7
|
+
data.tar.gz: c244cb0d3c1252cbcb85f3381cc82195ca8d59bf0ea4991f2c41f89a49d29a92efcf089ee35ae6274614493bd7e89d7ecb5851ec876a572d24fc5015ec7d5625
|
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,51 @@ 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
|
+
```ruby
|
93
|
+
class SessionsController < ApplicationController
|
94
|
+
include SolarWindsAPM::API::Tracer
|
95
|
+
|
96
|
+
def create
|
97
|
+
user = User.find_by(email: params[:session][:email].downcase)
|
98
|
+
create_session(user)
|
99
|
+
end
|
100
|
+
|
101
|
+
def create_session(user)
|
102
|
+
end
|
103
|
+
|
104
|
+
# instrument instance method create_session
|
105
|
+
add_tracer :create_session, 'custom_name', { attributes: { 'foo' => 'bar' }, kind: :consumer }
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
109
|
+
To instrument class method
|
110
|
+
```ruby
|
111
|
+
class SessionsController < ApplicationController
|
112
|
+
def create
|
113
|
+
user = User.find_by(email: params[:session][:email].downcase)
|
114
|
+
create_session(user)
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.create_session(user)
|
118
|
+
end
|
119
|
+
|
120
|
+
# instrument class method create_session
|
121
|
+
class << self
|
122
|
+
include SolarWindsAPM::API::Tracer
|
123
|
+
add_tracer :create_session, 'custom_name', { attributes: { 'foo' => 'bar' }, kind: :consumer }
|
124
|
+
end
|
125
|
+
end
|
126
|
+
```
|
127
|
+
|
81
128
|
#### Get Curent Trace Context Information
|
82
129
|
|
83
130
|
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`.
|