standard_health 0.7.0 → 0.7.1
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 +4 -4
- data/CHANGELOG.md +41 -0
- data/README.md +22 -6
- data/lib/standard_health/aggregate_report.rb +5 -3
- data/lib/standard_health/aggregator.rb +41 -5
- data/lib/standard_health/check.rb +10 -0
- data/lib/standard_health/configuration.rb +3 -1
- data/lib/standard_health/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 162374f071e6634d43876ef75f8fa6f50b1ec7bfd6a8d01bd94a91c854151d09
|
|
4
|
+
data.tar.gz: 58c40844359768a3d905c75575599dc1bf61dab15ebabc372c3e5e56cd4e169d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a93890d618342991d02699f9a68d0cf432596f4fba5eff7659d4d4c8675d22e5e0bac3d996abed41e02ddd7f53b84c771f21e093a6c6e22b39404ec9ccc7498c
|
|
7
|
+
data.tar.gz: 13b347704251b47c6a877ce5fb559686d9fee639610109300da1fd989627010a3823f678ab420330a26ac851548647da3ab12405081cd13a2d9024c90d4bb5dc
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.1] - 2026-09-25
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **Skipped checks no longer degrade the aggregate.** A check that returns
|
|
15
|
+
`status: :skipped` itself means "not applicable here" (the feature it
|
|
16
|
+
covers is not configured or not enforced). It is now **neutral** in the
|
|
17
|
+
roll-up on every tier (`/ready` and the aggregate `/health`): it neither
|
|
18
|
+
degrades nor fails the status. Before, it counted like a failing
|
|
19
|
+
non-critical check, which held sidekick-web's `/health` at `degraded`
|
|
20
|
+
permanently while attestation was unconfigured. The row still renders in
|
|
21
|
+
`checks[]` with `"status": "skipped"`, and `check.completed` still fires,
|
|
22
|
+
so it stays visible. It is no longer listed in the `failed[]` / `failures`
|
|
23
|
+
of `ready.evaluated` / `aggregate.evaluated`, so the Logger and Sentry
|
|
24
|
+
notifiers don't name it as failing when something else degrades.
|
|
25
|
+
- **A critical check that reports `:skipped` is neutral too**, on purpose.
|
|
26
|
+
"Not applicable" says nothing about whether the instance can serve, so it
|
|
27
|
+
must not pull it out of rotation. Return `:fail` for a state that should
|
|
28
|
+
page.
|
|
29
|
+
- Real failures roll up exactly as before: a failing critical check is
|
|
30
|
+
`unavailable` (503), a failing non-critical one `degraded`, including
|
|
31
|
+
alongside a skipped check.
|
|
32
|
+
- **Budget skips are unchanged.** A check the `total_check_budget` never
|
|
33
|
+
reached was not performed, which is not the same as healthy. It still
|
|
34
|
+
floors the roll-up at `degraded` (never `unavailable`) and is still listed
|
|
35
|
+
in `failed[]`. Its row now carries `budget_exhausted: true`, which is how
|
|
36
|
+
the gem tells the two kinds of skip apart.
|
|
37
|
+
- `/diagnostics/env` is unaffected. Its roll-up is over env-audit rows and
|
|
38
|
+
assertions (`:ok` / `:warn` / `:error`), which have no skipped state.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- **Requires Rails 8.1** (`rails >= 8.1`, was `>= 8.0`). Every consumer app
|
|
43
|
+
runs 8.1; 8.0 was never exercised in CI. Ruby 3.4 remains supported.
|
|
44
|
+
|
|
45
|
+
### Upgrade notes (0.7.0 → 0.7.1)
|
|
46
|
+
|
|
47
|
+
- **No required host change.** An app whose aggregate was `degraded` only
|
|
48
|
+
because of a self-reported skip now reports `ok`. Monitors or smoke tests
|
|
49
|
+
that expect `degraded` in that state need updating (sidekick-web).
|
|
50
|
+
|
|
10
51
|
## [0.7.0] - 2026-09-24
|
|
11
52
|
|
|
12
53
|
The Phase 4 release. 0.6 deprecated nothing, so nothing is removed. It adds
|
data/README.md
CHANGED
|
@@ -106,7 +106,7 @@ end
|
|
|
106
106
|
| Status | HTTP | When |
|
|
107
107
|
|---|---|---|
|
|
108
108
|
| `unavailable` | 503 | a critical check failed, or a `:critical` circuit is red |
|
|
109
|
-
| `degraded` | 200 | a non-critical check failed
|
|
109
|
+
| `degraded` | 200 | a non-critical check failed, a check was skipped by the total budget, or the circuit roll-up is `:degraded` |
|
|
110
110
|
| `ok` | 200 | otherwise |
|
|
111
111
|
|
|
112
112
|
**The aggregate tier re-runs your readiness checks by default.** With
|
|
@@ -806,9 +806,25 @@ go in `extra:`.
|
|
|
806
806
|
|
|
807
807
|
The orchestrator should pull the instance out of rotation only on 503; degraded means "still serving, page someone."
|
|
808
808
|
|
|
809
|
-
`skipped` also exists,
|
|
810
|
-
|
|
811
|
-
`
|
|
809
|
+
`skipped` also exists, in two flavours that roll up differently:
|
|
810
|
+
|
|
811
|
+
- **A check that returns `status: :skipped` itself** — "not applicable here"
|
|
812
|
+
(the feature it covers isn't configured or enforced). This is **neutral**
|
|
813
|
+
(since 0.7.1): it neither degrades nor fails the roll-up, whether the check
|
|
814
|
+
is critical or not, and it is left out of the evaluation events' `failed[]`.
|
|
815
|
+
It still renders in `checks[]` with `"status": "skipped"` and still emits
|
|
816
|
+
`check.completed`, so it stays visible. A critical check is neutral too on
|
|
817
|
+
purpose: "not applicable" says nothing about whether the instance can serve,
|
|
818
|
+
so it must not pull it out of rotation — and it must not mark it healthy
|
|
819
|
+
*because of* that check either; it simply doesn't count. If the state should
|
|
820
|
+
page, return `:fail`.
|
|
821
|
+
- **A check the total budget never reached** (see Timeouts) — rendered with
|
|
822
|
+
`"budget_exhausted": true`. That check was not performed, which is not the
|
|
823
|
+
same as healthy, so it floors the roll-up at `degraded` and **never**
|
|
824
|
+
produces `unavailable`, even for a critical check.
|
|
825
|
+
|
|
826
|
+
A real failure still rolls up exactly as before alongside any skip: a failing
|
|
827
|
+
critical check is `unavailable`, a failing non-critical one `degraded`.
|
|
812
828
|
|
|
813
829
|
## Failure detail is redacted
|
|
814
830
|
|
|
@@ -934,8 +950,8 @@ slow-but-fine starts reporting `:fail`, and for a critical check that pulls
|
|
|
934
950
|
the instance out of rotation. Pick values from observed `latency_ms` rather
|
|
935
951
|
than intuition; that is what the `check.completed` events are for.
|
|
936
952
|
|
|
937
|
-
Checks the total budget never reaches report `:skipped
|
|
938
|
-
A skip alone floors the roll-up at `degraded` — otherwise a slow *non-critical*
|
|
953
|
+
Checks the total budget never reaches report `:skipped` (with
|
|
954
|
+
`budget_exhausted: true`), never silently `:ok`. A budget skip alone floors the roll-up at `degraded` — otherwise a slow *non-critical*
|
|
939
955
|
check could exhaust the budget, leave the database check unrun, and pull a
|
|
940
956
|
healthy instance out of rotation.
|
|
941
957
|
|
|
@@ -18,8 +18,10 @@ module StandardHealth
|
|
|
18
18
|
#
|
|
19
19
|
# Status roll-up, in the estate's readiness vocabulary:
|
|
20
20
|
# :unavailable (503) — a critical check failed, or a :critical circuit is RED
|
|
21
|
-
# :degraded (200) — a non-critical check failed
|
|
22
|
-
# circuit roll-up is
|
|
21
|
+
# :degraded (200) — a non-critical check failed, a check was skipped
|
|
22
|
+
# by the total budget, or the circuit roll-up is
|
|
23
|
+
# :degraded. A check that reports :skipped itself
|
|
24
|
+
# (not applicable) is neutral — see Aggregator.
|
|
23
25
|
# :ok (200) — otherwise
|
|
24
26
|
#
|
|
25
27
|
# StandardCircuit's own word for its worst state is `:critical`; it is
|
|
@@ -92,7 +94,7 @@ module StandardHealth
|
|
|
92
94
|
# notifier logs this one (so redacted messages still reach logs); Sentry
|
|
93
95
|
# and Metrics ignore it.
|
|
94
96
|
def emit_evaluation(report, rows, circuits, started)
|
|
95
|
-
failing = rows
|
|
97
|
+
failing = Aggregator.failing_rows(rows)
|
|
96
98
|
payload = {
|
|
97
99
|
status: report[:status],
|
|
98
100
|
duration_ms: ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - started) * 1000).round,
|
|
@@ -14,11 +14,23 @@ module StandardHealth
|
|
|
14
14
|
# Runs all registered checks and rolls them up into a single status.
|
|
15
15
|
#
|
|
16
16
|
# Status semantics:
|
|
17
|
-
# :ok — every check returned :ok
|
|
17
|
+
# :ok — every check returned :ok, or reported :skipped itself
|
|
18
18
|
# :degraded — at least one non-critical check failed, OR a check was
|
|
19
19
|
# skipped because the total budget ran out
|
|
20
20
|
# :unavailable — at least one critical check failed
|
|
21
21
|
#
|
|
22
|
+
# Two kinds of :skipped row exist, and they roll up differently (0.7.1):
|
|
23
|
+
#
|
|
24
|
+
# * A check that RETURNS `status: :skipped` is saying "not applicable
|
|
25
|
+
# here" (the feature it covers is not configured or not enforced). That
|
|
26
|
+
# is NEUTRAL — it neither degrades nor fails the tier, whatever its
|
|
27
|
+
# `critical:` flag, and it is not listed in an evaluation event's
|
|
28
|
+
# `failed[]`. The row still renders with status "skipped", and
|
|
29
|
+
# `check.completed` still fires, so it stays visible.
|
|
30
|
+
# * A check the total budget never REACHED (`budget_exhausted: true` on
|
|
31
|
+
# the row) was not performed at all, and an unperformed check is not a
|
|
32
|
+
# healthy one. It floors the tier at :degraded — never :unavailable.
|
|
33
|
+
#
|
|
22
34
|
# The aggregator never raises. Each check is invoked through `safe_run`
|
|
23
35
|
# which catches `StandardError` so a buggy custom check cannot take down
|
|
24
36
|
# /ready. Instrumentation is held to the same bar — every emit is wrapped
|
|
@@ -55,7 +67,7 @@ module StandardHealth
|
|
|
55
67
|
duration_ms = ((monotonic - started) * 1000).round
|
|
56
68
|
status = overall_status(check_rows)
|
|
57
69
|
|
|
58
|
-
failing = check_rows
|
|
70
|
+
failing = failing_rows(check_rows)
|
|
59
71
|
|
|
60
72
|
return { status: status, checks: check_rows, generated_at: now.iso8601 } unless tier == :ready
|
|
61
73
|
|
|
@@ -81,6 +93,21 @@ module StandardHealth
|
|
|
81
93
|
}
|
|
82
94
|
end
|
|
83
95
|
|
|
96
|
+
# The rows an evaluation event reports as failing: everything that is not
|
|
97
|
+
# :ok, except a check that reported :skipped itself (not applicable, so
|
|
98
|
+
# not a failure). A budget skip IS listed — it is the only place a skip
|
|
99
|
+
# shows up in the transition-gated event. @api private (also used by
|
|
100
|
+
# AggregateReport).
|
|
101
|
+
def self.failing_rows(rows)
|
|
102
|
+
rows.reject { |r| r[:status] == :ok || neutral_skip?(r) }
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# A row the check itself reported as :skipped — "not applicable here".
|
|
106
|
+
# Neutral in the roll-up. A budget skip is not neutral. @api private
|
|
107
|
+
def self.neutral_skip?(row)
|
|
108
|
+
row[:status] == :skipped && !row[:budget_exhausted]
|
|
109
|
+
end
|
|
110
|
+
|
|
84
111
|
# Per-failure detail for an evaluation event. Public (but @api private) so
|
|
85
112
|
# the aggregate tier's evaluation event carries the same shape.
|
|
86
113
|
# @api private
|
|
@@ -177,12 +204,15 @@ module StandardHealth
|
|
|
177
204
|
private_class_method :budget_exhausted?
|
|
178
205
|
|
|
179
206
|
# A check the total budget never reached. `:skipped`, never silently
|
|
180
|
-
# `:ok` — an unperformed check is not a healthy one.
|
|
207
|
+
# `:ok` — an unperformed check is not a healthy one. `budget_exhausted`
|
|
208
|
+
# is what separates it from a check that reported :skipped itself (which
|
|
209
|
+
# is neutral); see overall_status.
|
|
181
210
|
def self.skipped_row(reg, budget)
|
|
182
211
|
{
|
|
183
212
|
name: reg.name,
|
|
184
213
|
critical: reg.critical,
|
|
185
214
|
status: :skipped,
|
|
215
|
+
budget_exhausted: true,
|
|
186
216
|
error: "skipped — total check budget of #{budget}s exhausted"
|
|
187
217
|
}
|
|
188
218
|
end
|
|
@@ -191,10 +221,16 @@ module StandardHealth
|
|
|
191
221
|
def self.overall_status(rows)
|
|
192
222
|
return :ok if rows.empty?
|
|
193
223
|
|
|
194
|
-
|
|
224
|
+
# A check that reported :skipped itself is not applicable here, so it is
|
|
225
|
+
# NEUTRAL: it must not degrade the tier (sidekick-web's non-critical
|
|
226
|
+
# attestation check held /health at "degraded" forever while attestation
|
|
227
|
+
# was simply not configured), and a critical one must not fail it
|
|
228
|
+
# either — "not applicable" says nothing about whether the app can
|
|
229
|
+
# serve. It stays in checks[] as "skipped" for visibility.
|
|
230
|
+
failures = failing_rows(rows)
|
|
195
231
|
return :ok if failures.empty?
|
|
196
232
|
|
|
197
|
-
# A SKIP MUST NEVER PRODUCE :unavailable, even for a critical check.
|
|
233
|
+
# A BUDGET SKIP MUST NEVER PRODUCE :unavailable, even for a critical check.
|
|
198
234
|
# Otherwise a slow *non-critical* check could exhaust the budget, leave
|
|
199
235
|
# the database check unrun, and pull a perfectly healthy instance out of
|
|
200
236
|
# rotation — a self-inflicted outage caused by the safety mechanism.
|
|
@@ -11,6 +11,16 @@ module StandardHealth
|
|
|
11
11
|
#
|
|
12
12
|
# { status: :fail, error: "connection refused" }
|
|
13
13
|
#
|
|
14
|
+
# or, when the check does not apply to this deployment (the feature it
|
|
15
|
+
# covers is not configured or not enforced):
|
|
16
|
+
#
|
|
17
|
+
# { status: :skipped }
|
|
18
|
+
#
|
|
19
|
+
# A self-reported :skipped is NEUTRAL in the roll-up (0.7.1): it never
|
|
20
|
+
# degrades or fails the tier, even for a critical check, but it still
|
|
21
|
+
# renders in `checks[]` as "skipped". Return :fail, not :skipped, for
|
|
22
|
+
# anything that should page.
|
|
23
|
+
#
|
|
14
24
|
# The `with_timing` helper wraps a block, captures latency, and converts
|
|
15
25
|
# any unhandled `StandardError` into a `:fail` row so subclasses don't
|
|
16
26
|
# have to repeat the pattern.
|
|
@@ -192,7 +192,9 @@ module StandardHealth
|
|
|
192
192
|
attr_accessor :default_check_timeout
|
|
193
193
|
|
|
194
194
|
# Budget across all checks, evaluated BEFORE each check starts. Checks not
|
|
195
|
-
# reached are reported :skipped
|
|
195
|
+
# reached are reported :skipped with `budget_exhausted: true` (unlike a
|
|
196
|
+
# check that reports :skipped itself, which is neutral), and such a skip
|
|
197
|
+
# alone floors the roll-up at
|
|
196
198
|
# :degraded — never :unavailable. Otherwise a slow NON-critical check could
|
|
197
199
|
# exhaust the budget, leave a critical check unrun, and pull a healthy app
|
|
198
200
|
# out of rotation. nil = no budget.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: standard_health
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jaryl Sim
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '8.
|
|
18
|
+
version: '8.1'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '8.
|
|
25
|
+
version: '8.1'
|
|
26
26
|
description: StandardHealth is a mountable Rails engine providing /alive, /ready,
|
|
27
27
|
and /diagnostics/env endpoints, with a configuration block for registering custom
|
|
28
28
|
checks and a DSL for declaring required and recommended environment variables.
|
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
89
|
version: '0'
|
|
90
90
|
requirements: []
|
|
91
|
-
rubygems_version: 4.0.
|
|
91
|
+
rubygems_version: 4.0.10
|
|
92
92
|
specification_version: 4
|
|
93
93
|
summary: A drop-in health check and environment-spec engine for Rails 8 host apps.
|
|
94
94
|
test_files: []
|