deployangel 0.1.8 → 0.1.9

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: 26338624984d9d36012cf0e66b2448ddf31985ae9b629c4ca211e467c5e39e6c
4
- data.tar.gz: bbbb651d96b7091563b263e20df94bc8471bf132bbf8a0511297176c111a74ed
3
+ metadata.gz: e2bc6936b563039a1c2caa91f3a8125f0c32582366505ab35dfabf2ec90af3c5
4
+ data.tar.gz: 22c805b0adef58922b3513afc19492433421358be2e75fd12513e650a7e57c9c
5
5
  SHA512:
6
- metadata.gz: 5846a9913395c0defeeb41b1e5f5ad20a924439ee92ca899b09ae76dcbf935748432cf2c02e01b81772029796f39f5cc221c690313b30ea73a2831aac11825d0
7
- data.tar.gz: 534d6218818cb03b8be1f4144d21d129484b112acdb08a18c53300f62c67dd7198d9dc48a66284ada08069ea08a0795f9cce705d8c6baa11f4fc371d5edf88e5
6
+ metadata.gz: 361b042f1d885fc63442dff6d4f4c406b36fd14ea5c226cf04a5bea2f7537770c6b4f4ad169331b95e6f3bdacf37169f90ac70fc6567006203f4884fe021236a
7
+ data.tar.gz: 328b709591c7c5441390fb74dc535d0a515061fd64161bbe555ffe9f4f8602bf32f10676b6119458e44837ee539e96e5e2f4d72b97cafc05e203d3ef2eb77e7b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.9 (2026-10-04)
4
+
5
+ - A 4xx response to a request no route matched, such as a bot probing
6
+ `/wp-admin` or `.env`, or middleware turning a request away before
7
+ routing, is still recorded under `GET unmatched` but no longer counts in
8
+ the app's request count, status counts, or latency. It made apps look
9
+ busier than their real pages, and fast 404s diluted their latency. An
10
+ unrouted 5xx still counts.
11
+
3
12
  ## 0.1.8 (2026-10-04)
4
13
 
5
14
  - Health checks served by a lambda or a mounted Rack app at a conventional
@@ -42,12 +42,12 @@ module DeployAngel
42
42
  @active
43
43
  end
44
44
 
45
- def record_request(route_key:, status:, duration_ms:, unhandled: false)
45
+ def record_request(route_key:, status:, duration_ms:, unhandled: false, in_totals: true)
46
46
  return unless @active
47
47
 
48
48
  after_fork! if Process.pid != @pid
49
49
  start_reporter
50
- @aggregator.record(route_key: route_key, status: status, duration_ms: duration_ms, unhandled: unhandled)
50
+ @aggregator.record(route_key: route_key, status: status, duration_ms: duration_ms, unhandled: unhandled, in_totals: in_totals)
51
51
  rescue StandardError => e
52
52
  warn_once(:record, "DeployAngel failed to record a request: #{e.class}: #{e.message}")
53
53
  end
@@ -89,11 +89,13 @@ module DeployAngel
89
89
  (@job_classes[key] ||= JobStats.empty).record_discard
90
90
  end
91
91
 
92
- def record(route_key, status, duration_ms, unhandled, max_routes)
93
- @requests += 1
94
- @status_counts[status.to_s] += 1 if status >= 400
95
- @unhandled_exceptions += 1 if unhandled
96
- @histogram.record(duration_ms)
92
+ def record(route_key, status, duration_ms, unhandled, max_routes, in_totals)
93
+ if in_totals
94
+ @requests += 1
95
+ @status_counts[status.to_s] += 1 if status >= 400
96
+ @unhandled_exceptions += 1 if unhandled
97
+ @histogram.record(duration_ms)
98
+ end
97
99
 
98
100
  key = @routes.key?(route_key) || @routes.size < max_routes - 1 ? route_key : OTHER_ROUTE
99
101
  route = (@routes[key] ||= RouteStats.empty)
@@ -112,11 +114,13 @@ module DeployAngel
112
114
  @mutex = Mutex.new
113
115
  end
114
116
 
115
- def record(route_key:, status:, duration_ms:, unhandled: false)
117
+ # in_totals: false records the request under its route only, leaving it
118
+ # out of the app-wide counts and latency.
119
+ def record(route_key:, status:, duration_ms:, unhandled: false, in_totals: true)
116
120
  started_at = period_start(@clock.call)
117
121
  @mutex.synchronize do
118
122
  (@periods[started_at] ||= Period.new(started_at))
119
- .record(route_key, status.to_i, duration_ms, unhandled, @max_routes)
123
+ .record(route_key, status.to_i, duration_ms, unhandled, @max_routes, in_totals)
120
124
  end
121
125
  end
122
126
 
@@ -45,7 +45,7 @@ module DeployAngel
45
45
  route = route_key(env)
46
46
  return if route && DeployAngel.configuration.ignored_route?(route)
47
47
  # Unrouted successes are static files and similar; unrouted
48
- # errors (such as routing 404s) still count.
48
+ # errors (such as routing 404s) are still recorded.
49
49
  return if route.nil? && status.to_i < 400
50
50
 
51
51
  key = route || "#{env["REQUEST_METHOD"]} unmatched"
@@ -54,7 +54,13 @@ module DeployAngel
54
54
  route_key: key,
55
55
  status: status.to_i,
56
56
  duration_ms: (Process.clock_gettime(Process::CLOCK_MONOTONIC) - started) * 1000.0,
57
- unhandled: unhandled
57
+ unhandled: unhandled,
58
+ # A 4xx no route matched is mostly bots probing paths like
59
+ # /wp-admin, or middleware turning requests away. It stays
60
+ # visible under "unmatched", but out of the app's totals, so it
61
+ # doesn't add to the evidence or dilute real pages' latency. An
62
+ # unrouted 5xx still counts: something broke.
63
+ in_totals: !route.nil? || status.to_i >= 500
58
64
  )
59
65
  rescue StandardError
60
66
  nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeployAngel
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deployangel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Owens