elastic-transport 8.3.5 → 8.3.6

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: a4543af71a663d5f638c673407101529237507d56e7e2034f0c7e9fd5dd78c6a
4
- data.tar.gz: 39a000ce02f4cf2208d0ec41f51f133e74454748f90eb6617d08bac3aad7e572
3
+ metadata.gz: 55e1343a320fd2a1dba29077ff4d9ad72b6adf62fe918856480f43e00e8a9927
4
+ data.tar.gz: da17629d377258be5b8564ba0bd82c3ef6119117e307a14ac60f8da14894e375
5
5
  SHA512:
6
- metadata.gz: 747447a8e84b3f71f1b8244237809c2087e60de35426820d065de72fb57b9ab17094ee1fb95e2f228c41902098b1d2ba8fd1f248f6d2cf493785d50745c08ec0
7
- data.tar.gz: 6923af2b78bf3a8ecb956038a878f1752723546dfdabd3d6d3492f545f9d51312807a8faf7a8e1adee21b34034d95569b01939172198eb572709d16e6e5ace53
6
+ metadata.gz: e375ab5339638b8fedd29d38ae0ff6384407e8256c9201c383ee084689e4781752fe4cc9b23830a2380185234acfbbc59533d91f653ec51fff9007a433b033b3
7
+ data.tar.gz: 25a3847030def992ed441260e8921509ad5375353ad3e564218e799341bc53942e30245e6dad79c6e38e1783b993298e6729951320bb785e17308a2f5f9ca19f
@@ -2,10 +2,10 @@ name: opentelemetry
2
2
  on:
3
3
  push:
4
4
  branches:
5
- - main
5
+ - 8.3
6
6
  pull_request:
7
7
  branches:
8
- - main
8
+ - 8.3
9
9
  jobs:
10
10
  test-otel:
11
11
  name: 'Test Open Telemetry'
@@ -17,7 +17,7 @@ jobs:
17
17
  fail-fast: false
18
18
  matrix:
19
19
  ruby: ['3.3', 'jruby-9.4']
20
- es_version: ['8.15.0-SNAPSHOT']
20
+ es_version: ['9.2.0-SNAPSHOT']
21
21
  runs-on: ubuntu-latest
22
22
  steps:
23
23
  - uses: actions/checkout@v4
@@ -1,11 +1,11 @@
1
- name: main tests
1
+ name: 8.3 tests
2
2
  on:
3
3
  push:
4
4
  branches:
5
- - main
5
+ - 8.3
6
6
  pull_request:
7
7
  branches:
8
- - main
8
+ - 8.3
9
9
  jobs:
10
10
  test:
11
11
  name: 'Main tests'
@@ -15,8 +15,8 @@ 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.14.2-SNAPSHOT', '8.15.0-SNAPSHOT', '8.16.0-SNAPSHOT']
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']
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.0', '3.1', '3.2', '3.3', 'jruby-9.3']
57
- es_version: ['8.16.0-SNAPSHOT']
56
+ ruby: ['3.1', '3.2', '3.3', '3.4', 'jruby-9.3']
57
+ es_version: ['8.19.5-SNAPSHOT']
58
58
  runs-on: ubuntu-latest
59
59
  steps:
60
60
  - uses: actions/checkout@v4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 8.3.6
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)
5
+
1
6
  ## 8.3.5
2
7
 
3
8
  - Small updates in source code documentation.
@@ -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 = url.to_s.gsub(/\/\/(.+):(.+)@/, '//' + '\1:' + SANITIZED_PASSWORD + '@')
198
+ sanitized_url = sanitize_url(url.to_s)
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
@@ -472,9 +472,13 @@ 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
+
475
479
  def capture_otel_span_attributes(connection, url)
476
480
  if defined?(::OpenTelemetry)
477
- ::OpenTelemetry::Trace.current_span&.set_attribute('url.full', url)
481
+ ::OpenTelemetry::Trace.current_span&.set_attribute('url.full', sanitize_url(url))
478
482
  ::OpenTelemetry::Trace.current_span&.set_attribute('server.address', connection.host[:host])
479
483
  ::OpenTelemetry::Trace.current_span&.set_attribute('server.port', connection.host[:port].to_i)
480
484
  end
@@ -15,6 +15,8 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
+ require 'timeout'
19
+
18
20
  module Elastic
19
21
  module Transport
20
22
  module Transport
@@ -15,6 +15,8 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
+ require 'timeout'
19
+
18
20
  module Elastic
19
21
  module Transport
20
22
  module Transport
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elastic
19
19
  module Transport
20
- VERSION = '8.3.5'.freeze
20
+ VERSION = '8.3.6'.freeze
21
21
  end
22
22
  end
@@ -18,7 +18,6 @@
18
18
  require 'faraday'
19
19
  require 'multi_json'
20
20
  require 'time'
21
- require 'timeout'
22
21
  require 'uri'
23
22
  require 'zlib'
24
23
 
@@ -320,6 +320,22 @@ 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
323
339
  end
324
340
  end
325
341
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.3.5
4
+ version: 8.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic Client Library Maintainers
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: faraday
@@ -257,8 +256,8 @@ email:
257
256
  executables: []
258
257
  extensions: []
259
258
  extra_rdoc_files:
260
- - README.md
261
259
  - LICENSE
260
+ - README.md
262
261
  files:
263
262
  - ".github/check_license_headers.rb"
264
263
  - ".github/license-header.txt"
@@ -324,7 +323,6 @@ metadata:
324
323
  changelog_uri: https://github.com/elastic/elastic-transport-ruby/blob/master/CHANGELOG.md
325
324
  source_code_uri: https://github.com/elastic/elastic-transport-ruby
326
325
  bug_tracker_uri: https://github.com/elastic/elastic-transport-ruby/issues
327
- post_install_message:
328
326
  rdoc_options:
329
327
  - "--charset=UTF-8"
330
328
  require_paths:
@@ -340,8 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
340
338
  - !ruby/object:Gem::Version
341
339
  version: '0'
342
340
  requirements: []
343
- rubygems_version: 3.4.19
344
- signing_key:
341
+ rubygems_version: 3.6.9
345
342
  specification_version: 4
346
343
  summary: Low level Ruby client for Elastic services.
347
344
  test_files: