test-opensearch 0.0.0.18 → 0.0.0.21

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: 91c18a291793fda6a46f006bef41d93aa3f94ae6818d2b69ad27df0b5b4f6614
4
- data.tar.gz: f6854e958070eaf6596b603f5aee2deacf41b68c70308a524adab089b658e609
3
+ metadata.gz: 833739abc81a6562071c9047e266225855f059853b5071cd11452cff393b4a1a
4
+ data.tar.gz: 75c81ae847a0d5a3e12d8e3e211a7614778ee419ee5ef10f8aa2c194b3063d6f
5
5
  SHA512:
6
- metadata.gz: b98d89745b6419d64a2fb6e745791a715604e0c6aa28d2f52022648d71c322ca5c0b5c778f090e4a3ec88b3726a0a932357bd9aa41f900a4c8c807b9d24d01f7
7
- data.tar.gz: 1c303c1587a238ab2c9042ae3d2e0efe7ad838fc7b53c0253db281f29ec6f43a461451b2475eb818e6c8fb610f3f71c4c7e82fd5412e42ea9bef309176629f22
6
+ metadata.gz: e6d93a2323842bf0258558d0da05da7bd76a3b95bfbbd191943cfc9c6203e131db9ee49e0455a7426c7626ca8668d4800c3cb0d3dc0b9ec283d171698b44b3d5
7
+ data.tar.gz: ce93e37096e8ebf4c502990fc172b1c6523b8ba6f285a8e3bc7e9bdb9ef219a45d4385dee1ab4b377e686e51e949990b8f6b95bf22c16e0cf49e20a312cb0e8d
@@ -24,7 +24,16 @@
24
24
  + [docinfo_fields](#docinfo_fields)
25
25
  + [docinfo_target](#docinfo_target)
26
26
  + [docinfo](#docinfo)
27
- + [infinite_check_connection](#infinite_check_connection)
27
+ + [check_connection](#check_connection)
28
+ + [retry_forever](#retry_forever)
29
+ + [retry_timeout](#retry_timeout)
30
+ + [retry_max_times](#retry_max_times)
31
+ + [retry_type](#retry_type)
32
+ + [retry_wait](#retry_wait)
33
+ + [retry_exponential_backoff_base](#retry_exponential_backoff_base)
34
+ + [retry_max_interval](#retry_max_interval)
35
+ + [retry_randomize](#retry_randomize)
36
+
28
37
  * [Advanced Usage](#advanced-usage)
29
38
 
30
39
  ## Usage
@@ -275,14 +284,87 @@ This parameter specifies whether docinfo information including or not. The defau
275
284
  docinfo false
276
285
  ```
277
286
 
278
- ### infinite_check_connection
287
+ ### check_connection
288
+
289
+ The parameter for checking on connection availability with Elasticsearch or Opensearch hosts. The default value is `true`.
290
+
291
+ ```
292
+ check_connection true
293
+ ```
294
+ ### retry_forever
295
+
296
+ The parameter If true, plugin will ignore retry_timeout and retry_max_times options and retry forever. The default value is `true`.
297
+
298
+ ```
299
+ retry_forever true
300
+ ```
301
+
302
+ ### retry_timeout
303
+
304
+ The parameter maximum time (seconds) to retry again the failed try, until the plugin discards the retry.
305
+ If the next retry is going to exceed this time limit, the last retry will be made at exactly this time limit..
306
+ The default value is `72h`.
307
+ 72hours == 17 times with exponential backoff (not to change default behavior)
308
+
309
+ ```
310
+ retry_timeout 72 * 60 * 60
311
+ ```
312
+
313
+ ### retry_max_times
314
+
315
+ The parameter maximum number of times to retry the failed try. The default value is `5`
316
+
317
+ ```
318
+ retry_max_times 5
319
+ ```
320
+
321
+ ### retry_type
279
322
 
280
- The parameter infinite checking on connection availability with Elasticsearch or opensearch hosts, every request_timeout (default 5) seconds. The default value is `true`.
323
+ The parameter needs for how long need to wait (time in seconds) to retry again:
324
+ `exponential_backoff`: wait in seconds will become large exponentially per failure,
325
+ `periodic`: plugin will retry periodically with fixed intervals (configured via retry_wait). The default value is `:exponential_backoff`
326
+ Periodic -> fixed :retry_wait
327
+ Exponential backoff: k is number of retry times
328
+ c: constant factor, @retry_wait
329
+ b: base factor, @retry_exponential_backoff_base
330
+ k: times
331
+ total retry time: c + c * b^1 + (...) + c*b^k = c*b^(k+1) - 1
281
332
 
282
333
  ```
283
- infinite_check_connection true
334
+ retry_type :exponential_backoff
284
335
  ```
285
336
 
337
+ ### retry_wait
338
+
339
+ The parameter needs for wait in seconds before the next retry to again or constant factor of exponential backoff. The default value is `5`
340
+
341
+ ```
342
+ retry_wait 5
343
+ ```
344
+
345
+ ### retry_exponential_backoff_base
346
+
347
+ The parameter The base number of exponential backoff for retries. The default value is `2`
348
+
349
+ ```
350
+ retry_exponential_backoff_base 2
351
+ ```
352
+
353
+ ### retry_max_interval
354
+
355
+ The parameter maximum interval (seconds) for exponential backoff between retries while failing. The default value is `nil`
356
+
357
+ ```
358
+ retry_max_interval nil
359
+ ```
360
+
361
+ ### retry_randomize
362
+
363
+ The parameter If true, the output plugin will retry after randomized interval not to do burst retries. The default value is `false`
364
+
365
+ ```
366
+ retry_randomize false
367
+ ```
286
368
 
287
369
  ## Advanced Usage
288
370
 
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'test-opensearch'
6
- s.version = '0.0.0.18'
6
+ s.version = '0.0.0.21'
7
7
  s.authors = ['Oleh']
8
8
  s.email = ['imcotop@icloud.com']
9
9
  s.description = %q{test}
@@ -204,28 +204,24 @@ module Fluent::Plugin
204
204
  host.merge!(user: @user, password: @password) if !host[:user] && @user
205
205
  host.merge!(path: @path) if !host[:path] && @path
206
206
  end
207
- live_hosts = hosts.select { |host| reachable_host?(host) }
207
+ live_hosts = @check_connection ? hosts.select { |host| reachable_host?(host) } : hosts
208
208
  {
209
209
  hosts: live_hosts
210
210
  }
211
211
  end
212
212
 
213
213
  def reachable_host?(host)
214
- if @check_connection
215
- client = OpenSearch::Client.new(
216
- host: ["#{host[:scheme]}://#{host[:host]}:#{host[:port]}"],
217
- user: host[:user],
218
- password: host[:password],
219
- reload_connections: @reload_connections,
220
- request_timeout: @request_timeout,
221
- resurrect_after: @resurrect_after,
222
- reload_on_failure: @reload_on_failure,
223
- transport_options: { ssl: { verify: @ssl_verify, ca_file: @ca_file, version: @ssl_version } }
224
- )
225
- client.ping
226
- else
227
- true
228
- end
214
+ client = OpenSearch::Client.new(
215
+ host: ["#{host[:scheme]}://#{host[:host]}:#{host[:port]}"],
216
+ user: host[:user],
217
+ password: host[:password],
218
+ reload_connections: @reload_connections,
219
+ request_timeout: @request_timeout,
220
+ resurrect_after: @resurrect_after,
221
+ reload_on_failure: @reload_on_failure,
222
+ transport_options: { ssl: { verify: @ssl_verify, ca_file: @ca_file, version: @ssl_version } }
223
+ )
224
+ client.ping
229
225
  rescue => e
230
226
  log.warn "Failed to connect to #{host[:scheme]}://#{host[:host]}:#{host[:port]}: #{e.message}"
231
227
  false
@@ -353,15 +349,13 @@ module Fluent::Plugin
353
349
  end
354
350
  rescue Faraday::ConnectionFailed, OpenSearch::Transport::Transport::Error => e
355
351
  @retry.step
356
- # Check if the retry limit has been reached
357
- if @retry.limit?
358
- raise "Hit limit for retries. retry_times: #{@retry.steps} error: #{e.message}"
359
- else
360
- msg = "failed to connect or search."
361
- log.warn(msg, retry_times: @retry.steps, next_retry_time: @retry.next_time.round, error: e.message)
362
- sleep(@retry.next_time - Time.now)
363
- retry
364
- end
352
+ #Raise error if the retry limit has been reached
353
+ raise "Hit limit for retries. retry_times: #{@retry.steps}, error: #{e.message}" if @retry.limit?
354
+
355
+ #Retry if the retry limit hasn't been reached
356
+ log.warn("failed to connect or search.", retry_times: @retry.steps, next_retry_time: @retry.next_time.round, error: e.message)
357
+ sleep(@retry.next_time - Time.now)
358
+ retry
365
359
  end
366
360
 
367
361
  def run_slice(slice_id=nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-opensearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.18
4
+ version: 0.0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleh