deployangel 0.1.5 → 0.1.7

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: 7d7f056df70ef5a14b11ff88312b8dd9e48330567b9f653cf57d6ddd9caf8050
4
- data.tar.gz: 7d8c30865b517b59e76cea6cc61d5c0d6853ea7766b41378b790f98983a23d37
3
+ metadata.gz: 5250331c4f5a2c2715d94bbbfc62f61daae1f58a744e1430a231a23077a7c540
4
+ data.tar.gz: 8db08acb92e1b8923038e2f726481197eb082e308d1f59a6e18911a04d6c3301
5
5
  SHA512:
6
- metadata.gz: 4223fbd9e23df830ab6538e927550cbf79057856112427df383da9a77a9a1a0af2f22b5461a4934e1bd945bef60dc8160644632fba1cacd99be0183a29f40295
7
- data.tar.gz: 790766bea10aa1c12f8e6212fb9d0b10a127f4f7a809bee9434c2952f4ad725c491c20fc2767a606142ec4f9d8d748a50197b6a52861e417f7bb87e0df40a6fa
6
+ metadata.gz: '0548b47a265acf82aa9cb67e566142ec4e4e648af0e828217066f8104bc24bf305fd397a1bdb2741de7bf919e10e0d8e4d76fcdd2d9e865e0aaf46ebca226acd'
7
+ data.tar.gz: e622c67f73c8475ff52dd8628e296de2950dce36b7a83e447d23e3a523fdf950a13801ee654972e2c60d176f8c6ddfd7230bec31159cc604b77782bb4a4757a6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.7 (2026-10-04)
4
+
5
+ - Health checks from OkComputer, health_check, and rails-healthcheck are left
6
+ out like Rails' own, wherever they're mounted.
7
+ - `config.ignored_routes` leaves out other routes, such as a health check
8
+ served by your own controller: `[ "GET /healthz" ]`. HEAD requests to a
9
+ listed GET route are left out too, and listed routes aren't sent in the
10
+ route table, so DeployAngel never expects them to run.
11
+
12
+ ## 0.1.6 (2026-10-04)
13
+
14
+ - Requests to Rails' health check (`rails/health#show`, at `/up` by default)
15
+ are no longer recorded, wherever it's mounted. Load balancers and uptime
16
+ monitors call it all the time and it always answers fast, so it made apps
17
+ look busier and healthier than their real pages. DeployAngel already
18
+ leaves out `/up` from older agents.
19
+
3
20
  ## 0.1.5 (2026-10-03)
4
21
 
5
22
  - Declared recurring jobs from sidekiq-cron and sidekiq-scheduler, alongside
data/README.md CHANGED
@@ -111,6 +111,19 @@ DeployAngel.configure do |config|
111
111
  end
112
112
  ```
113
113
 
114
+ Health checks aren't recorded: load balancers and uptime monitors call them
115
+ all the time and they always answer fast, so they would make your app look
116
+ busier and healthier than its real pages. The agent recognizes Rails' own
117
+ (`/up`), OkComputer, health_check, and rails-healthcheck, wherever they're
118
+ mounted. If your health check is your own controller, list its route the way
119
+ the dashboard shows it. HEAD requests to it are left out too:
120
+
121
+ ```ruby
122
+ DeployAngel.configure do |config|
123
+ config.ignored_routes = [ "GET /healthz" ]
124
+ end
125
+ ```
126
+
114
127
  `DEPLOYANGEL_ENABLED=true|false` forces reporting on or off in any environment.
115
128
  `DEPLOYANGEL_URL` overrides the API endpoint (default `https://api.deployangel.com`).
116
129
 
@@ -11,7 +11,7 @@ module DeployAngel
11
11
 
12
12
  attr_accessor :token, :endpoint, :enabled, :environments, :release_version, :revision,
13
13
  :flush_interval, :open_timeout, :read_timeout, :max_queued_payloads, :max_routes, :logger,
14
- :file_digests, :critical_flows
14
+ :file_digests, :critical_flows, :ignored_routes
15
15
 
16
16
  def initialize(env = ENV)
17
17
  @token = env["DEPLOYANGEL_TOKEN"]
@@ -28,6 +28,8 @@ module DeployAngel
28
28
  @logger = Logger.new($stderr, level: Logger::WARN, progname: "deployangel")
29
29
  @file_digests = parse_boolean(env["DEPLOYANGEL_FILE_DIGESTS"]) != false
30
30
  @critical_flows = {}
31
+ # Route keys as the dashboard shows them, such as "GET /healthz".
32
+ @ignored_routes = []
31
33
  end
32
34
 
33
35
  # Reports only with a token. By default only in the listed
@@ -39,6 +41,14 @@ module DeployAngel
39
41
  environments.include?(environment.to_s)
40
42
  end
41
43
 
44
+ # Whether requests to a route are left out. Rails answers HEAD with the
45
+ # GET route, so ignoring "GET /healthz" ignores "HEAD /healthz" too.
46
+ def ignored_route?(key)
47
+ return false if ignored_routes.empty?
48
+
49
+ ignored_routes.include?(key) || ignored_routes.include?(key.sub(/\AHEAD /, "GET "))
50
+ end
51
+
42
52
  private
43
53
  def parse_boolean(value)
44
54
  return nil if value.nil? || value.strip.empty?
@@ -7,6 +7,12 @@ module DeployAngel
7
7
  # never the raw path, which keeps IDs out of route keys.
8
8
  class Http
9
9
  FORMAT_SUFFIX = "(.:format)"
10
+ # Health checks: Rails' own (/up by default), OkComputer, health_check,
11
+ # and rails-healthcheck, wherever they're mounted. Load balancers and
12
+ # uptime monitors call them all the time and they answer fast, so
13
+ # counting them would make any app look busy and healthy. Others can
14
+ # be left out with config.ignored_routes.
15
+ HEALTH_CHECK_CONTROLLERS = %w[rails/health ok_computer/ok_computer health_check/health_check healthcheck/healthchecks].freeze
10
16
 
11
17
  def initialize(app)
12
18
  @app = app
@@ -31,7 +37,10 @@ module DeployAngel
31
37
 
32
38
  private
33
39
  def record(env, status, started, unhandled:, exception: nil)
40
+ return if HEALTH_CHECK_CONTROLLERS.include?(env["action_dispatch.request.path_parameters"]&.dig(:controller))
41
+
34
42
  route = route_key(env)
43
+ return if route && DeployAngel.configuration.ignored_route?(route)
35
44
  # Unrouted successes are static files and similar; unrouted
36
45
  # errors (such as routing 404s) still count.
37
46
  return if route.nil? && status.to_i < 400
@@ -40,12 +40,13 @@ module DeployAngel
40
40
  @app.routes.routes.flat_map do |route|
41
41
  controller = route.defaults[:controller]
42
42
  next [] if controller.nil? || controller.start_with?("rails/", "active_storage/", "action_mailbox/")
43
+ next [] if Http::HEALTH_CHECK_CONTROLLERS.include?(controller)
43
44
 
44
45
  path = route.path.spec.to_s.delete_suffix(FORMAT_SUFFIX)
45
46
  route.verb.to_s.split("|").reject(&:empty?).map do |verb|
46
47
  { "key" => "#{verb} #{path}", "controller" => controller, "action" => route.defaults[:action].to_s }
47
48
  end
48
- end.uniq { |route| route["key"] }
49
+ end.uniq { |route| route["key"] }.reject { |route| @config.ignored_route?(route["key"]) }
49
50
  rescue StandardError
50
51
  []
51
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeployAngel
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.7"
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.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Owens