network_resiliency 0.7.14 → 0.7.15

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: 8515a542f0e3d22b8e562187dcc23325c8c89866c2e708cf540cb73894195471
4
- data.tar.gz: 30cd44b2ad019321587b8d29f0afc28cde9070f88ded257799e1bcb1aa3dc7e1
3
+ metadata.gz: 61590ba8f759273c9da124ffec0f12b42cc49663d14d6bf1bd75ebb4d73639b2
4
+ data.tar.gz: 2dbd88e94b47a53990fb2328f65cc614be4cb8580e91e17afac0b35f06db281a
5
5
  SHA512:
6
- metadata.gz: 0530fb98688ef75f2cccd2bbe4e75c835bbf20ca3cbdec307c26f9ed9bc04462361867f96ecbf001dc81c36675b1024dca2e09f80b0fa8e71fc623d0540849d2
7
- data.tar.gz: 2de979e7c792a32f7993625a529d31a7b35616c51c17aedea97acd2884f0a589144ec2bbb81cf6cb0f8a50591c3bc414cff7e3253643cb46c266ecf0cb8d2458
6
+ metadata.gz: ca543341cabe254a16b9cb3d035640c29b719bc721a542d3cfd6bc764af8fd20dfa6fb3f57cd2662997f3b5270574b729ae2402b49625a946c37f3c10633de60
7
+ data.tar.gz: 232af6a8de1a7ef893e0e1d745d4d12980fc71cb31156c591584ab38967993168986a9778b41ad842eae363704e3b7e49d9ec8d90755a41da056478046d0b242
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ### v0.7.15 (2024-03-08)
2
+ - higher def timeouts
3
+
1
4
  ### v0.7.14 (2024-03-07)
2
5
  - lower dynamic timeout
3
6
  - timeout-min
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- network_resiliency (0.7.14)
4
+ network_resiliency (0.7.15)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module NetworkResiliency
2
- VERSION = "0.7.14"
2
+ VERSION = "0.7.15"
3
3
  end
@@ -21,7 +21,7 @@ module NetworkResiliency
21
21
  ADAPTERS = [ :http, :faraday, :redis, :mysql, :postgres, :rails ].freeze
22
22
  DEFAULT_TIMEOUT_MIN = 10 # ms
23
23
  MODE = [ :observe, :resilient ].freeze
24
- RESILIENCY_THRESHOLD = 300
24
+ RESILIENCY_THRESHOLD = 100
25
25
  SAMPLE_RATE = {
26
26
  timeout: 0.1,
27
27
  stats: 0.1,
@@ -271,7 +271,7 @@ module NetworkResiliency
271
271
  key = [ adapter, action, destination ].join(":")
272
272
  stats = StatsEngine.add(key, duration)
273
273
 
274
- if stats.n > RESILIENCY_THRESHOLD * 4
274
+ if stats.n > RESILIENCY_THRESHOLD * 5
275
275
  # downsample to age out old stats
276
276
  stats.scale!(50)
277
277
  end
@@ -338,8 +338,17 @@ module NetworkResiliency
338
338
  destination: destination,
339
339
  }
340
340
 
341
- # p99 = (stats.avg + stats.stdev * 2).order_of_magnitude(ceil: true)
342
- p99 = (stats.avg + stats.stdev * 3).power_ceil
341
+ p99 = (stats.avg + stats.stdev * 3)
342
+
343
+ # add margin of error / normalize
344
+ p99 = if stats.n >= RESILIENCY_THRESHOLD * 2
345
+ p99.power_ceil
346
+ else
347
+ # larger margin of error
348
+ p99.order_of_magnitude(ceil: true)
349
+ end
350
+
351
+ # enforce minimum timeout
343
352
  p99 = [ p99, timeout_min ].max
344
353
 
345
354
  timeouts = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: network_resiliency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.14
4
+ version: 0.7.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Pepper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-07 00:00:00.000000000 Z
11
+ date: 2024-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug