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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bb7bc2413d7967ff3ab408dc2615d71e1140a240f34f2b67c21550705c42b3d
4
- data.tar.gz: 82ba1e4d3be8ddb205b6d25c10ebffed36e20b6e267251122c80e1d1c87c3950
3
+ metadata.gz: 0ece16e8da350495285378d8f76df8e40a3c366c75e90c37c6e7d5558780b175
4
+ data.tar.gz: 10655669e9c1b4254e607424ee4acd5d2cdaa3c56a3a8988f6a29e6b507fa982
5
5
  SHA512:
6
- metadata.gz: fb8b615d737254668a504439eede4e41e42327097a2160f66eee04cf84ff2bd26e89230f261870fab9aad337080a5562326a52792b8059e5f735a4e757d5ac29
7
- data.tar.gz: 342e0ad9f8c38e64cce7bebd45c706d4365449627c6ef31ffced9a7822c4250b1b76a156265ae9d8775874e864fb2f061bde0d76745ad9ed362f9cdd19bf5bbb
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 = 'OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY'
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] || DEFAULT_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
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elastic
19
19
  module Transport
20
- VERSION = '8.3.1'.freeze
20
+ VERSION = '8.3.2'.freeze
21
21
  end
22
22
  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.1
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-01-24 00:00:00.000000000 Z
11
+ date: 2024-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday