elastic-transport 8.3.2 → 8.3.5

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: 0ece16e8da350495285378d8f76df8e40a3c366c75e90c37c6e7d5558780b175
4
- data.tar.gz: 10655669e9c1b4254e607424ee4acd5d2cdaa3c56a3a8988f6a29e6b507fa982
3
+ metadata.gz: a4543af71a663d5f638c673407101529237507d56e7e2034f0c7e9fd5dd78c6a
4
+ data.tar.gz: 39a000ce02f4cf2208d0ec41f51f133e74454748f90eb6617d08bac3aad7e572
5
5
  SHA512:
6
- metadata.gz: 4e541aaddfc31d02364d648e96dac3c7e42abda88650fc1c8e48dbdb3c84f26bc83fb9355c52e3972cd3c6d5ebf1b6e670c7beb0449988d8db69641013bae19f
7
- data.tar.gz: 4cbde4527ca45280bf0cdd719ace9823e4c5462c03b0404263f5c4ac6dd0328249ca04cbb1d6a01bfad8ab489355ac8acb7513255069586a99e6575a1915bdce
6
+ metadata.gz: 747447a8e84b3f71f1b8244237809c2087e60de35426820d065de72fb57b9ab17094ee1fb95e2f228c41902098b1d2ba8fd1f248f6d2cf493785d50745c08ec0
7
+ data.tar.gz: 6923af2b78bf3a8ecb956038a878f1752723546dfdabd3d6d3492f545f9d51312807a8faf7a8e1adee21b34034d95569b01939172198eb572709d16e6e5ace53
@@ -4,7 +4,7 @@ jobs:
4
4
  build:
5
5
  runs-on: ubuntu-latest
6
6
  steps:
7
- - uses: actions/checkout@v3
7
+ - uses: actions/checkout@v4
8
8
  - uses: ruby/setup-ruby@v1
9
9
  with:
10
10
  ruby-version: 3
@@ -17,10 +17,10 @@ jobs:
17
17
  fail-fast: false
18
18
  matrix:
19
19
  ruby: ['3.3', 'jruby-9.4']
20
- es_version: ['8.12-SNAPSHOT']
20
+ es_version: ['8.15.0-SNAPSHOT']
21
21
  runs-on: ubuntu-latest
22
22
  steps:
23
- - uses: actions/checkout@v2
23
+ - uses: actions/checkout@v4
24
24
  - name: Increase system limits
25
25
  run: |
26
26
  sudo swapoff -a
@@ -15,11 +15,11 @@ jobs:
15
15
  strategy:
16
16
  fail-fast: false
17
17
  matrix:
18
- ruby: [ '3.0', '3.1', '3.2', '3.3', 'jruby-9.3', 'jruby-9.4' ]
19
- es_version: ['8.10-SNAPSHOT', '8.11-SNAPSHOT', '8.12-SNAPSHOT']
18
+ ruby: ['3.0', '3.1', '3.2', '3.3', 'jruby-9.3', 'jruby-9.4']
19
+ es_version: ['8.14.2-SNAPSHOT', '8.15.0-SNAPSHOT', '8.16.0-SNAPSHOT']
20
20
  runs-on: ubuntu-latest
21
21
  steps:
22
- - uses: actions/checkout@v3
22
+ - uses: actions/checkout@v4
23
23
  - name: Increase system limits
24
24
  run: |
25
25
  sudo swapoff -a
@@ -53,11 +53,11 @@ jobs:
53
53
  strategy:
54
54
  fail-fast: false
55
55
  matrix:
56
- ruby: [ '3.0', '3.1', '3.2', '3.3', 'jruby-9.3' ]
57
- es_version: ['8.12-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
- - uses: actions/checkout@v3
60
+ - uses: actions/checkout@v4
61
61
  - name: Increase system limits
62
62
  run: |
63
63
  sudo swapoff -a
@@ -76,7 +76,6 @@ jobs:
76
76
  sudo apt-get update
77
77
  sudo apt-get install libcurl4-openssl-dev
78
78
  ruby -v
79
- gem install bundler
80
79
  BUNDLE_GEMFILE=./Gemfile-faraday1.gemfile bundle install
81
80
  - name: faraday1 unit tests
82
81
  run: BUNDLE_GEMFILE=./Gemfile-faraday1.gemfile bundle exec rake test:faraday1:unit
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 8.3.5
2
+
3
+ - Small updates in source code documentation.
4
+ - Updates meta header for Elasticsearch Serverless.
5
+ - Fixes issues with ES_SERVERLESS_SERVICE_VERSION for backwards compatibility
6
+
7
+ ## 8.3.3, 8.3.4 (yanked)
8
+
9
+ - Yanked due to errors.
10
+
1
11
  ## 8.3.2
2
12
 
3
13
  - 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`.
data/Gemfile CHANGED
@@ -23,16 +23,14 @@ gemspec
23
23
  group :development, :test do
24
24
  gem 'faraday-httpclient'
25
25
  gem 'faraday-net_http_persistent'
26
- gem 'faraday-patron' unless defined? JRUBY_VERSION
27
26
  gem 'faraday-typhoeus'
28
- gem 'rspec'
29
- gem 'oj' unless defined? JRUBY_VERSION
27
+ gem 'opentelemetry-sdk', require: false if RUBY_VERSION >= '3.0'
30
28
  if defined?(JRUBY_VERSION)
31
29
  gem 'pry-nav'
32
30
  else
31
+ gem 'faraday-patron'
32
+ gem 'oj'
33
33
  gem 'pry-byebug'
34
34
  end
35
- if RUBY_VERSION >= '3.0'
36
- gem 'opentelemetry-sdk', require: false
37
- end
35
+ gem 'rspec'
38
36
  end
@@ -23,18 +23,18 @@ source 'https://rubygems.org'
23
23
  # $ BUNDLE_GEMFILE=./Gemfile-faraday1.gemfile bundle exec rake test:faraday1:unit
24
24
 
25
25
  gem 'faraday', '~> 1'
26
- gemspec path: './'
26
+ gemspec
27
27
 
28
28
  group :development, :test do
29
29
  gem 'httpclient'
30
30
  gem 'net-http-persistent'
31
- gem 'patron' unless defined? JRUBY_VERSION
32
31
  gem 'rspec'
33
32
  gem 'typhoeus'
34
- gem 'oj' unless defined? JRUBY_VERSION
35
33
  if defined?(JRUBY_VERSION)
36
34
  gem 'pry-nav'
37
35
  else
38
36
  gem 'pry-byebug'
37
+ gem 'oj'
38
+ gem 'patron'
39
39
  end
40
40
  end
@@ -83,7 +83,7 @@ module Elastic
83
83
  #
84
84
  # @option arguments [Integer] :sniffer_timeout Timeout for reloading connections in seconds (1 by default)
85
85
  #
86
- # @option arguments [Boolean,Number] :retry_on_failure Retry X times when request fails before raising and
86
+ # @option arguments [Boolean,Number] :retry_on_failure Retry X times when request fails before raising an
87
87
  # exception (false by default)
88
88
  # @option arguments [Number] :delay_on_retry Delay in milliseconds between each retry (0 by default)
89
89
  #
@@ -91,7 +91,8 @@ module Elastic
91
91
  #
92
92
  # @option arguments [Boolean] :reload_on_failure Reload connections after failure (false by default)
93
93
  #
94
- # @option arguments [Integer] :request_timeout The request timeout to be passed to transport in options
94
+ # @option arguments [Integer] :request_timeout The request timeout to be passed to transport in options in seconds
95
+ # (the default value is taken from the transport)
95
96
  #
96
97
  # @option arguments [Symbol] :adapter A specific adapter for Faraday (e.g. `:patron`)
97
98
  #
@@ -110,7 +111,7 @@ module Elastic
110
111
  #
111
112
  # @option arguments [String] :send_get_body_as Specify the HTTP method to use for GET requests with a body.
112
113
  # (Default: GET)
113
- # @option arguments [true, false] :compression Whether to compress requests. Gzip compression will be used.
114
+ # @option arguments [Boolean] :compression Whether to compress requests. Gzip compression will be used.
114
115
  # The default is false. Responses will automatically be inflated if they are compressed.
115
116
  # If a custom transport object is used, it must handle the request compression and response inflation.
116
117
  #
@@ -172,7 +173,7 @@ module Elastic
172
173
  # Performs a request through delegation to {#transport}.
173
174
  #
174
175
  def perform_request(method, path, params = {}, body = nil, headers = nil, opts = {})
175
- method = @send_get_body_as if 'GET' == method && body
176
+ method = @send_get_body_as if method == 'GET' && body
176
177
  validate_ca_fingerprints if @ca_fingerprint
177
178
  if @otel
178
179
  # If no endpoint is specified in the opts, use the HTTP method name
@@ -41,6 +41,12 @@ module Elastic
41
41
  def meta_header_service_version
42
42
  if enterprise_search?
43
43
  Elastic::ENTERPRISE_SERVICE_VERSION
44
+ elsif serverless?
45
+ if defined?(Elastic::ES_SERVERLESS_SERVICE_VERSION)
46
+ Elastic::ES_SERVERLESS_SERVICE_VERSION
47
+ else
48
+ Elastic::ELASTICSEARCH_SERVICE_VERSION
49
+ end
44
50
  elsif elasticsearch?
45
51
  Elastic::ELASTICSEARCH_SERVICE_VERSION
46
52
  elsif defined?(Elasticsearch::VERSION)
@@ -60,6 +66,11 @@ module Elastic
60
66
  called_from?('elasticsearch')
61
67
  end
62
68
 
69
+ def serverless?
70
+ defined?(ElasticsearchServerless::CLIENT_VERSION) &&
71
+ called_from?('elasticsearch-serverless')
72
+ end
73
+
63
74
  def called_from?(service)
64
75
  !caller.select { |c| c.match?(service) }.empty?
65
76
  end
@@ -70,7 +81,7 @@ module Elastic
70
81
  def client_meta_version(version)
71
82
  regexp = /^([0-9]+\.[0-9]+\.[0-9]+)(\.?[a-z0-9.-]+)?$/
72
83
  match = version.match(regexp)
73
- return "#{match[1]}p" if (match[2])
84
+ return "#{match[1]}p" if match[2]
74
85
 
75
86
  version
76
87
  end
@@ -24,7 +24,7 @@ module Elastic
24
24
  module Base
25
25
  # @param transport [Object] The instance of transport which uses this serializer
26
26
  #
27
- def initialize(transport=nil)
27
+ def initialize(transport = nil)
28
28
  @transport = transport
29
29
  end
30
30
  end
@@ -36,13 +36,13 @@ module Elastic
36
36
 
37
37
  # De-serialize a Hash from JSON string
38
38
  #
39
- def load(string, options={})
39
+ def load(string, options = {})
40
40
  ::MultiJson.load(string, options)
41
41
  end
42
42
 
43
43
  # Serialize a Hash to JSON string
44
44
  #
45
- def dump(object, options={})
45
+ def dump(object, options = {})
46
46
  ::MultiJson.dump(object, options)
47
47
  end
48
48
  end
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elastic
19
19
  module Transport
20
- VERSION = '8.3.2'.freeze
20
+ VERSION = '8.3.5'.freeze
21
21
  end
22
22
  end
@@ -20,66 +20,66 @@ require 'test_helper'
20
20
  class Elastic::Transport::Transport::Connections::ConnectionTest < Minitest::Test
21
21
  include Elastic::Transport::Transport::Connections
22
22
 
23
- context "Connection" do
24
- should "be initialized with :host, :connection, and :options" do
23
+ context 'Connection' do
24
+ should 'be initialized with :host, :connection, and :options' do
25
25
  c = Connection.new :host => 'x', :connection => 'y', :options => {}
26
26
  assert_equal 'x', c.host
27
27
  assert_equal 'y', c.connection
28
28
  assert_instance_of Hash, c.options
29
29
  end
30
30
 
31
- should "return full path" do
31
+ should 'return full path' do
32
32
  c = Connection.new
33
33
  assert_equal '_search', c.full_path('_search')
34
34
  assert_equal '_search', c.full_path('_search', {})
35
- assert_equal '_search?foo=bar', c.full_path('_search', {:foo => 'bar'})
36
- assert_equal '_search?foo=bar+bam', c.full_path('_search', {:foo => 'bar bam'})
35
+ assert_equal '_search?foo=bar', c.full_path('_search', {foo: 'bar'})
36
+ assert_equal '_search?foo=bar+bam', c.full_path('_search', {foo: 'bar bam'})
37
37
  end
38
38
 
39
- should "return full url" do
40
- c = Connection.new :host => { :protocol => 'http', :host => 'localhost', :port => '9200' }
41
- assert_equal 'http://localhost:9200/_search?foo=bar', c.full_url('_search', {:foo => 'bar'})
39
+ should 'return full url' do
40
+ c = Connection.new host: { protocol: 'http', host: 'localhost', port: '9200' }
41
+ assert_equal 'http://localhost:9200/_search?foo=bar', c.full_url('_search', { foo: 'bar' })
42
42
  end
43
43
 
44
- should "return full url with credentials" do
45
- c = Connection.new :host => { :protocol => 'http', :user => 'U', :password => 'P', :host => 'localhost', :port => '9200' }
46
- assert_equal 'http://U:P@localhost:9200/_search?foo=bar', c.full_url('_search', {:foo => 'bar'})
44
+ should 'return full url with credentials' do
45
+ c = Connection.new host: { protocol: 'http', user: 'U', password: 'P', host: 'localhost', port: '9200' }
46
+ assert_equal 'http://U:P@localhost:9200/_search?foo=bar', c.full_url('_search', { foo: 'bar' })
47
47
  end
48
48
 
49
- should "return full url with escaped credentials" do
50
- c = Connection.new :host => { :protocol => 'http', :user => 'U$$$', :password => 'P^^^', :host => 'localhost', :port => '9200' }
51
- assert_equal 'http://U%24%24%24:P%5E%5E%5E@localhost:9200/_search?foo=bar', c.full_url('_search', {:foo => 'bar'})
49
+ should 'return full url with escaped credentials' do
50
+ c = Connection.new host: { protocol: 'http', user: 'U$$$', password: 'P^^^', host: 'localhost', port: '9200' }
51
+ assert_equal 'http://U%24%24%24:P%5E%5E%5E@localhost:9200/_search?foo=bar', c.full_url('_search', { foo: 'bar' })
52
52
  end
53
53
 
54
- should "return full url with path" do
55
- c = Connection.new :host => { :protocol => 'http', :host => 'localhost', :port => '9200', :path => '/foo' }
56
- assert_equal 'http://localhost:9200/foo/_search?foo=bar', c.full_url('_search', {:foo => 'bar'})
54
+ should 'return full url with path' do
55
+ c = Connection.new host: { protocol: 'http', host: 'localhost', port: '9200', path: '/foo' }
56
+ assert_equal 'http://localhost:9200/foo/_search?foo=bar', c.full_url('_search', { foo: 'bar' })
57
57
  end
58
58
 
59
- should "return right full url with path when path starts with /" do
60
- c = Connection.new :host => { :protocol => 'http', :host => 'localhost', :port => '9200', :path => '/foo' }
61
- assert_equal 'http://localhost:9200/foo/_search?foo=bar', c.full_url('/_search', {:foo => 'bar'})
59
+ should 'return right full url with path when path starts with /' do
60
+ c = Connection.new host: { protocol: 'http', host: 'localhost', port: '9200', path: '/foo' }
61
+ assert_equal 'http://localhost:9200/foo/_search?foo=bar', c.full_url('/_search', { foo: 'bar' })
62
62
  end
63
63
 
64
- should "have a string representation" do
65
- c = Connection.new :host => 'x'
64
+ should 'have a string representation' do
65
+ c = Connection.new(host: 'x')
66
66
  assert_match(/host: x/, c.to_s)
67
67
  assert_match(/alive/, c.to_s)
68
68
  end
69
69
 
70
- should "not be dead by default" do
70
+ should 'not be dead by default' do
71
71
  c = Connection.new
72
72
  assert ! c.dead?
73
73
  end
74
74
 
75
- should "be dead when marked" do
75
+ should 'be dead when marked' do
76
76
  c = Connection.new.dead!
77
77
  assert c.dead?
78
78
  assert_equal 1, c.failures
79
79
  assert_in_delta c.dead_since, Time.now, 1
80
80
  end
81
81
 
82
- should "be alive when marked" do
82
+ should 'be alive when marked' do
83
83
  c = Connection.new.dead!
84
84
  assert c.dead?
85
85
  assert_equal 1, c.failures
@@ -90,7 +90,7 @@ class Elastic::Transport::Transport::Connections::ConnectionTest < Minitest::Tes
90
90
  assert_equal 1, c.failures
91
91
  end
92
92
 
93
- should "be healthy when marked" do
93
+ should 'be healthy when marked' do
94
94
  c = Connection.new.dead!
95
95
  assert c.dead?
96
96
  assert_equal 1, c.failures
@@ -101,35 +101,33 @@ class Elastic::Transport::Transport::Connections::ConnectionTest < Minitest::Tes
101
101
  assert_equal 0, c.failures
102
102
  end
103
103
 
104
- should "be resurrected if timeout passed" do
104
+ should 'be resurrected if timeout passed' do
105
105
  c = Connection.new.dead!
106
106
 
107
107
  now = Time.now + 60
108
108
  Time.stubs(:now).returns(now)
109
109
 
110
- assert c.resurrect!, c.inspect
111
- assert ! c.dead?, c.inspect
110
+ assert(c.resurrect!, c.inspect)
111
+ assert(!c.dead?, c.inspect)
112
112
  end
113
113
 
114
- should "be resurrected if timeout passed for multiple failures" do
114
+ should 'be resurrected if timeout passed for multiple failures' do
115
115
  c = Connection.new.dead!.dead!
116
116
 
117
- now = Time.now + 60*2
117
+ now = Time.now + 60 * 2
118
118
  Time.stubs(:now).returns(now)
119
119
 
120
120
  assert c.resurrect!, c.inspect
121
121
  assert ! c.dead?, c.inspect
122
122
  end
123
123
 
124
- should "implement the equality operator" do
125
- c1 = Connection.new(:host => { :protocol => 'http', :host => 'foo', :port => 123 })
126
- c2 = Connection.new(:host => { :protocol => 'http', :host => 'foo', :port => 123 })
127
- c3 = Connection.new(:host => { :protocol => 'http', :host => 'foo', :port => 456 })
124
+ should 'implement the equality operator' do
125
+ c1 = Connection.new(host: { protocol: 'http', host: 'foo', port: 123 })
126
+ c2 = Connection.new(host: { protocol: 'http', host: 'foo', port: 123 })
127
+ c3 = Connection.new(host: { protocol: 'http', host: 'foo', port: 456 })
128
128
 
129
129
  assert c1 == c2, "Connection #{c1} should be equal to #{c2}"
130
130
  assert c2 != c3, "Connection #{c2} should NOT be equal to #{c3}"
131
131
  end
132
-
133
132
  end
134
-
135
133
  end
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.2
4
+ version: 8.3.5
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-02-14 00:00:00.000000000 Z
11
+ date: 2024-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -340,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
340
340
  - !ruby/object:Gem::Version
341
341
  version: '0'
342
342
  requirements: []
343
- rubygems_version: 3.5.3
343
+ rubygems_version: 3.4.19
344
344
  signing_key:
345
345
  specification_version: 4
346
346
  summary: Low level Ruby client for Elastic services.