diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index ba804e74b..7692d3a8f 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -2,12 +2,12 @@ name: Integration with Compatibility on: push: branches: - - "*" + - "x" paths-ignore: - '*.md' pull_request: branches: - - "*" + - "x" paths-ignore: - '*.md' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 364afafcb..8a40b2478 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,12 +2,12 @@ name: Integration on: push: branches: - - "*" + - "x" paths-ignore: - '*.md' pull_request: branches: - - "*" + - "x" paths-ignore: - '*.md' jobs: diff --git a/.github/workflows/test-unreleased.yml b/.github/workflows/test-unreleased.yml index e7140916b..63a826fad 100644 --- a/.github/workflows/test-unreleased.yml +++ b/.github/workflows/test-unreleased.yml @@ -15,6 +15,7 @@ on: jobs: test: env: + FARADAY_VERSION: '~> 1' TEST_OPENSEARCH_SERVER: http://localhost:9200 PORT: 9200 runs-on: ubuntu-latest diff --git a/lib/opensearch/transport/transport/base.rb b/lib/opensearch/transport/transport/base.rb index fd96e37e8..2a6cdb0e2 100644 --- a/lib/opensearch/transport/transport/base.rb +++ b/lib/opensearch/transport/transport/base.rb @@ -285,17 +285,22 @@ def perform_request(method, path, params = {}, body = nil, _headers = nil, opts ignore = Array(params.delete(:ignore)).compact.map(&:to_i) begin + puts "TRY #{tries}, getting connection ..." tries += 1 connection = get_connection or raise(Error, 'Cannot get new connection from pool.') + puts " CONNECTION #{connection} ..." if connection.connection.respond_to?(:params) && connection.connection.params.respond_to?(:to_hash) params = connection.connection.params.merge(params.to_hash) end url = connection.full_url(path, params) + puts " URL #{url} ..." response = block.call(connection, url) + puts " RESPONSE #{response}, #{response.status} ..." + puts " FAILURES #{connection.failures} ..." connection.healthy! if connection.failures.positive? # Raise an exception so we can catch it for `retry_on_status` @@ -303,6 +308,7 @@ def perform_request(method, path, params = {}, body = nil, _headers = nil, opts __raise_transport_error(response) end rescue OpenSearch::Transport::Transport::ServerError => e + puts " ERROR #{e} ..." raise e unless response && @retry_on_status.include?(response.status) log_warn "[#{e.class}] Attempt #{tries} to get response from #{url}" if tries <= (max_retries || DEFAULT_MAX_RETRIES) @@ -312,6 +318,7 @@ def perform_request(method, path, params = {}, body = nil, _headers = nil, opts raise e end rescue *host_unreachable_exceptions => e + puts " DEAD #{e} ..." log_error "[#{e.class}] #{e.message} #{connection.host.inspect}" connection.dead! @@ -335,6 +342,7 @@ def perform_request(method, path, params = {}, body = nil, _headers = nil, opts end duration = Time.now - start + puts " DURATION #{duration} ..." if response.status.to_i >= 300 __log_response method, path, params, body, url, response, nil, 'N/A', duration @@ -369,9 +377,11 @@ def perform_request(method, path, params = {}, body = nil, _headers = nil, opts warnings(response.headers['warning']) if response.headers&.[]('warning') + puts " RESPONSE #{response.status}, done." Response.new response.status, json || response.body, response.headers ensure @last_request_at = Time.now + puts " ENSURE #{@last_request_at} ..." end # @abstract Returns an Array of connection errors specific to the transport implementation. diff --git a/lib/opensearch/transport/transport/http/faraday.rb b/lib/opensearch/transport/transport/http/faraday.rb index 16f21c138..e32bebdc7 100644 --- a/lib/opensearch/transport/transport/http/faraday.rb +++ b/lib/opensearch/transport/transport/http/faraday.rb @@ -55,6 +55,7 @@ def perform_request(method, path, params = {}, body = nil, headers = nil, opts = headers end + puts " RUN #{connection.connection}, #{method}, #{url}, #{body}, #{headers}" response = connection.connection.run_request( method.downcase.to_sym, url, @@ -62,6 +63,7 @@ def perform_request(method, path, params = {}, body = nil, headers = nil, opts = headers ) + puts " RESPONSE #{response.status}, #{response.body&.size}, #{response.headers}" Response.new response.status, decompress_response(response.body), response.headers end end