opentelemetry-instrumentation-rack 0.10.0 → 0.14.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/README.md +2 -2
- data/lib/opentelemetry-instrumentation-rack.rb +1 -1
- data/lib/opentelemetry/instrumentation.rb +1 -1
- data/lib/opentelemetry/instrumentation/rack.rb +2 -2
- data/lib/opentelemetry/instrumentation/rack/instrumentation.rb +1 -1
- data/lib/opentelemetry/instrumentation/rack/middlewares/tracer_middleware.rb +21 -7
- data/lib/opentelemetry/instrumentation/rack/util/queue_time.rb +1 -1
- data/lib/opentelemetry/instrumentation/rack/version.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9824c0e3b21a61e9c69c51e68dae7c56c93dbc03a7bec1ce73d2e2876d14d11
|
4
|
+
data.tar.gz: 9e72aba3d3819902feb17b41b6b4203fbee4435c418b6f828f6a1336697c13dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0bf72d4acdb549a9ce22e2de5ec8618e7a9a4534623203c66c039ed9165f06afaae6399b2d879b802f1c5ec39bf70193136396f11a07dd6521c2901c32029f2
|
7
|
+
data.tar.gz: 7e7b9fb9a10ccc9bf0b055dc479375c0e88a957a0f576ad2b9a70472c9517456fdb1d6caf1af15300426176dc770c132253ab40ed132efc0850496fb5e2451bc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-rack
|
2
2
|
|
3
|
+
### v0.14.0 / 2021-02-03
|
4
|
+
|
5
|
+
* BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
|
6
|
+
|
7
|
+
* ADDED: Replace getter and setter callables and remove rack specific propagators
|
8
|
+
* ADDED: Add untraced endpoints config to rack middleware
|
9
|
+
|
10
|
+
### v0.13.0 / 2021-01-29
|
11
|
+
|
12
|
+
* FIXED: Only include user agent when present
|
13
|
+
|
14
|
+
### v0.12.0 / 2020-12-24
|
15
|
+
|
16
|
+
* (No significant changes)
|
17
|
+
|
18
|
+
### v0.11.0 / 2020-12-11
|
19
|
+
|
20
|
+
* FIXED: Copyright comments to not reference year
|
21
|
+
|
22
|
+
### v0.10.1 / 2020-12-09
|
23
|
+
|
24
|
+
* FIXED: Rack current_span
|
25
|
+
|
3
26
|
### v0.10.0 / 2020-12-03
|
4
27
|
|
5
28
|
* (No significant changes)
|
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.
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ end
|
|
32
32
|
|
33
33
|
## Examples
|
34
34
|
|
35
|
-
Example usage can be seen in the `./example/trace_demonstration.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby/blob/
|
35
|
+
Example usage can be seen in the `./example/trace_demonstration.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby/blob/main/instrumentation/rack/example/trace_demonstration.rb)
|
36
36
|
|
37
37
|
## How can I get involved?
|
38
38
|
|
@@ -47,7 +47,7 @@ The `opentelemetry-instrumentation-rack` gem is distributed under the Apache 2.0
|
|
47
47
|
[rack-home]: https://github.com/rack/rack
|
48
48
|
[bundler-home]: https://bundler.io
|
49
49
|
[repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
|
50
|
-
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/
|
50
|
+
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
|
51
51
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
52
52
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
53
53
|
[ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
|
@@ -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
|
|
@@ -22,7 +22,7 @@ module OpenTelemetry
|
|
22
22
|
# {Span} from. Defaults to Context.current
|
23
23
|
def current_span(context = nil)
|
24
24
|
context ||= Context.current
|
25
|
-
context.value(CURRENT_SPAN_KEY) || Span::INVALID
|
25
|
+
context.value(CURRENT_SPAN_KEY) || OpenTelemetry::Trace::Span::INVALID
|
26
26
|
end
|
27
27
|
|
28
28
|
# Returns a context containing the span, derived from the optional parent
|
@@ -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
|
|
@@ -49,11 +49,20 @@ module OpenTelemetry
|
|
49
49
|
|
50
50
|
def initialize(app)
|
51
51
|
@app = app
|
52
|
+
@untraced_endpoints = config[:untraced_endpoints].is_a?(Array) ? config[:untraced_endpoints] : []
|
52
53
|
end
|
53
54
|
|
54
|
-
def call(env) # rubocop:disable Metrics/AbcSize
|
55
|
+
def call(env) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
56
|
+
if untraced_request?(env)
|
57
|
+
OpenTelemetry::Common::Utilities.untraced do
|
58
|
+
return @app.call(env)
|
59
|
+
end
|
60
|
+
end
|
55
61
|
original_env = env.dup
|
56
|
-
extracted_context = OpenTelemetry.propagation.
|
62
|
+
extracted_context = OpenTelemetry.propagation.extract(
|
63
|
+
env,
|
64
|
+
getter: OpenTelemetry::Context::Propagation.rack_env_getter
|
65
|
+
)
|
57
66
|
frontend_context = create_frontend_span(env, extracted_context)
|
58
67
|
|
59
68
|
# restore extracted context in this process:
|
@@ -76,6 +85,10 @@ module OpenTelemetry
|
|
76
85
|
|
77
86
|
private
|
78
87
|
|
88
|
+
def untraced_request?(env)
|
89
|
+
@untraced_endpoints.include?(env['PATH_INFO'])
|
90
|
+
end
|
91
|
+
|
79
92
|
# return Context with the frontend span as the current span
|
80
93
|
def create_frontend_span(env, extracted_context)
|
81
94
|
request_start_time = OpenTelemetry::Instrumentation::Rack::Util::QueueTime.get_request_start(env)
|
@@ -101,13 +114,14 @@ module OpenTelemetry
|
|
101
114
|
end
|
102
115
|
|
103
116
|
def request_span_attributes(env:)
|
104
|
-
{
|
117
|
+
attributes = {
|
105
118
|
'http.method' => env['REQUEST_METHOD'],
|
106
119
|
'http.host' => env['HTTP_HOST'] || 'unknown',
|
107
120
|
'http.scheme' => env['rack.url_scheme'],
|
108
|
-
'http.target' => fullpath(env)
|
109
|
-
|
110
|
-
|
121
|
+
'http.target' => fullpath(env)
|
122
|
+
}
|
123
|
+
attributes['http.user_agent'] = env['HTTP_USER_AGENT'] if env['HTTP_USER_AGENT']
|
124
|
+
attributes.merge(allowed_request_headers(env))
|
111
125
|
end
|
112
126
|
|
113
127
|
# e.g., "/webshop/articles/4?s=1":
|
@@ -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.14.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.14.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:
|
11
|
+
date: 2021-02-03 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.14.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.14.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.
|
218
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/
|
217
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.14.0/file.CHANGELOG.html
|
218
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/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.14.0
|
221
221
|
post_install_message:
|
222
222
|
rdoc_options: []
|
223
223
|
require_paths:
|