@checkstack/common 0.8.0 → 0.9.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.
- package/CHANGELOG.md +12 -0
- package/package.json +3 -3
- package/src/chart-types.ts +65 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @checkstack/common
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 42abfff: Add practical-significance floors to anomaly detection.
|
|
8
|
+
|
|
9
|
+
Two new schema annotations — `x-anomaly-min-absolute-delta` and `x-anomaly-min-relative-delta` — let plugin authors and operators suppress alerts whose statistical deviation is large but practical impact is negligible. Both floors must clear in addition to the existing μ ± Nσ trigger; defaults are 0 (disabled) so existing behaviour is unchanged.
|
|
10
|
+
|
|
11
|
+
This is the fix for cases like a 6 ms latency baseline whose σ ≈ 1 ms causes routine 20 ms blips to fire as anomalies despite Δ=14 ms being operationally irrelevant. With `min-absolute-delta: 50` and `min-relative-delta: 0.5`, those blips stay silent while a 6 ms → 200 ms spike still fires.
|
|
12
|
+
|
|
13
|
+
Built-in plugins ship with sensible defaults applied to every per-run field: 50 ms + 50 % for ms-unit fields, 5 percentage points for `%`-unit fields, 1 + 25 % for counter fields, 1 GB + 5 % for disk fields, 50 MB + 10 % for memory fields, 1 day for TLS expiry, 0.5 + 25 % for load average, 1 + 5 % for Minecraft TPS. Operators can override per-system or per-field via the assignment UI.
|
|
14
|
+
|
|
3
15
|
## 0.8.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"license": "Elastic-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"typescript": "^5.7.2",
|
|
22
|
-
"@checkstack/tsconfig": "0.0.
|
|
23
|
-
"@checkstack/scripts": "0.
|
|
22
|
+
"@checkstack/tsconfig": "0.0.7",
|
|
23
|
+
"@checkstack/scripts": "0.3.0"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"typecheck": "tsgo -b",
|
package/src/chart-types.ts
CHANGED
|
@@ -22,6 +22,18 @@ export type ChartType =
|
|
|
22
22
|
| "text"
|
|
23
23
|
| "status";
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Numeric anomaly directions — these operate on a μ ± Nσ statistical band
|
|
27
|
+
* over a continuous metric, so practical-significance floors apply.
|
|
28
|
+
*/
|
|
29
|
+
export type NumericAnomalyDirection =
|
|
30
|
+
| "higher-is-better"
|
|
31
|
+
| "lower-is-better"
|
|
32
|
+
| "deviation";
|
|
33
|
+
|
|
34
|
+
/** Categorical anomaly direction — fires on dominance flips, no σ band. */
|
|
35
|
+
export type CategoricalAnomalyDirection = "dominance";
|
|
36
|
+
|
|
25
37
|
/**
|
|
26
38
|
* Base metadata for all health check result schema fields.
|
|
27
39
|
*/
|
|
@@ -63,14 +75,56 @@ export interface BaseHealthResultMeta {
|
|
|
63
75
|
}
|
|
64
76
|
|
|
65
77
|
/**
|
|
66
|
-
* Metadata for a field
|
|
78
|
+
* Metadata for a chartable field with numeric anomaly detection.
|
|
79
|
+
* Carries the practical-significance floors (`x-anomaly-min-*-delta`)
|
|
80
|
+
* because they only make sense against a μ ± Nσ band.
|
|
81
|
+
*/
|
|
82
|
+
export interface ChartMetaAnomalyNumeric extends BaseHealthResultMeta {
|
|
83
|
+
"x-chart-type": ChartType;
|
|
84
|
+
"x-anomaly-enabled": true;
|
|
85
|
+
"x-anomaly-direction": NumericAnomalyDirection;
|
|
86
|
+
/**
|
|
87
|
+
* Practical-significance floor on absolute deviation. Default 0 (disabled).
|
|
88
|
+
* An anomaly only fires when |value − μ| ≥ this floor — even if the
|
|
89
|
+
* statistical trigger (μ ± Nσ) is exceeded. Use to suppress alerts on
|
|
90
|
+
* statistically-unusual but operationally-irrelevant swings on
|
|
91
|
+
* low-baseline metrics (e.g. 6 ms → 20 ms latency).
|
|
92
|
+
* Same field unit as the metric itself.
|
|
93
|
+
*/
|
|
94
|
+
"x-anomaly-min-absolute-delta"?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Practical-significance floor on relative deviation. Default 0 (disabled).
|
|
97
|
+
* An anomaly only fires when |value − μ| / max(|μ|, ε) ≥ this floor — even
|
|
98
|
+
* if the statistical trigger is exceeded. Expressed as a fraction
|
|
99
|
+
* (e.g. 0.5 = 50%). Use to suppress alerts whose proportional change is
|
|
100
|
+
* small on high-magnitude metrics.
|
|
101
|
+
*/
|
|
102
|
+
"x-anomaly-min-relative-delta"?: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Metadata for a chartable field with categorical (dominance) anomaly
|
|
107
|
+
* detection. Practical-significance floors are deliberately disallowed
|
|
108
|
+
* because they have no meaning against a categorical baseline — there's
|
|
109
|
+
* no μ to subtract from.
|
|
67
110
|
*/
|
|
68
|
-
export interface
|
|
111
|
+
export interface ChartMetaAnomalyCategorical extends BaseHealthResultMeta {
|
|
69
112
|
"x-chart-type": ChartType;
|
|
70
113
|
"x-anomaly-enabled": true;
|
|
71
|
-
"x-anomaly-direction":
|
|
114
|
+
"x-anomaly-direction": CategoricalAnomalyDirection;
|
|
115
|
+
"x-anomaly-min-absolute-delta"?: never;
|
|
116
|
+
"x-anomaly-min-relative-delta"?: never;
|
|
72
117
|
}
|
|
73
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Union of the two anomaly-enabled variants. Kept for back-compat with
|
|
121
|
+
* existing callers — new code should narrow against the discriminated
|
|
122
|
+
* union directly via `x-anomaly-direction`.
|
|
123
|
+
*/
|
|
124
|
+
export type ChartMetaAnomalyEnabled =
|
|
125
|
+
| ChartMetaAnomalyNumeric
|
|
126
|
+
| ChartMetaAnomalyCategorical;
|
|
127
|
+
|
|
74
128
|
/**
|
|
75
129
|
* Metadata for a field that exposes a chart but explicitly disables anomaly detection.
|
|
76
130
|
*/
|
|
@@ -78,6 +132,8 @@ export interface ChartMetaAnomalyDisabled extends BaseHealthResultMeta {
|
|
|
78
132
|
"x-chart-type": ChartType;
|
|
79
133
|
"x-anomaly-enabled": false;
|
|
80
134
|
"x-anomaly-direction"?: never;
|
|
135
|
+
"x-anomaly-min-absolute-delta"?: never;
|
|
136
|
+
"x-anomaly-min-relative-delta"?: never;
|
|
81
137
|
}
|
|
82
138
|
|
|
83
139
|
/**
|
|
@@ -87,6 +143,8 @@ export interface NonChartMeta extends BaseHealthResultMeta {
|
|
|
87
143
|
"x-chart-type"?: never;
|
|
88
144
|
"x-anomaly-enabled"?: never;
|
|
89
145
|
"x-anomaly-direction"?: never;
|
|
146
|
+
"x-anomaly-min-absolute-delta"?: never;
|
|
147
|
+
"x-anomaly-min-relative-delta"?: never;
|
|
90
148
|
}
|
|
91
149
|
|
|
92
150
|
/**
|
|
@@ -94,8 +152,8 @@ export interface NonChartMeta extends BaseHealthResultMeta {
|
|
|
94
152
|
* Provides autocompletion and enforces that ANY field exposing a chart
|
|
95
153
|
* MUST explicitly define its anomaly behavior.
|
|
96
154
|
*/
|
|
97
|
-
export type HealthResultMeta =
|
|
98
|
-
|
|
|
99
|
-
|
|
|
155
|
+
export type HealthResultMeta =
|
|
156
|
+
| ChartMetaAnomalyNumeric
|
|
157
|
+
| ChartMetaAnomalyCategorical
|
|
158
|
+
| ChartMetaAnomalyDisabled
|
|
100
159
|
| NonChartMeta;
|
|
101
|
-
|