opentelemetry-instrumentation-rack 0.8.0 → 0.12.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 +23 -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 +8 -5
- data/lib/opentelemetry/instrumentation/rack/util/queue_time.rb +1 -1
- data/lib/opentelemetry/instrumentation/rack/version.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80a09baaed46a076fed44997cef625ed302dde2d85c89101013cdab648814dbf
|
4
|
+
data.tar.gz: 3e3280f4178e2b18e4058b11d2699a15cd49f87f142f7e3e7bb3276d92490ccb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08737fba03d92a07aa3e036533a2f743a2ebe0b2d6d64b408be44da226d8925ad1de450df8c141f86afbc78338503ab4126d584b2f05d781f0496eae58e3b326'
|
7
|
+
data.tar.gz: 1a05a5aefc6b5d7e8a4e812a4477880e00523813240e8e75ed33500e23df1c3fbf14d3b45374d4cbabaad28da4f990ae10d9cc4a24694c26c3bf20e1ab335f63
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-rack
|
2
2
|
|
3
|
+
### v0.12.0 / 2020-12-24
|
4
|
+
|
5
|
+
* (No significant changes)
|
6
|
+
|
7
|
+
### v0.11.0 / 2020-12-11
|
8
|
+
|
9
|
+
* FIXED: Copyright comments to not reference year
|
10
|
+
|
11
|
+
### v0.10.1 / 2020-12-09
|
12
|
+
|
13
|
+
* FIXED: Rack current_span
|
14
|
+
|
15
|
+
### v0.10.0 / 2020-12-03
|
16
|
+
|
17
|
+
* (No significant changes)
|
18
|
+
|
19
|
+
### v0.9.0 / 2020-11-27
|
20
|
+
|
21
|
+
* BREAKING CHANGE: Add timeout for force_flush and shutdown
|
22
|
+
|
23
|
+
* ADDED: Instrument rails
|
24
|
+
* ADDED: Add timeout for force_flush and shutdown
|
25
|
+
|
3
26
|
### v0.8.0 / 2020-10-27
|
4
27
|
|
5
28
|
* BREAKING CHANGE: Move context/span methods to Trace module
|
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
|
@@ -103,7 +105,8 @@ module OpenTelemetry
|
|
103
105
|
'http.method' => env['REQUEST_METHOD'],
|
104
106
|
'http.host' => env['HTTP_HOST'] || 'unknown',
|
105
107
|
'http.scheme' => env['rack.url_scheme'],
|
106
|
-
'http.target' => fullpath(env)
|
108
|
+
'http.target' => fullpath(env),
|
109
|
+
'http.user_agent' => env['HTTP_USER_AGENT']
|
107
110
|
}.merge(allowed_request_headers(env))
|
108
111
|
end
|
109
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.12.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.12.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-24 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.12.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.12.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: appraisal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,10 +214,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
214
214
|
licenses:
|
215
215
|
- Apache-2.0
|
216
216
|
metadata:
|
217
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.
|
217
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.12.0/file.CHANGELOG.html
|
218
218
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/master/instrumentation/rack
|
219
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.
|
220
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.12.0
|
221
221
|
post_install_message:
|
222
222
|
rdoc_options: []
|
223
223
|
require_paths:
|