opentelemetry-instrumentation-sinatra 0.23.4 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/opentelemetry/instrumentation/sinatra/extensions/tracer_extension.rb +16 -14
- data/lib/opentelemetry/instrumentation/sinatra/instrumentation.rb +37 -4
- data/lib/opentelemetry/instrumentation/sinatra/version.rb +1 -1
- data/lib/opentelemetry/instrumentation/sinatra.rb +1 -1
- metadata +6 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c2ff5d9ea266d15b8fa21453c2178c4c3161893c3c2778c603b1dc7ba2788b5
|
4
|
+
data.tar.gz: fd2953b0a5e1bad80eb0a9d40f2df066d4b14e1da77099ff88993299aa3f9dd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a08cea93e13127d14a3b222e908b1724e3a6271a5de3c4330b8b6bd77809aff506ba37d63e4a4e9850ebc88c12e56b2778f9f1e4c3d13e389b71cb60942166b1
|
7
|
+
data.tar.gz: b9c209655a2a32a6e53b2230f05228312dcdc481331cbf91389d18b45e2e98eb40265c6db51a24e05112eb4b9a171614b1898ba19833c953e75b8e74f94cf056
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-sinatra
|
2
2
|
|
3
|
+
### v0.24.0 / 2024-07-02
|
4
|
+
|
5
|
+
* ADDED: Make Rack install optional for sinatra
|
6
|
+
|
7
|
+
### v0.23.5 / 2024-06-18
|
8
|
+
|
9
|
+
* FIXED: Relax otel common gem constraints
|
10
|
+
|
3
11
|
### v0.23.4 / 2024-05-09
|
4
12
|
|
5
13
|
* FIXED: Untrace entire request
|
@@ -13,23 +13,25 @@ module OpenTelemetry
|
|
13
13
|
# Sinatra extension that installs TracerMiddleware and provides
|
14
14
|
# tracing for template rendering
|
15
15
|
module TracerExtension
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
def render(_engine, data, *)
|
21
|
-
template_name = data.is_a?(Symbol) ? data : :literal
|
16
|
+
# Contants patches for `render` method
|
17
|
+
module RenderPatches
|
18
|
+
def render(_engine, data, *)
|
19
|
+
template_name = data.is_a?(Symbol) ? data : :literal
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
21
|
+
Sinatra::Instrumentation.instance.tracer.in_span(
|
22
|
+
'sinatra.render_template',
|
23
|
+
attributes: { 'sinatra.template_name' => template_name.to_s }
|
24
|
+
) do
|
25
|
+
super
|
29
26
|
end
|
30
27
|
end
|
31
|
-
|
32
|
-
|
28
|
+
end
|
29
|
+
|
30
|
+
# Sinatra hook after extension is registered
|
31
|
+
def self.registered(app)
|
32
|
+
# Create tracing `render` method
|
33
|
+
::Sinatra::Base.prepend(RenderPatches)
|
34
|
+
Sinatra::Instrumentation.instance.install_middleware(app)
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
@@ -9,18 +9,51 @@ require_relative 'extensions/tracer_extension'
|
|
9
9
|
module OpenTelemetry
|
10
10
|
module Instrumentation
|
11
11
|
module Sinatra
|
12
|
-
# The Instrumentation class contains logic to detect and install the Sinatra
|
13
|
-
#
|
12
|
+
# The {OpenTelemetry::Instrumentation::Sinatra::Instrumentation} class contains logic to detect and install the Sinatra instrumentation
|
13
|
+
#
|
14
|
+
# Installation and configuration of this instrumentation is done within the
|
15
|
+
# {https://www.rubydoc.info/gems/opentelemetry-sdk/OpenTelemetry/SDK#configure-instance_method OpenTelemetry::SDK#configure}
|
16
|
+
# block, calling {https://www.rubydoc.info/gems/opentelemetry-sdk/OpenTelemetry%2FSDK%2FConfigurator:use use()}
|
17
|
+
# or {https://www.rubydoc.info/gems/opentelemetry-sdk/OpenTelemetry%2FSDK%2FConfigurator:use_all use_all()}.
|
18
|
+
#
|
19
|
+
# ## Configuration keys and options
|
20
|
+
#
|
21
|
+
# ### `:install_rack`
|
22
|
+
#
|
23
|
+
# Default is `true`. Specifies whether or not to install the Rack instrumentation as part of installing the Sinatra instrumentation.
|
24
|
+
# This is useful in cases where you have multiple Rack applications but want to manually specify where to insert the tracing middleware.
|
25
|
+
#
|
26
|
+
# @example Manually install Rack instrumentation.
|
27
|
+
# OpenTelemetry::SDK.configure do |c|
|
28
|
+
# c.use_all({
|
29
|
+
# 'OpenTelemetry::Instrumentation::Rack' => { },
|
30
|
+
# 'OpenTelemetry::Instrumentation::Sinatra' => {
|
31
|
+
# install_rack: false
|
32
|
+
# },
|
33
|
+
# })
|
34
|
+
# end
|
35
|
+
#
|
14
36
|
class Instrumentation < OpenTelemetry::Instrumentation::Base
|
15
|
-
install do |
|
16
|
-
OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.install({})
|
37
|
+
install do |config|
|
38
|
+
OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.install({}) if config[:install_rack]
|
39
|
+
|
40
|
+
unless OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.installed?
|
41
|
+
OpenTelemetry.logger.warn('Rack instrumentation is required for Sinatra but not installed. Please see the docs for more details: https://opentelemetry.io/docs/languages/ruby/libraries/')
|
42
|
+
end
|
17
43
|
|
18
44
|
::Sinatra::Base.register Extensions::TracerExtension
|
19
45
|
end
|
20
46
|
|
47
|
+
option :install_rack, default: true, validate: :boolean
|
48
|
+
|
21
49
|
present do
|
22
50
|
defined?(::Sinatra)
|
23
51
|
end
|
52
|
+
|
53
|
+
def install_middleware(app)
|
54
|
+
app.use(*OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.middleware_args) if config[:install_rack]
|
55
|
+
app.use(Middlewares::TracerMiddleware)
|
56
|
+
end
|
24
57
|
end
|
25
58
|
end
|
26
59
|
end
|
@@ -9,7 +9,7 @@ require 'opentelemetry-instrumentation-base'
|
|
9
9
|
|
10
10
|
module OpenTelemetry
|
11
11
|
module Instrumentation
|
12
|
-
#
|
12
|
+
# (see OpenTelemetry::Instrumentation::Sinatra::Instrumentation)
|
13
13
|
module Sinatra
|
14
14
|
end
|
15
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-instrumentation-sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenTelemetry Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: opentelemetry-common
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.21.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.21.0
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: opentelemetry-instrumentation-base
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +142,14 @@ dependencies:
|
|
156
142
|
requirements:
|
157
143
|
- - "~>"
|
158
144
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
145
|
+
version: 1.64.0
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
150
|
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
152
|
+
version: 1.64.0
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
154
|
name: rubocop-performance
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,10 +228,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
242
228
|
licenses:
|
243
229
|
- Apache-2.0
|
244
230
|
metadata:
|
245
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-sinatra/0.
|
231
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-sinatra/0.24.0/file/CHANGELOG.md
|
246
232
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/sinatra
|
247
233
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
248
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-sinatra/0.
|
234
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-sinatra/0.24.0
|
249
235
|
post_install_message:
|
250
236
|
rdoc_options: []
|
251
237
|
require_paths:
|