elastic-transport 8.3.6 → 8.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55e1343a320fd2a1dba29077ff4d9ad72b6adf62fe918856480f43e00e8a9927
4
- data.tar.gz: da17629d377258be5b8564ba0bd82c3ef6119117e307a14ac60f8da14894e375
3
+ metadata.gz: 88698d9c25a84a6242bfb875623c2bca0bd9a0e5c40244272e88fe291b06a9e0
4
+ data.tar.gz: 90aff86e0a0f301908c888877d97a72ac926e9b5f7f48b23ad447813a729824d
5
5
  SHA512:
6
- metadata.gz: e375ab5339638b8fedd29d38ae0ff6384407e8256c9201c383ee084689e4781752fe4cc9b23830a2380185234acfbbc59533d91f653ec51fff9007a433b033b3
7
- data.tar.gz: 25a3847030def992ed441260e8921509ad5375353ad3e564218e799341bc53942e30245e6dad79c6e38e1783b993298e6729951320bb785e17308a2f5f9ca19f
6
+ metadata.gz: 3a235c8813516864b3b661790c56c9eeb6c8ee8b44a208d70a3309faca0075e9b45f25890be47d56ed29b845a70c5d3f6cd45c617592543993a0c6d788eb7211
7
+ data.tar.gz: 9cd571ba906d3e841f63f8bf3ea018820d0d9e2eddb9171f01785b6787df5ed19fecbeb0b05e494428af8853d2040c78c32f25a370c612d55a4a69ed77798682
@@ -7,7 +7,7 @@ jobs:
7
7
  - uses: actions/checkout@v4
8
8
  - uses: ruby/setup-ruby@v1
9
9
  with:
10
- ruby-version: 3
10
+ ruby-version: '3.4'
11
11
  - name: Check license headers
12
12
  run: |
13
13
  ruby ./.github/check_license_headers.rb
@@ -2,10 +2,10 @@ name: opentelemetry
2
2
  on:
3
3
  push:
4
4
  branches:
5
- - 8.3
5
+ - main
6
6
  pull_request:
7
7
  branches:
8
- - 8.3
8
+ - main
9
9
  jobs:
10
10
  test-otel:
11
11
  name: 'Test Open Telemetry'
@@ -16,8 +16,8 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: ['3.3', 'jruby-9.4']
20
- es_version: ['9.2.0-SNAPSHOT']
19
+ ruby: ['3.4', 'jruby-9.4']
20
+ es_version: ['8.17.0-SNAPSHOT']
21
21
  runs-on: ubuntu-latest
22
22
  steps:
23
23
  - uses: actions/checkout@v4
@@ -1,11 +1,11 @@
1
- name: 8.3 tests
1
+ name: main tests
2
2
  on:
3
3
  push:
4
4
  branches:
5
- - 8.3
5
+ - main
6
6
  pull_request:
7
7
  branches:
8
- - 8.3
8
+ - main
9
9
  jobs:
10
10
  test:
11
11
  name: 'Main tests'
@@ -16,7 +16,7 @@ jobs:
16
16
  fail-fast: false
17
17
  matrix:
18
18
  ruby: ['3.1', '3.2', '3.3', '3.4', 'jruby-9.3', 'jruby-9.4']
19
- es_version: ['8.18.8-SNAPSHOT', '8.19.5-SNAPSHOT', '9.0.8-SNAPSHOT', '9.1.5-SNAPSHOT', '9.2.0-SNAPSHOT']
19
+ es_version: ['8.16.0-SNAPSHOT', '8.17.0-SNAPSHOT', '8.18.0-SNAPSHOT']
20
20
  runs-on: ubuntu-latest
21
21
  steps:
22
22
  - uses: actions/checkout@v4
@@ -53,8 +53,8 @@ jobs:
53
53
  strategy:
54
54
  fail-fast: false
55
55
  matrix:
56
- ruby: ['3.1', '3.2', '3.3', '3.4', 'jruby-9.3']
57
- es_version: ['8.19.5-SNAPSHOT']
56
+ ruby: ['3.0', '3.1', '3.2', '3.3', 'jruby-9.3']
57
+ es_version: ['8.16.0-SNAPSHOT']
58
58
  runs-on: ubuntu-latest
59
59
  steps:
60
60
  - uses: actions/checkout@v4
data/CHANGELOG.md CHANGED
@@ -1,7 +1,39 @@
1
- ## 8.3.6
1
+ ## 8.4.0
2
2
 
3
- - Moves `require 'timeout'` to the classes that use it. Closed [#79](https://github.com/elastic/elastic-transport-ruby/issues/79).
4
- - Sanitize url on OTEL spans, thanks @steve21168. Pull Request: [#98](https://github.com/elastic/elastic-transport-ruby/pull/98)
3
+ - Adds support for **[Excon](https://github.com/excon/excon)** Faraday adapter. You can use the Excon adapter by setting it in when initializing an Elasticsearch client:
4
+
5
+ ```ruby
6
+ require 'faraday/excon'
7
+
8
+ Elasticsearch::Client.new(
9
+ host: host,
10
+ transport_options: transport_options,
11
+ adapter: :excon
12
+ )
13
+ ```
14
+
15
+ Excon may need some specific configuration for HTTPS/SSL. You may see certificate verification errors when trying to connect to Elastic. Excon has certificates bundled, but these can be customized:
16
+
17
+ ```ruby
18
+ Excon.defaults[:ssl_ca_path] = path_to_certs
19
+ ENV['SSL_CERT_DIR'] = path_to_certs
20
+ Excon.defaults[:ssl_ca_file] = path_to_file
21
+ ENV['SSL_CERT_FILE'] = path_to_file
22
+ Excon.defaults[:ssl_verify_callback] = callback
23
+ # (see OpenSSL::SSL::SSLContext#verify_callback)
24
+ Excon.defaults[:ssl_verify_peer] = false` # (less secure).
25
+ ```
26
+
27
+ - Adds support for **[Async::HTTP::Faraday](https://github.com/socketry/async-http-faraday)**. You can use the adapter by setting it when initializing an Elasticsearch client:
28
+ ```ruby
29
+ require 'async-http-faraday'
30
+
31
+ Elasticsearch::Client.new(
32
+ host: host,
33
+ adapter: :async_http
34
+ )
35
+ ```
36
+ - Minor refactors, styling fixes.
5
37
 
6
38
  ## 8.3.5
7
39
 
data/CONTRIBUTING.md CHANGED
@@ -41,7 +41,13 @@ E.g.:
41
41
  $ rake docker:start[8.0.0-alpha1]
42
42
  ```
43
43
 
44
- You can find the available version in [Docker @ Elastic](https://www.docker.elastic.co/r/elasticsearch).
44
+ You can find the available version in [Docker @ Elastic](https://www.docker.elastic.co/r/elasticsearch). You can also run Elasticsearch and Kibana locally with Docker with `start-local`:
45
+
46
+ ```bash
47
+ curl -fsSL https://elastic.co/start-local | sh
48
+ ```
49
+
50
+ This will run Elasticsearch in http://localhost:9200 and Kibana in http://localhost:5601. More information is available [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/run-elasticsearch-locally.html).
45
51
 
46
52
  # Contributing
47
53
 
data/Gemfile CHANGED
@@ -21,13 +21,16 @@ source 'https://rubygems.org'
21
21
  gemspec
22
22
 
23
23
  group :development, :test do
24
+ gem 'faraday-excon'
24
25
  gem 'faraday-httpclient'
25
26
  gem 'faraday-net_http_persistent'
26
27
  gem 'faraday-typhoeus'
28
+ gem 'mutex_m' if RUBY_VERSION >= '3.4'
27
29
  gem 'opentelemetry-sdk', require: false if RUBY_VERSION >= '3.0'
28
30
  if defined?(JRUBY_VERSION)
29
31
  gem 'pry-nav'
30
32
  else
33
+ gem 'async-http-faraday'
31
34
  gem 'faraday-patron'
32
35
  gem 'oj'
33
36
  gem 'pry-byebug'
@@ -123,8 +123,8 @@ module Elastic
123
123
  #
124
124
  def initialize(arguments = {}, &block)
125
125
  @arguments = arguments.transform_keys(&:to_sym)
126
- @arguments[:logger] ||= @arguments[:log] ? DEFAULT_LOGGER.call() : nil
127
- @arguments[:tracer] ||= @arguments[:trace] ? DEFAULT_TRACER.call() : nil
126
+ @arguments[:logger] ||= @arguments[:log] ? DEFAULT_LOGGER.call : nil
127
+ @arguments[:tracer] ||= @arguments[:trace] ? DEFAULT_TRACER.call : nil
128
128
  @arguments[:reload_connections] ||= false
129
129
  @arguments[:retry_on_failure] ||= false
130
130
  @arguments[:delay_on_retry] ||= 0
@@ -134,13 +134,7 @@ module Elastic
134
134
  @arguments[:http] ||= {}
135
135
  @arguments[:enable_meta_header] = arguments.fetch(:enable_meta_header, true)
136
136
 
137
- @hosts ||= __extract_hosts(@arguments[:hosts] ||
138
- @arguments[:host] ||
139
- @arguments[:url] ||
140
- @arguments[:urls] ||
141
- ENV['ELASTICSEARCH_URL'] ||
142
- DEFAULT_HOST)
143
-
137
+ @hosts ||= extract_hosts
144
138
  @send_get_body_as = @arguments[:send_get_body_as] || 'GET'
145
139
  @ca_fingerprint = @arguments.delete(:ca_fingerprint)
146
140
 
@@ -153,7 +147,7 @@ module Elastic
153
147
  else
154
148
  @transport_class = @arguments[:transport_class] || DEFAULT_TRANSPORT_CLASS
155
149
  @transport = if @transport_class == Transport::HTTP::Faraday
156
- @arguments[:adapter] ||= __auto_detect_adapter
150
+ @arguments[:adapter] ||= auto_detect_adapter
157
151
  set_meta_header # from include MetaHeader
158
152
  @transport_class.new(hosts: @hosts, options: @arguments) do |faraday|
159
153
  faraday.adapter(@arguments[:adapter])
@@ -246,7 +240,7 @@ module Elastic
246
240
  #
247
241
  # @api private
248
242
  #
249
- def __extract_hosts(hosts_config)
243
+ def extract_hosts
250
244
  hosts = case hosts_config
251
245
  when String
252
246
  hosts_config.split(',').map { |h| h.strip! || h }
@@ -257,12 +251,20 @@ module Elastic
257
251
  else
258
252
  Array(hosts_config)
259
253
  end
260
-
261
- host_list = hosts.map { |host| __parse_host(host) }
254
+ host_list = hosts.map { |host| parse_host(host) }
262
255
  @arguments[:randomize_hosts] ? host_list.shuffle! : host_list
263
256
  end
264
257
 
265
- def __parse_host(host)
258
+ def hosts_config
259
+ @arguments[:hosts] ||
260
+ @arguments[:host] ||
261
+ @arguments[:url] ||
262
+ @arguments[:urls] ||
263
+ ENV['ELASTICSEARCH_URL'] ||
264
+ DEFAULT_HOST
265
+ end
266
+
267
+ def parse_host(host)
266
268
  host_parts = case host
267
269
  when String
268
270
  if host =~ /^[a-z]+\:\/\//
@@ -313,12 +315,14 @@ module Elastic
313
315
  #
314
316
  # @api private
315
317
  #
316
- def __auto_detect_adapter
318
+ def auto_detect_adapter
317
319
  if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new(2)
318
320
  return :patron if defined?(Faraday::Adapter::Patron)
319
321
  return :typhoeus if defined?(Faraday::Adapter::Typhoeus)
320
322
  return :httpclient if defined?(Faraday::Adapter::HTTPClient)
321
323
  return :net_http_persistent if defined?(Faraday::Adapter::NetHttpPersistent)
324
+ return :excon if defined?(Faraday::Adapter::Excon)
325
+ return :async_http if defined?(Async::HTTP::Faraday)
322
326
  else
323
327
  return :patron if defined?(::Patron)
324
328
  return :typhoeus if defined?(::Typhoeus)
@@ -21,70 +21,77 @@ module Elastic
21
21
  #
22
22
  # @api private
23
23
  class OpenTelemetry
24
- OTEL_TRACER_NAME = 'elasticsearch-api'
24
+ OTEL_TRACER_NAME = 'elasticsearch-api'.freeze
25
25
  # Valid values for the enabled config are 'true' and 'false'. Default is 'true'.
26
- ENV_VARIABLE_ENABLED = 'OTEL_RUBY_INSTRUMENTATION_ELASTICSEARCH_ENABLED'
26
+ ENV_VARIABLE_ENABLED = 'OTEL_RUBY_INSTRUMENTATION_ELASTICSEARCH_ENABLED'.freeze
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_RUBY_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY'
31
- ENV_VARIABLE_DEPRECATED_BODY_STRATEGY = 'OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY'
32
- DEFAULT_BODY_STRATEGY = 'omit'
30
+ ENV_VARIABLE_BODY_STRATEGY = 'OTEL_RUBY_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY'.freeze
31
+ ENV_VARIABLE_DEPRECATED_BODY_STRATEGY = 'OTEL_INSTRUMENTATION_ELASTICSEARCH_CAPTURE_SEARCH_QUERY'.freeze
32
+ DEFAULT_BODY_STRATEGY = 'omit'.freeze
33
33
  # A string list of keys whose values are redacted. This is only relevant if the body strategy is
34
34
  # 'sanitize'. For example, a config 'sensitive-key,other-key' will redact the values at
35
35
  # 'sensitive-key' and 'other-key' in addition to the default keys.
36
- ENV_VARIABLE_BODY_SANITIZE_KEYS = 'OTEL_RUBY_INSTRUMENTATION_ELASTICSEARCH_SEARCH_QUERY_SANITIZE_KEYS'
36
+ ENV_VARIABLE_BODY_SANITIZE_KEYS = 'OTEL_RUBY_INSTRUMENTATION_ELASTICSEARCH_SEARCH_QUERY_SANITIZE_KEYS'.freeze
37
37
 
38
38
  # A list of the Elasticsearch endpoints that qualify as "search" endpoints. The search query in
39
39
  # the request body may be captured for these endpoints, depending on the body capture strategy.
40
40
  SEARCH_ENDPOINTS = Set[
41
- "search",
42
- "async_search.submit",
43
- "msearch",
44
- "eql.search",
45
- "terms_enum",
46
- "search_template",
47
- "msearch_template",
48
- "render_search_template",
41
+ 'search',
42
+ 'async_search.submit',
43
+ 'msearch',
44
+ 'eql.search',
45
+ 'terms_enum',
46
+ 'search_template',
47
+ 'msearch_template',
48
+ 'render_search_template',
49
49
  ]
50
50
 
51
51
  # Initialize the Open Telemetry wrapper object. Takes the options originally passed to
52
52
  # Client#initialize.
53
53
  def initialize(opts)
54
- @tracer = (opts[:opentelemetry_tracer_provider] || ::OpenTelemetry.tracer_provider).tracer(
55
- OTEL_TRACER_NAME, Elastic::Transport::VERSION
56
- )
57
- @body_strategy = ENV[ENV_VARIABLE_DEPRECATED_BODY_STRATEGY] || ENV[ENV_VARIABLE_BODY_STRATEGY] ||
58
- DEFAULT_BODY_STRATEGY
54
+ @tracer = tracer_provider(opts).tracer(OTEL_TRACER_NAME, Elastic::Transport::VERSION)
55
+ @body_strategy = ENV[ENV_VARIABLE_DEPRECATED_BODY_STRATEGY] ||
56
+ ENV[ENV_VARIABLE_BODY_STRATEGY] ||
57
+ DEFAULT_BODY_STRATEGY
59
58
  @sanitize_keys = ENV[ENV_VARIABLE_BODY_SANITIZE_KEYS]&.split(',')&.collect! do |pattern|
60
59
  Regexp.new(pattern.gsub('*', '.*'))
61
60
  end
62
61
  end
63
62
  attr_accessor :tracer
64
63
 
64
+ def tracer_provider(opts)
65
+ opts[:opentelemetry_tracer_provider] || ::OpenTelemetry.tracer_provider
66
+ end
67
+
65
68
  # Process the request body. Applies the body strategy, which can be one of the following:
66
- # 'omit': return nil
69
+ # 'omit' (DEFAULT_BODY_STRATEGY): return nil
67
70
  # 'sanitize': redact values at the default list of keys + any additional keys provided in
68
71
  # the OTEL_RUBY_INSTRUMENTATION_ELASTICSEARCH_SEARCH_QUERY_SANITIZE_KEYS env variable.
69
72
  # 'raw': return the original body, unchanged
70
73
  def process_body(body, endpoint)
71
- unless @body_strategy == 'omit' || !SEARCH_ENDPOINTS.include?(endpoint)
72
- if @body_strategy == 'sanitize'
73
- Sanitizer.sanitize(body, @sanitize_keys).to_json
74
- elsif @body_strategy == 'raw'
75
- body&.is_a?(String) ? body : body.to_json
76
- end
74
+ return if @body_strategy == DEFAULT_BODY_STRATEGY || !search_endpoint?(endpoint)
75
+
76
+ if @body_strategy == 'sanitize'
77
+ Sanitizer.sanitize(body, @sanitize_keys).to_json
78
+ elsif @body_strategy == 'raw'
79
+ body.is_a?(String) ? body : body.to_json
77
80
  end
78
81
  end
79
82
 
83
+ def search_endpoint?(endpoint)
84
+ SEARCH_ENDPOINTS.include?(endpoint)
85
+ end
86
+
80
87
  # Replaces values in a hash with 'REDACTED', given a set of keys to match on.
81
88
  class Sanitizer
82
89
  class << self
83
- FILTERED = 'REDACTED'
90
+ FILTERED = 'REDACTED'.freeze
84
91
  DEFAULT_KEY_PATTERNS =
85
92
  %w[password passwd pwd secret *key *token* *session* *credit* *card* *auth* set-cookie].map! do |p|
86
- Regexp.new(p.gsub('*', '.*'))
87
- end
93
+ Regexp.new(p.gsub('*', '.*'))
94
+ end
88
95
 
89
96
  def sanitize(body, key_patterns = [])
90
97
  patterns = DEFAULT_KEY_PATTERNS
@@ -83,7 +83,7 @@ module Elastic
83
83
  # @return [Connections::Connection]
84
84
  # @see Connections::Collection#get_connection
85
85
  #
86
- def get_connection(options={})
86
+ def get_connection(options = {})
87
87
  resurrect_dead_connections! if Time.now > @last_request_at + @resurrect_after
88
88
 
89
89
  @counter_mtx.synchronize { @counter += 1 }
@@ -120,7 +120,7 @@ module Elastic
120
120
  # @return [Connections::Collection]
121
121
  # @api private
122
122
  #
123
- def __rebuild_connections(arguments={})
123
+ def __rebuild_connections(arguments = {})
124
124
  @state_mutex.synchronize do
125
125
  @hosts = arguments[:hosts] || []
126
126
  @options = arguments[:options] || {}
@@ -195,7 +195,7 @@ module Elastic
195
195
  #
196
196
  def __log_response(method, path, params, body, url, response, json, took, duration)
197
197
  if logger
198
- sanitized_url = sanitize_url(url.to_s)
198
+ sanitized_url = url.to_s.gsub(/\/\/(.+):(.+)@/, '//' + '\1:' + SANITIZED_PASSWORD + '@')
199
199
  log_info "#{method.to_s.upcase} #{sanitized_url} " +
200
200
  "[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]"
201
201
  log_debug "> #{__convert_to_json(body)}" if body
@@ -232,7 +232,7 @@ module Elastic
232
232
  #
233
233
  # @api private
234
234
  #
235
- def __convert_to_json(o=nil, options={})
235
+ def __convert_to_json(o = nil, options = {})
236
236
  o.is_a?(String) ? o : serializer.dump(o, options)
237
237
  end
238
238
 
@@ -472,13 +472,9 @@ module Elastic
472
472
  end
473
473
  end
474
474
 
475
- def sanitize_url(url)
476
- url.to_s.gsub(/\/\/(.+):(.+)@/, '//' + '\1:' + SANITIZED_PASSWORD + '@')
477
- end
478
-
479
475
  def capture_otel_span_attributes(connection, url)
480
476
  if defined?(::OpenTelemetry)
481
- ::OpenTelemetry::Trace.current_span&.set_attribute('url.full', sanitize_url(url))
477
+ ::OpenTelemetry::Trace.current_span&.set_attribute('url.full', url)
482
478
  ::OpenTelemetry::Trace.current_span&.set_attribute('server.address', connection.host[:host])
483
479
  ::OpenTelemetry::Trace.current_span&.set_attribute('server.port', connection.host[:port].to_i)
484
480
  end
@@ -15,8 +15,6 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
- require 'timeout'
19
-
20
18
  module Elastic
21
19
  module Transport
22
20
  module Transport
@@ -15,8 +15,6 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
- require 'timeout'
19
-
20
18
  module Elastic
21
19
  module Transport
22
20
  module Transport
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elastic
19
19
  module Transport
20
- VERSION = '8.3.6'.freeze
20
+ VERSION = '8.4.0'.freeze
21
21
  end
22
22
  end
@@ -18,6 +18,7 @@
18
18
  require 'faraday'
19
19
  require 'multi_json'
20
20
  require 'time'
21
+ require 'timeout'
21
22
  require 'uri'
22
23
  require 'zlib'
23
24
 
@@ -225,6 +225,38 @@ describe Elastic::Transport::Client do
225
225
  end
226
226
  end unless jruby?
227
227
 
228
+ context 'when the adapter is excon' do
229
+ let(:adapter) do
230
+ client.transport.connections.all.first.connection.builder.adapter
231
+ end
232
+
233
+ let(:client) do
234
+ require 'faraday/excon'
235
+
236
+ described_class.new(adapter: :excon, enable_meta_header: false)
237
+ end
238
+
239
+ it 'uses Faraday with the adapter' do
240
+ expect(adapter).to eq Faraday::Adapter::Excon
241
+ end
242
+ end if is_faraday_v2?
243
+
244
+ context 'when the adapter is async-http' do
245
+ let(:adapter) do
246
+ client.transport.connections.all.first.connection.builder.adapter
247
+ end
248
+
249
+ let(:client) do
250
+ require 'async/http/faraday'
251
+
252
+ described_class.new(adapter: :async_http, enable_meta_header: false)
253
+ end
254
+
255
+ it 'uses Faraday with the adapter' do
256
+ expect(adapter).to eq Async::HTTP::Faraday::Adapter
257
+ end
258
+ end unless jruby? || !is_faraday_v2?
259
+
228
260
  context 'when the adapter is specified as a string key' do
229
261
  let(:adapter) do
230
262
  client.transport.connections.all.first.connection.builder.adapter
@@ -1453,6 +1485,7 @@ describe Elastic::Transport::Client do
1453
1485
 
1454
1486
  context 'when using the HTTPClient adapter' do
1455
1487
  require 'faraday/httpclient'
1488
+ require 'mutex_m' if RUBY_VERSION >= '3.4'
1456
1489
 
1457
1490
  let(:client) do
1458
1491
  described_class.new(hosts: ELASTICSEARCH_HOSTS, compression: true, adapter: :httpclient, enable_meta_header: false)
@@ -320,22 +320,6 @@ if defined?(::OpenTelemetry)
320
320
  end
321
321
  end
322
322
  end
323
-
324
- context 'sanitize in URL' do
325
- let(:client) {
326
- Elastic::Transport::Client.new(host: 'http://elastic:changeme@localhost:9250')
327
- }
328
-
329
- it 'sanitizes URL' do
330
- client.perform_request(
331
- 'GET', '/', {}, nil, {}
332
- )
333
-
334
- span = exporter.finished_spans.find { |s| s.name == 'GET' }
335
- expect(span.name).to eql('GET')
336
- expect(span.attributes['url.full']).to match(/http:\/\/elastic:\*+@localhost:9250/)
337
- end
338
- end
339
323
  end
340
324
  end
341
325
  end
@@ -72,6 +72,22 @@ class Elastic::Transport::ClientAdaptersUnitTest < Minitest::Test
72
72
  end
73
73
  end
74
74
 
75
+ should 'use Excon Faraday adapter' do
76
+ fork do
77
+ require 'faraday/excon'
78
+ client = Elastic::Transport::Client.new
79
+ assert_equal(client.transport.connections.first.connection.adapter, Faraday::Adapter::Excon)
80
+ end
81
+ end if is_faraday_v2?
82
+
83
+ should 'use Async HTTP Faraday adapter' do
84
+ fork do
85
+ require 'async/http/faraday'
86
+ client = Elastic::Transport::Client.new
87
+ assert_equal(client.transport.connections.first.connection.adapter, Async::HTTP::Faraday::Adapter)
88
+ end
89
+ end if is_faraday_v2?
90
+
75
91
  should 'use HTTPClient Faraday adapter' do
76
92
  fork do
77
93
  if is_faraday_v2?
@@ -81,7 +97,7 @@ class Elastic::Transport::ClientAdaptersUnitTest < Minitest::Test
81
97
  end
82
98
 
83
99
  client = Elastic::Transport::Client.new
84
- assert_equal(Faraday::Adapter::HTTPClient, client.transport.connections.first.connection.adapter)
100
+ assert_equal(client.transport.connections.first.connection.adapter, Faraday::Adapter::HTTPClient)
85
101
  end
86
102
  end
87
103
  end unless jruby?
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.3.6
4
+ version: 8.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic Client Library Maintainers
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2025-02-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: faraday
@@ -256,8 +256,8 @@ email:
256
256
  executables: []
257
257
  extensions: []
258
258
  extra_rdoc_files:
259
- - LICENSE
260
259
  - README.md
260
+ - LICENSE
261
261
  files:
262
262
  - ".github/check_license_headers.rb"
263
263
  - ".github/license-header.txt"
@@ -338,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
338
  - !ruby/object:Gem::Version
339
339
  version: '0'
340
340
  requirements: []
341
- rubygems_version: 3.6.9
341
+ rubygems_version: 3.6.2
342
342
  specification_version: 4
343
343
  summary: Low level Ruby client for Elastic services.
344
344
  test_files: