opentelemetry-instrumentation-rack 0.7.0 → 0.11.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/CHANGELOG.md +27 -0
- data/LICENSE +1 -1
- data/lib/opentelemetry-instrumentation-rack.rb +1 -1
- data/lib/opentelemetry/instrumentation.rb +1 -1
- data/lib/opentelemetry/instrumentation/rack.rb +35 -1
- data/lib/opentelemetry/instrumentation/rack/instrumentation.rb +1 -1
- data/lib/opentelemetry/instrumentation/rack/middlewares/tracer_middleware.rb +10 -11
- data/lib/opentelemetry/instrumentation/rack/util/queue_time.rb +1 -1
- data/lib/opentelemetry/instrumentation/rack/version.rb +2 -2
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d807b0d0959c63f9b11afc65ebfe0d884cd00c542dfa1697034d36e89b20482d
|
4
|
+
data.tar.gz: 46ba63906072535a57d486df9eb739e75d240b488d49334c74db8084d53780d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0418569456c79e8303a52c2eec0618f6593f095bfd576733e4704fe4b1ca7670370fc5ede468be187683baa91eaa477ce181b3f28f2dd1b25a2057be5c295ede'
|
7
|
+
data.tar.gz: ccf0115a270a3afa84e3f02c9ab3bfd64f373d36540d9c633343a815168bfc978644b58d201c8a5b8c05c308a8ba04aa43e6cbcbd2b06396db3fefc7288314dd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-rack
|
2
2
|
|
3
|
+
### v0.11.0 / 2020-12-11
|
4
|
+
|
5
|
+
* FIXED: Copyright comments to not reference year
|
6
|
+
|
7
|
+
### v0.10.1 / 2020-12-09
|
8
|
+
|
9
|
+
* FIXED: Rack current_span
|
10
|
+
|
11
|
+
### v0.10.0 / 2020-12-03
|
12
|
+
|
13
|
+
* (No significant changes)
|
14
|
+
|
15
|
+
### v0.9.0 / 2020-11-27
|
16
|
+
|
17
|
+
* BREAKING CHANGE: Add timeout for force_flush and shutdown
|
18
|
+
|
19
|
+
* ADDED: Instrument rails
|
20
|
+
* ADDED: Add timeout for force_flush and shutdown
|
21
|
+
|
22
|
+
### v0.8.0 / 2020-10-27
|
23
|
+
|
24
|
+
* BREAKING CHANGE: Move context/span methods to Trace module
|
25
|
+
* BREAKING CHANGE: Remove 'canonical' from status codes
|
26
|
+
|
27
|
+
* FIXED: Move context/span methods to Trace module
|
28
|
+
* FIXED: Remove 'canonical' from status codes
|
29
|
+
|
3
30
|
### v0.7.0 / 2020-10-07
|
4
31
|
|
5
32
|
* FIXED: Remove superfluous file from Rack gem
|
data/LICENSE
CHANGED
@@ -186,7 +186,7 @@
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
187
187
|
identification within third-party archives.
|
188
188
|
|
189
|
-
Copyright
|
189
|
+
Copyright The OpenTelemetry Authors
|
190
190
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
192
192
|
you may not use this file except in compliance with the License.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
@@ -10,6 +10,40 @@ module OpenTelemetry
|
|
10
10
|
module Instrumentation
|
11
11
|
# Contains the OpenTelemetry instrumentation for the Rack gem
|
12
12
|
module Rack
|
13
|
+
extend self
|
14
|
+
|
15
|
+
CURRENT_SPAN_KEY = Context.create_key('current-span')
|
16
|
+
|
17
|
+
private_constant :CURRENT_SPAN_KEY
|
18
|
+
|
19
|
+
# Returns the current span from the current or provided context
|
20
|
+
#
|
21
|
+
# @param [optional Context] context The context to lookup the current
|
22
|
+
# {Span} from. Defaults to Context.current
|
23
|
+
def current_span(context = nil)
|
24
|
+
context ||= Context.current
|
25
|
+
context.value(CURRENT_SPAN_KEY) || OpenTelemetry::Trace::Span::INVALID
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns a context containing the span, derived from the optional parent
|
29
|
+
# context, or the current context if one was not provided.
|
30
|
+
#
|
31
|
+
# @param [optional Context] context The context to use as the parent for
|
32
|
+
# the returned context
|
33
|
+
def context_with_span(span, parent_context: Context.current)
|
34
|
+
parent_context.set_value(CURRENT_SPAN_KEY, span)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Activates/deactivates the Span within the current Context, which makes the "current span"
|
38
|
+
# available implicitly.
|
39
|
+
#
|
40
|
+
# On exit, the Span that was active before calling this method will be reactivated.
|
41
|
+
#
|
42
|
+
# @param [Span] span the span to activate
|
43
|
+
# @yield [span, context] yields span and a context containing the span to the block.
|
44
|
+
def with_span(span)
|
45
|
+
Context.with_value(CURRENT_SPAN_KEY, span) { |c, s| yield s, c }
|
46
|
+
end
|
13
47
|
end
|
14
48
|
end
|
15
49
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
@@ -51,7 +51,7 @@ module OpenTelemetry
|
|
51
51
|
@app = app
|
52
52
|
end
|
53
53
|
|
54
|
-
def call(env)
|
54
|
+
def call(env) # rubocop:disable Metrics/AbcSize
|
55
55
|
original_env = env.dup
|
56
56
|
extracted_context = OpenTelemetry.propagation.http.extract(env)
|
57
57
|
frontend_context = create_frontend_span(env, extracted_context)
|
@@ -63,8 +63,10 @@ module OpenTelemetry
|
|
63
63
|
tracer.in_span(request_span_name,
|
64
64
|
attributes: request_span_attributes(env: env),
|
65
65
|
kind: request_span_kind) do |request_span|
|
66
|
-
|
67
|
-
|
66
|
+
OpenTelemetry::Instrumentation::Rack.with_span(request_span) do
|
67
|
+
@app.call(env).tap do |status, headers, response|
|
68
|
+
set_attributes_after_request(request_span, status, headers, response)
|
69
|
+
end
|
68
70
|
end
|
69
71
|
end
|
70
72
|
end
|
@@ -87,15 +89,11 @@ module OpenTelemetry
|
|
87
89
|
},
|
88
90
|
kind: :server)
|
89
91
|
|
90
|
-
|
92
|
+
OpenTelemetry::Trace.context_with_span(span, parent_context: extracted_context)
|
91
93
|
end
|
92
94
|
|
93
95
|
def finish_span(context)
|
94
|
-
context
|
95
|
-
end
|
96
|
-
|
97
|
-
def current_span_key
|
98
|
-
OpenTelemetry::Trace::Propagation::ContextKeys.current_span_key
|
96
|
+
OpenTelemetry::Trace.current_span(context).finish if context
|
99
97
|
end
|
100
98
|
|
101
99
|
def tracer
|
@@ -107,7 +105,8 @@ module OpenTelemetry
|
|
107
105
|
'http.method' => env['REQUEST_METHOD'],
|
108
106
|
'http.host' => env['HTTP_HOST'] || 'unknown',
|
109
107
|
'http.scheme' => env['rack.url_scheme'],
|
110
|
-
'http.target' => fullpath(env)
|
108
|
+
'http.target' => fullpath(env),
|
109
|
+
'http.user_agent' => env['HTTP_USER_AGENT']
|
111
110
|
}.merge(allowed_request_headers(env))
|
112
111
|
end
|
113
112
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
7
7
|
module OpenTelemetry
|
8
8
|
module Instrumentation
|
9
9
|
module Rack
|
10
|
-
VERSION = '0.
|
10
|
+
VERSION = '0.11.0'
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-instrumentation-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.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: 2020-
|
11
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.11.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.11.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: appraisal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,7 +213,11 @@ files:
|
|
213
213
|
homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
214
214
|
licenses:
|
215
215
|
- Apache-2.0
|
216
|
-
metadata:
|
216
|
+
metadata:
|
217
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.11.0/file.CHANGELOG.html
|
218
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/instrumentation/rack
|
219
|
+
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
220
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.11.0
|
217
221
|
post_install_message:
|
218
222
|
rdoc_options: []
|
219
223
|
require_paths:
|