opentelemetry-instrumentation-rack 0.19.0 → 0.20.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 +22 -0
- data/README.md +20 -1
- data/lib/opentelemetry/instrumentation/rack/middlewares/tracer_middleware.rb +5 -11
- data/lib/opentelemetry/instrumentation/rack/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 121351162db33511943ee22400ad05edc8bdf6efa74e6673c3f46f6c22040350
|
4
|
+
data.tar.gz: 35d5abe73ec1ae9478edf28f51b21fafc922626ba830d4648b5ab38adce1fe03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a52efd93f27f9f5fb8e269fef96c80180d6dec99280877f22da48314403eebfac0c18b9c15058fe2a999d4b7b34c8cfbfa70fe4af1bc348d93c01223a3336c88
|
7
|
+
data.tar.gz: 5aa90c81f24ae2f8a2608b6556663488fc6394c716bf7f0bd4cda8ecc3da6abf8d5a54d050290445c8c118c803b57da0332806b9b07d5448c2118dabe72e4ad8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-rack
|
2
2
|
|
3
|
+
### v0.20.0 / 2021-10-06
|
4
|
+
|
5
|
+
* FIXED: Prevent high cardinality rack span name as a default [#973](https://github.com/open-telemetry/opentelemetry-ruby/pull/973)
|
6
|
+
|
7
|
+
The default was to set the span name as the path of the request, we have
|
8
|
+
corrected this as it was not adhering to the spec requirement using low
|
9
|
+
cardinality span names. You can restore the previous behaviour of high
|
10
|
+
cardinality span names by passing in a url quantization function that
|
11
|
+
forwards the uri path. More details on this is available in the readme.
|
12
|
+
|
13
|
+
### v0.19.3 / 2021-09-29
|
14
|
+
|
15
|
+
* (No significant changes)
|
16
|
+
|
17
|
+
### v0.19.2 / 2021-08-18
|
18
|
+
|
19
|
+
* FIXED: Rack middleware assuming script_name presence
|
20
|
+
|
21
|
+
### v0.19.1 / 2021-08-12
|
22
|
+
|
23
|
+
* DOCS: Update docs to rely more on environment variable configuration
|
24
|
+
|
3
25
|
### v0.19.0 / 2021-06-23
|
4
26
|
|
5
27
|
* BREAKING CHANGE: Total order constraint on span.status=
|
data/README.md
CHANGED
@@ -29,6 +29,25 @@ OpenTelemetry::SDK.configure do |c|
|
|
29
29
|
c.use_all
|
30
30
|
end
|
31
31
|
```
|
32
|
+
## Controlling span name cardinality
|
33
|
+
|
34
|
+
By default we will set the rack span name to match the format "HTTP #{method}" (ie. HTTP GET). There are different ways to control span names with this instrumentation.
|
35
|
+
|
36
|
+
### Enriching rack spans
|
37
|
+
|
38
|
+
We surface a hook to easily retrieve the rack span within the context of a request so that you can add information to or rename your server span.
|
39
|
+
|
40
|
+
This is how the rails controller instrumentation is able to rename the span names to match the controller and action that process the request. See https://github.com/open-telemetry/opentelemetry-ruby/blob/f6fb025bef69f839078748f56516ce38c7d51eb8/instrumentation/action_pack/lib/opentelemetry/instrumentation/action_pack/patches/action_controller/metal.rb#L15-L16 for an example.
|
41
|
+
|
42
|
+
### High cardinality example
|
43
|
+
|
44
|
+
You can pass in an url quantization lambda that simply uses the URL path, the result is you will end up with high cardinality span names, however this may be acceptable in your deployment and is easy configurable using the following example.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
OpenTelemetry::SDK.configure do |c|
|
48
|
+
c.use 'OpenTelemetry::Instrumentation::Rack', { url_quantization: ->(path, _env) { path.to_s } }
|
49
|
+
end
|
50
|
+
```
|
32
51
|
|
33
52
|
## Examples
|
34
53
|
|
@@ -50,4 +69,4 @@ The `opentelemetry-instrumentation-rack` gem is distributed under the Apache 2.0
|
|
50
69
|
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
|
51
70
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
52
71
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
53
|
-
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
72
|
+
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
@@ -58,6 +58,7 @@ module OpenTelemetry
|
|
58
58
|
return @app.call(env)
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
61
62
|
original_env = env.dup
|
62
63
|
extracted_context = OpenTelemetry.propagation.extract(
|
63
64
|
env,
|
@@ -121,18 +122,11 @@ module OpenTelemetry
|
|
121
122
|
'http.method' => env['REQUEST_METHOD'],
|
122
123
|
'http.host' => env['HTTP_HOST'] || 'unknown',
|
123
124
|
'http.scheme' => env['rack.url_scheme'],
|
124
|
-
'http.target' =>
|
125
|
+
'http.target' => env['QUERY_STRING'].empty? ? env['PATH_INFO'] : "#{env['PATH_INFO']}?#{env['QUERY_STRING']}"
|
125
126
|
}
|
126
|
-
attributes['http.user_agent'] = env['HTTP_USER_AGENT'] if env['HTTP_USER_AGENT']
|
127
|
-
attributes.merge(allowed_request_headers(env))
|
128
|
-
end
|
129
127
|
|
130
|
-
|
131
|
-
|
132
|
-
query_string = env['QUERY_STRING']
|
133
|
-
path = env['SCRIPT_NAME'] + env['PATH_INFO']
|
134
|
-
|
135
|
-
query_string.empty? ? path : "#{path}?#{query_string}"
|
128
|
+
attributes['http.user_agent'] = env['HTTP_USER_AGENT'] if env['HTTP_USER_AGENT']
|
129
|
+
attributes.merge!(allowed_request_headers(env))
|
136
130
|
end
|
137
131
|
|
138
132
|
# https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-http.md#name
|
@@ -148,7 +142,7 @@ module OpenTelemetry
|
|
148
142
|
if (implementation = config[:url_quantization])
|
149
143
|
implementation.call(request_uri_or_path_info, env)
|
150
144
|
else
|
151
|
-
|
145
|
+
"HTTP #{env['REQUEST_METHOD']}"
|
152
146
|
end
|
153
147
|
end
|
154
148
|
|
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.20.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: 2021-
|
11
|
+
date: 2021-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: '1.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: 1.0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opentelemetry-instrumentation-base
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.18.
|
33
|
+
version: 0.18.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.18.
|
40
|
+
version: 0.18.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: appraisal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.0
|
89
|
+
version: '1.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.0
|
96
|
+
version: '1.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rack
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,10 +228,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
228
228
|
licenses:
|
229
229
|
- Apache-2.0
|
230
230
|
metadata:
|
231
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.
|
231
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.20.0/file.CHANGELOG.html
|
232
232
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/rack
|
233
233
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
234
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.
|
234
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.20.0
|
235
235
|
post_install_message:
|
236
236
|
rdoc_options: []
|
237
237
|
require_paths:
|