elastic-transport 8.3.1 → 8.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/elastic/transport/opentelemetry.rb +4 -2
- data/lib/elastic/transport/version.rb +1 -1
- data/spec/elastic/transport/opentelemetry_spec.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ece16e8da350495285378d8f76df8e40a3c366c75e90c37c6e7d5558780b175
|
4
|
+
data.tar.gz: 10655669e9c1b4254e607424ee4acd5d2cdaa3c56a3a8988f6a29e6b507fa982
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e541aaddfc31d02364d648e96dac3c7e42abda88650fc1c8e48dbdb3c84f26bc83fb9355c52e3972cd3c6d5ebf1b6e670c7beb0449988d8db69641013bae19f
|
7
|
+
data.tar.gz: 4cbde4527ca45280bf0cdd719ace9823e4c5462c03b0404263f5c4ac6dd0328249ca04cbb1d6a01bfad8ab489355ac8acb7513255069586a99e6575a1915bdce
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 8.3.2
|
2
|
+
|
3
|
+
- OpenTelemetry: In v8.3.0 and v8.3.1, the environment variable `OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY` was available but is now deprecated in favor of `OTEL_RUBY_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY`.
|
4
|
+
|
1
5
|
## 8.3.1
|
2
6
|
|
3
7
|
Tested versions of Ruby: (MRI) 3.0, 3.1, 3.2, 3.3, JRuby 9.3 and JRuby 9.4
|
@@ -27,7 +27,8 @@ module Elastic
|
|
27
27
|
# Describes how to handle search queries in the request body when assigned to
|
28
28
|
# a span attribute.
|
29
29
|
# Valid values are 'raw', 'omit', 'sanitize'. Default is 'omit'.
|
30
|
-
ENV_VARIABLE_BODY_STRATEGY = '
|
30
|
+
ENV_VARIABLE_BODY_STRATEGY = 'OTEL_RUBY_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY'
|
31
|
+
ENV_VARIABLE_DEPRECATED_BODY_STRATEGY = 'OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY'
|
31
32
|
DEFAULT_BODY_STRATEGY = 'omit'
|
32
33
|
# A string list of keys whose values are redacted. This is only relevant if the body strategy is
|
33
34
|
# 'sanitize'. For example, a config 'sensitive-key,other-key' will redact the values at
|
@@ -53,7 +54,8 @@ module Elastic
|
|
53
54
|
@tracer = (opts[:opentelemetry_tracer_provider] || ::OpenTelemetry.tracer_provider).tracer(
|
54
55
|
OTEL_TRACER_NAME, Elastic::Transport::VERSION
|
55
56
|
)
|
56
|
-
@body_strategy = ENV[ENV_VARIABLE_BODY_STRATEGY] ||
|
57
|
+
@body_strategy = ENV[ENV_VARIABLE_DEPRECATED_BODY_STRATEGY] || ENV[ENV_VARIABLE_BODY_STRATEGY] ||
|
58
|
+
DEFAULT_BODY_STRATEGY
|
57
59
|
@sanitize_keys = ENV[ENV_VARIABLE_BODY_SANITIZE_KEYS]&.split(',')&.collect! do |pattern|
|
58
60
|
Regexp.new(pattern.gsub('*', '.*'))
|
59
61
|
end
|
@@ -131,6 +131,25 @@ if defined?(::OpenTelemetry)
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
+
context 'with deprecated ENV variable' do
|
135
|
+
let(:sanitized_body) do
|
136
|
+
{ query: { match: { password: 'REDACTED' } } }
|
137
|
+
end
|
138
|
+
|
139
|
+
around(:example) do |ex|
|
140
|
+
body_strategy = ENV[described_class::ENV_VARIABLE_DEPRECATED_BODY_STRATEGY]
|
141
|
+
ENV[described_class::ENV_VARIABLE_DEPRECATED_BODY_STRATEGY] = 'sanitize'
|
142
|
+
ex.run
|
143
|
+
ENV[described_class::ENV_VARIABLE_DEPRECATED_BODY_STRATEGY] = body_strategy
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'sanitizes the body' do
|
147
|
+
client.perform_request('GET', '/_search', nil, body, nil, endpoint: 'search')
|
148
|
+
|
149
|
+
expect(span.attributes['db.statement']).to eq(sanitized_body.to_json)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
134
153
|
context 'with custom keys' do
|
135
154
|
let(:body) do
|
136
155
|
{ query: { match: { sensitive: { query: 'secret'} } } }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.3.
|
4
|
+
version: 8.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic Client Library Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|