railwatch 1.0.0 → 1.1.0

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: 336bf2e2440f9d076539faaca52e7d04db59422aeb280250a4c4556e7c6562ea
4
- data.tar.gz: ea7b81637d1e104faa87e9ceb756cd1af43afb801108335674a508658b9adafa
3
+ metadata.gz: 3620348235aae6e5733728931b85a9c0edd0ac31367a4fd143eceee1de28cbc0
4
+ data.tar.gz: 273a578b3059f4390854d7452df971d8223c9e4f6c8c6a9e7e8d9f46a27ef1f3
5
5
  SHA512:
6
- metadata.gz: 2223825b1e9287148a7a4a0707b786b6ac88a4859b1566f4630706b3dffd50b13ef19815e70ffba85aa5669c37925a20895af68e4377098fd51c6250a680431b
7
- data.tar.gz: 71d620559e2d9fd431ae93fd269bd4b573e13bf23295a4bb98cfa395f720ee3fa94bf0557fe562ae2e7e4492428b22ccdaf82c25c0082485ee2550cf82ee7c5c
6
+ metadata.gz: 82640c29a57b4c99d890b40ef75179d635b53308879516ba4973aaed0cfa1179696e0ee14e6660be2eb59c935611eb395e9f508e583c2604fbe8a7e57da0f8ad
7
+ data.tar.gz: 53ff388054d12658c7d0cb99c3d0c3dd01be8579ac2227efbb07d65f008a766851761655904b081c8f344aa5db6f3ad9d2cb1e25a349bf30b943e85cb74489bc
data/CHANGELOG.md CHANGED
@@ -6,6 +6,19 @@
6
6
  filled in by the release commit, which is also the only commit that
7
7
  touches lib/railwatch/version.rb and Gemfile.lock. See CONTRIBUTING.md. -->
8
8
 
9
+ ## 1.1.0 (2026-10-22)
10
+
11
+ - A receiver that refuses the connection (nothing listening: a Railwatch
12
+ server restarting, or a deploy handing over to the next container) no
13
+ longer counts as backpressure. The retry ladder it starts used to double
14
+ the sampling divisor every flush tick, so the app's first requests after
15
+ the server came back were sampled out: a fresh app recorded 23-29 of 30
16
+ requests sent right after its embedded server was killed and restarted,
17
+ in every one of 10 runs. A timeout, a 5xx and a full buffer are still
18
+ pressure.
19
+ - `Configuration#local?` is gone. It was kept in 1.0.0 only for
20
+ railwatch-server 0.1.0; railwatch-server 0.1.1 no longer calls it.
21
+
9
22
  ## 1.0.0 (2026-10-22)
10
23
 
11
24
  - **Breaking: `railwatch` is the agent only.** It instruments the app and
@@ -284,10 +284,6 @@ module Railwatch
284
284
  @enabled && token.present?
285
285
  end
286
286
 
287
- # Always false: there is no embedded transport any more. Only
288
- # railwatch-server 0.1.0 calls it.
289
- def local? = false
290
-
291
287
  # Both halves present. Read late (not at boot) so credentials set from an
292
288
  # initializer, an env var or the configure task all count.
293
289
  def http_basic_auth_configured?
@@ -72,6 +72,7 @@ module Railwatch
72
72
  @flush_requested = false
73
73
  @urgent_at = nil
74
74
  @retry_attempt = 0
75
+ @unreachable = false
75
76
  @retry_at = nil
76
77
  @retry_batch = nil
77
78
  # Ruby ivars hold object references atomically. The reporter is the
@@ -400,6 +401,7 @@ module Railwatch
400
401
  @backpressure_factor = MAX_BACKPRESSURE_FACTOR if @config.backpressure
401
402
  end
402
403
  @retry_attempt += 1
404
+ @unreachable = result.status.nil? && result.error.to_s.start_with?("Errno::ECONNREFUSED")
403
405
  if @retry_attempt > MAX_RETRY_ATTEMPTS
404
406
  @buffer.account_dropped(batch.records.size + batch.dropped,
405
407
  bytes: batch.bytes + batch.dropped_bytes)
@@ -506,6 +508,7 @@ module Railwatch
506
508
  @in_flight_dropped_bytes = 0
507
509
  @retry_attempt = 0
508
510
  @retry_at = nil
511
+ @unreachable = false
509
512
  end
510
513
  end
511
514
 
@@ -600,8 +603,14 @@ module Railwatch
600
603
 
601
604
  buffered, _, buffered_bytes, = @buffer.stats
602
605
  high_water = @config.backpressure_high_water
606
+ # A retry ladder is pressure when the receiver is struggling (a timeout,
607
+ # a 5xx). Not when nothing listens (ECONNREFUSED): that is a server
608
+ # restarting or a deploy handing over, back in a second or two, and
609
+ # sampling down meanwhile only lost the app's first requests after it.
610
+ # The buffer's high-water mark still bounds a receiver that stays away.
611
+ retrying = @retry_attempt.positive? && !@unreachable
603
612
  pressured = buffered >= @config.buffer_size * high_water ||
604
- buffered_bytes >= @config.buffer_bytes * high_water || @retry_attempt.positive?
613
+ buffered_bytes >= @config.buffer_bytes * high_water || retrying
605
614
  @backpressure_factor = if pressured
606
615
  [ @backpressure_factor * 2.0, MAX_BACKPRESSURE_FACTOR ].min
607
616
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Railwatch
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railwatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cole Robertson