@bleedingdev/modern-js-server-runtime-extensions 3.9.0-ultramodern.5 → 3.9.0-ultramodern.6
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/README.md +5 -5
- package/dist/cjs/bff-policy/crossProjectPolicy.js +1 -11
- package/dist/cjs/contract-gate-snapshot-store/http-store.js +1 -8
- package/dist/cjs/telemetry/exporters.js +4 -4
- package/dist/cjs/telemetry/healthSetup.js +14 -18
- package/dist/cjs/telemetry/lifecycle.js +5 -5
- package/dist/cjs/telemetry/plugin.js +3 -4
- package/dist/cjs/telemetry/runtimeEndpoints.js +1 -7
- package/dist/cjs/telemetryCore.js +5 -5
- package/dist/esm/bff-policy/crossProjectPolicy.mjs +1 -11
- package/dist/esm/contract-gate-snapshot-store/http-store.mjs +1 -8
- package/dist/esm/telemetry/exporters.mjs +2 -2
- package/dist/esm/telemetry/healthSetup.mjs +14 -18
- package/dist/esm/telemetry/lifecycle.mjs +6 -6
- package/dist/esm/telemetry/plugin.mjs +3 -4
- package/dist/esm/telemetry/runtimeEndpoints.mjs +1 -7
- package/dist/esm/telemetryCore.mjs +1 -1
- package/dist/esm-node/bff-policy/crossProjectPolicy.mjs +1 -11
- package/dist/esm-node/contract-gate-snapshot-store/http-store.mjs +1 -8
- package/dist/esm-node/telemetry/exporters.mjs +2 -2
- package/dist/esm-node/telemetry/healthSetup.mjs +14 -18
- package/dist/esm-node/telemetry/lifecycle.mjs +6 -6
- package/dist/esm-node/telemetry/plugin.mjs +3 -4
- package/dist/esm-node/telemetry/runtimeEndpoints.mjs +1 -7
- package/dist/esm-node/telemetryCore.mjs +1 -1
- package/dist/types/bff-policy/crossProjectPolicy.d.ts +2 -11
- package/dist/types/telemetry/exporters.d.ts +1 -1
- package/dist/types/telemetry/healthSetup.d.ts +2 -4
- package/dist/types/telemetry/lifecycle.d.ts +2 -2
- package/dist/types/telemetry/runtimeEndpoints.d.ts +1 -3
- package/dist/types/telemetryCore.d.ts +1 -1
- package/dist/types-esm/bff-policy/crossProjectPolicy.d.mts +2 -11
- package/dist/types-esm/telemetry/exporters.d.mts +1 -1
- package/dist/types-esm/telemetry/healthSetup.d.mts +2 -4
- package/dist/types-esm/telemetry/lifecycle.d.mts +2 -2
- package/dist/types-esm/telemetry/runtimeEndpoints.d.mts +1 -3
- package/dist/types-esm/telemetryCore.d.mts +1 -1
- package/package.json +10 -10
- package/src/bff-policy/crossProjectPolicy.ts +7 -34
- package/src/contract-gate-snapshot-store/http-store.ts +1 -11
- package/src/telemetry/exporters.ts +1 -1
- package/src/telemetry/healthSetup.ts +16 -27
- package/src/telemetry/lifecycle.ts +7 -7
- package/src/telemetry/plugin.ts +2 -4
- package/src/telemetry/runtimeEndpoints.ts +0 -10
- package/src/telemetryCore.ts +1 -1
- package/tests/bff-policy/crossProjectPolicy.test.ts +0 -34
- package/tests/nativeServerAssembly.test.ts +4 -4
- package/tests/registration.test.ts +1 -1
- package/tests/{telemetryAutopilot.test.ts → telemetryHealthObservation.test.ts} +38 -36
- package/dist/cjs/telemetry/canaryCompatibility.js +0 -73
- package/dist/esm/telemetry/canaryCompatibility.mjs +0 -35
- package/dist/esm-node/telemetry/canaryCompatibility.mjs +0 -36
- package/dist/types/telemetry/canaryCompatibility.d.ts +0 -19
- package/dist/types-esm/telemetry/canaryCompatibility.d.mts +0 -19
- package/src/telemetry/canaryCompatibility.ts +0 -55
- package/tests/telemetryCanaryCompatibility.test.ts +0 -152
|
@@ -22,20 +22,15 @@ import {
|
|
|
22
22
|
TelemetryHealthMonitor,
|
|
23
23
|
TelemetryRegistry,
|
|
24
24
|
} from '../telemetryCore';
|
|
25
|
-
import {
|
|
26
|
-
createTelemetryCanaryCompatibility,
|
|
27
|
-
type TelemetryCanaryCompatibility,
|
|
28
|
-
} from './canaryCompatibility';
|
|
29
25
|
|
|
30
26
|
type SetupTelemetryHealthMonitoringOptions = {
|
|
31
27
|
registry: TelemetryRegistry;
|
|
32
28
|
appDirectory: string;
|
|
33
|
-
|
|
29
|
+
healthConfig: ServerTelemetryUserConfig['health'] | undefined;
|
|
34
30
|
};
|
|
35
31
|
|
|
36
32
|
type SetupTelemetryHealthMonitoringResult = {
|
|
37
33
|
healthMonitor?: TelemetryHealthMonitor;
|
|
38
|
-
canaryCompatibility?: TelemetryCanaryCompatibility;
|
|
39
34
|
gateSnapshotStorePromise?: Promise<ContractGateSnapshotStore>;
|
|
40
35
|
runtimeFallbackSignalConfig?: RuntimeFallbackSignalConfig;
|
|
41
36
|
runtimeStatusAuthConfig?: RuntimeFallbackSignalAuthConfig;
|
|
@@ -64,33 +59,29 @@ function emitHealthTransitionMetric(
|
|
|
64
59
|
export const setupTelemetryHealthMonitoring = ({
|
|
65
60
|
registry,
|
|
66
61
|
appDirectory,
|
|
67
|
-
|
|
62
|
+
healthConfig,
|
|
68
63
|
}: SetupTelemetryHealthMonitoringOptions): SetupTelemetryHealthMonitoringResult => {
|
|
69
|
-
if (!
|
|
64
|
+
if (!healthConfig?.enabled) {
|
|
70
65
|
return {};
|
|
71
66
|
}
|
|
72
67
|
|
|
73
|
-
const contractGates =
|
|
68
|
+
const contractGates = healthConfig.contractGates as
|
|
74
69
|
| Record<string, boolean | { passed: boolean; reason?: string }>
|
|
75
70
|
| undefined;
|
|
76
71
|
|
|
77
|
-
const canaryCompatibility = createTelemetryCanaryCompatibility(registry);
|
|
78
72
|
const healthMonitor = new TelemetryHealthMonitor({
|
|
79
73
|
registry,
|
|
80
|
-
evaluationIntervalMs:
|
|
74
|
+
evaluationIntervalMs: healthConfig.evaluationIntervalMs,
|
|
81
75
|
minConsecutiveHealthyEvaluations:
|
|
82
|
-
|
|
83
|
-
// `rollbackConsecutiveFailures` is the legacy public config key. It now
|
|
84
|
-
// controls health-state hysteresis and never triggers a deployment action.
|
|
76
|
+
healthConfig.minConsecutiveHealthyEvaluations,
|
|
85
77
|
minConsecutiveFailedEvaluations:
|
|
86
|
-
|
|
87
|
-
maxQueueUtilization:
|
|
88
|
-
maxTotalDropped:
|
|
89
|
-
maxUnhealthyExporters:
|
|
78
|
+
healthConfig.minConsecutiveFailedEvaluations,
|
|
79
|
+
maxQueueUtilization: healthConfig.maxQueueUtilization,
|
|
80
|
+
maxTotalDropped: healthConfig.maxTotalDropped,
|
|
81
|
+
maxUnhealthyExporters: healthConfig.maxUnhealthyExporters,
|
|
90
82
|
requiredContractGates: Object.keys(contractGates || {}),
|
|
91
83
|
onTransition: evaluation => {
|
|
92
84
|
emitHealthTransitionMetric(registry, evaluation);
|
|
93
|
-
canaryCompatibility.observe(evaluation);
|
|
94
85
|
},
|
|
95
86
|
});
|
|
96
87
|
|
|
@@ -101,22 +92,21 @@ export const setupTelemetryHealthMonitoring = ({
|
|
|
101
92
|
let gateSnapshotStorePromise: Promise<ContractGateSnapshotStore> | undefined;
|
|
102
93
|
let runtimeFallbackSignalConfig: RuntimeFallbackSignalConfig | undefined;
|
|
103
94
|
|
|
104
|
-
// `autopilot` is retained only as the legacy config key for snapshot input.
|
|
105
95
|
const snapshotObservationEnabled =
|
|
106
|
-
|
|
96
|
+
healthConfig.snapshotObservation?.enabled ?? true;
|
|
107
97
|
if (snapshotObservationEnabled) {
|
|
108
98
|
const gateSnapshotPath = resolveContractGateSnapshotPath(
|
|
109
99
|
appDirectory,
|
|
110
|
-
|
|
100
|
+
healthConfig.snapshotObservation?.gateSnapshotPath,
|
|
111
101
|
);
|
|
112
102
|
gateSnapshotStorePromise = resolveContractGateSnapshotStore({
|
|
113
103
|
appDirectory,
|
|
114
104
|
gateSnapshotPath: gateSnapshotPath || DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH,
|
|
115
|
-
stateStore:
|
|
105
|
+
stateStore: healthConfig.snapshotObservation?.stateStore,
|
|
116
106
|
});
|
|
117
107
|
|
|
118
108
|
const runtimeSignalConfig =
|
|
119
|
-
|
|
109
|
+
healthConfig.snapshotObservation?.runtimeFallbackSignal;
|
|
120
110
|
if (runtimeSignalConfig?.enabled === true) {
|
|
121
111
|
runtimeFallbackSignalConfig = {
|
|
122
112
|
endpoint: resolveRuntimeFallbackSignalEndpoint(
|
|
@@ -148,16 +138,15 @@ export const setupTelemetryHealthMonitoring = ({
|
|
|
148
138
|
}
|
|
149
139
|
|
|
150
140
|
// Detailed runtime status stays authenticated even when signal ingestion is
|
|
151
|
-
// disabled.
|
|
141
|
+
// disabled.
|
|
152
142
|
const runtimeStatusAuthConfig =
|
|
153
143
|
runtimeFallbackSignalConfig?.auth ??
|
|
154
144
|
normalizeRuntimeFallbackSignalAuthConfig(
|
|
155
|
-
|
|
145
|
+
healthConfig.snapshotObservation?.runtimeFallbackSignal?.auth,
|
|
156
146
|
);
|
|
157
147
|
|
|
158
148
|
return {
|
|
159
149
|
healthMonitor,
|
|
160
|
-
canaryCompatibility,
|
|
161
150
|
gateSnapshotStorePromise,
|
|
162
151
|
runtimeFallbackSignalConfig,
|
|
163
152
|
runtimeStatusAuthConfig,
|
|
@@ -8,9 +8,9 @@ import { ContractGateSnapshotObserver } from '../contractGateSnapshotObserver';
|
|
|
8
8
|
import {
|
|
9
9
|
createOtlpTelemetryExporter,
|
|
10
10
|
createVictoriaMetricsTelemetryExporter,
|
|
11
|
-
maybeWarnLegacyOtlpEndpoint,
|
|
12
11
|
TelemetryHealthMonitor,
|
|
13
12
|
TelemetryRegistry,
|
|
13
|
+
warnOnMetricsOtlpEndpoint,
|
|
14
14
|
} from '../telemetryCore';
|
|
15
15
|
|
|
16
16
|
type TelemetryLifecycleApi = {
|
|
@@ -22,7 +22,7 @@ type RegisterTelemetryLifecycleOptions = {
|
|
|
22
22
|
api: TelemetryLifecycleApi;
|
|
23
23
|
registry: TelemetryRegistry;
|
|
24
24
|
telemetryConfig: ServerTelemetryUserConfig;
|
|
25
|
-
|
|
25
|
+
healthConfig: ServerTelemetryUserConfig['health'] | undefined;
|
|
26
26
|
healthMonitor?: TelemetryHealthMonitor;
|
|
27
27
|
gateSnapshotStorePromise?: Promise<ContractGateSnapshotStore>;
|
|
28
28
|
appDirectory: string;
|
|
@@ -51,7 +51,7 @@ export const registerTelemetryLifecycle = ({
|
|
|
51
51
|
api,
|
|
52
52
|
registry,
|
|
53
53
|
telemetryConfig,
|
|
54
|
-
|
|
54
|
+
healthConfig,
|
|
55
55
|
healthMonitor,
|
|
56
56
|
gateSnapshotStorePromise,
|
|
57
57
|
appDirectory,
|
|
@@ -82,7 +82,7 @@ export const registerTelemetryLifecycle = ({
|
|
|
82
82
|
prepared = true;
|
|
83
83
|
|
|
84
84
|
if (telemetryConfig.exporters?.otlp?.enabled) {
|
|
85
|
-
|
|
85
|
+
warnOnMetricsOtlpEndpoint(telemetryConfig.exporters.otlp.endpoint);
|
|
86
86
|
await registry.register(
|
|
87
87
|
createOtlpTelemetryExporter(telemetryConfig.exporters.otlp),
|
|
88
88
|
);
|
|
@@ -111,11 +111,11 @@ export const registerTelemetryLifecycle = ({
|
|
|
111
111
|
monitor: healthMonitor,
|
|
112
112
|
gateSnapshotPath: resolveContractGateSnapshotPath(
|
|
113
113
|
appDirectory,
|
|
114
|
-
|
|
114
|
+
healthConfig?.snapshotObservation?.gateSnapshotPath,
|
|
115
115
|
),
|
|
116
116
|
gateSnapshotStore,
|
|
117
|
-
pollIntervalMs:
|
|
118
|
-
gateStaleAfterMs:
|
|
117
|
+
pollIntervalMs: healthConfig?.snapshotObservation?.pollIntervalMs,
|
|
118
|
+
gateStaleAfterMs: healthConfig?.snapshotObservation?.gateStaleAfterMs,
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
if (contractGateSnapshotObserver) {
|
package/src/telemetry/plugin.ts
CHANGED
|
@@ -135,14 +135,13 @@ export const injectTelemetryPlugin = (): ServerPlugin => ({
|
|
|
135
135
|
|
|
136
136
|
const {
|
|
137
137
|
healthMonitor,
|
|
138
|
-
canaryCompatibility,
|
|
139
138
|
gateSnapshotStorePromise,
|
|
140
139
|
runtimeFallbackSignalConfig,
|
|
141
140
|
runtimeStatusAuthConfig,
|
|
142
141
|
} = setupTelemetryHealthMonitoring({
|
|
143
142
|
registry,
|
|
144
143
|
appDirectory,
|
|
145
|
-
|
|
144
|
+
healthConfig: telemetryConfig.health,
|
|
146
145
|
});
|
|
147
146
|
|
|
148
147
|
if (runtimeFallbackSignalConfig) {
|
|
@@ -154,7 +153,6 @@ export const injectTelemetryPlugin = (): ServerPlugin => ({
|
|
|
154
153
|
createRuntimeStatusMiddleware({
|
|
155
154
|
registry,
|
|
156
155
|
healthMonitor,
|
|
157
|
-
canaryCompatibility,
|
|
158
156
|
runtimeFallbackSignalConfig,
|
|
159
157
|
runtimeStatusAuthConfig,
|
|
160
158
|
}),
|
|
@@ -192,7 +190,7 @@ export const injectTelemetryPlugin = (): ServerPlugin => ({
|
|
|
192
190
|
api,
|
|
193
191
|
registry,
|
|
194
192
|
telemetryConfig,
|
|
195
|
-
|
|
193
|
+
healthConfig: telemetryConfig.health,
|
|
196
194
|
healthMonitor,
|
|
197
195
|
gateSnapshotStorePromise,
|
|
198
196
|
appDirectory,
|
|
@@ -15,12 +15,10 @@ import type {
|
|
|
15
15
|
TelemetryHealthMonitor,
|
|
16
16
|
TelemetryRegistry,
|
|
17
17
|
} from '../telemetryCore';
|
|
18
|
-
import type { TelemetryCanaryCompatibility } from './canaryCompatibility';
|
|
19
18
|
|
|
20
19
|
type RuntimeStatusMiddlewareOptions = {
|
|
21
20
|
registry: TelemetryRegistry;
|
|
22
21
|
healthMonitor?: TelemetryHealthMonitor;
|
|
23
|
-
canaryCompatibility?: TelemetryCanaryCompatibility;
|
|
24
22
|
runtimeFallbackSignalConfig?: RuntimeFallbackSignalConfig;
|
|
25
23
|
runtimeStatusAuthConfig?: RuntimeFallbackSignalAuthConfig;
|
|
26
24
|
};
|
|
@@ -89,7 +87,6 @@ export const createRuntimeFallbackSignalMiddleware = (
|
|
|
89
87
|
export const createRuntimeStatusMiddleware = ({
|
|
90
88
|
registry,
|
|
91
89
|
healthMonitor,
|
|
92
|
-
canaryCompatibility,
|
|
93
90
|
runtimeFallbackSignalConfig,
|
|
94
91
|
runtimeStatusAuthConfig,
|
|
95
92
|
}: RuntimeStatusMiddlewareOptions) => ({
|
|
@@ -128,13 +125,6 @@ export const createRuntimeStatusMiddleware = ({
|
|
|
128
125
|
...healthSnapshot,
|
|
129
126
|
}
|
|
130
127
|
: { enabled: false },
|
|
131
|
-
canary:
|
|
132
|
-
healthSnapshot && canaryCompatibility
|
|
133
|
-
? {
|
|
134
|
-
enabled: true,
|
|
135
|
-
...canaryCompatibility.getStatusSnapshot(healthSnapshot),
|
|
136
|
-
}
|
|
137
|
-
: { enabled: false },
|
|
138
128
|
runtimeFallbackSignal: runtimeFallbackSignalConfig
|
|
139
129
|
? {
|
|
140
130
|
enabled: true,
|
package/src/telemetryCore.ts
CHANGED
|
@@ -7,9 +7,9 @@ export {
|
|
|
7
7
|
export {
|
|
8
8
|
createOtlpTelemetryExporter,
|
|
9
9
|
createVictoriaMetricsTelemetryExporter,
|
|
10
|
-
maybeWarnLegacyOtlpEndpoint,
|
|
11
10
|
type OtlpExporterOptions,
|
|
12
11
|
type VictoriaMetricsExporterOptions,
|
|
12
|
+
warnOnMetricsOtlpEndpoint,
|
|
13
13
|
} from './telemetry/exporters';
|
|
14
14
|
export {
|
|
15
15
|
type TelemetryContractGateStatus,
|
|
@@ -780,40 +780,6 @@ describe('cross-project policy producer identity binding', () => {
|
|
|
780
780
|
}
|
|
781
781
|
});
|
|
782
782
|
|
|
783
|
-
test('explicit client-asserted namespace opt-out warns and remains advisory', () => {
|
|
784
|
-
const warnSpy = rstest
|
|
785
|
-
.spyOn(console, 'warn')
|
|
786
|
-
.mockImplementation(() => undefined);
|
|
787
|
-
|
|
788
|
-
try {
|
|
789
|
-
const firstResult = withNodeEnv('development', () =>
|
|
790
|
-
evaluateCrossProjectPolicy(spoofableHeaders, {
|
|
791
|
-
enabled: true,
|
|
792
|
-
allowedNamespaces: ['crm'],
|
|
793
|
-
allowClientAssertedNamespace: true,
|
|
794
|
-
requireOperationContext: false,
|
|
795
|
-
}),
|
|
796
|
-
);
|
|
797
|
-
const secondResult = withNodeEnv('development', () =>
|
|
798
|
-
evaluateCrossProjectPolicy(spoofableHeaders, {
|
|
799
|
-
enabled: true,
|
|
800
|
-
allowedNamespaces: ['crm'],
|
|
801
|
-
allowClientAssertedNamespace: true,
|
|
802
|
-
requireOperationContext: false,
|
|
803
|
-
}),
|
|
804
|
-
);
|
|
805
|
-
|
|
806
|
-
expect(firstResult).toBeNull();
|
|
807
|
-
expect(secondResult).toBeNull();
|
|
808
|
-
expect(warnSpy).toHaveBeenCalledTimes(1);
|
|
809
|
-
expect(warnSpy.mock.calls[0][0]).toContain(
|
|
810
|
-
NAMESPACE_ALLOWLIST_REQUIRES_VERIFIER_MESSAGE,
|
|
811
|
-
);
|
|
812
|
-
} finally {
|
|
813
|
-
warnSpy.mockRestore();
|
|
814
|
-
}
|
|
815
|
-
});
|
|
816
|
-
|
|
817
783
|
test('in production, namespace allowlist without verifier fails closed', () => {
|
|
818
784
|
const violation = withNodeEnv('production', () =>
|
|
819
785
|
evaluateCrossProjectPolicy(spoofableHeaders, {
|
|
@@ -32,10 +32,10 @@ describe('applyPlugins fork plugin assembly', () => {
|
|
|
32
32
|
logger: false,
|
|
33
33
|
telemetry: {
|
|
34
34
|
enabled: true,
|
|
35
|
-
|
|
35
|
+
health: {
|
|
36
36
|
enabled: true,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
minConsecutiveFailedEvaluations: 1,
|
|
38
|
+
snapshotObservation: {
|
|
39
39
|
enabled: true,
|
|
40
40
|
gateSnapshotPath: snapshotPath,
|
|
41
41
|
pollIntervalMs: 60_000,
|
|
@@ -81,7 +81,7 @@ describe('applyPlugins fork plugin assembly', () => {
|
|
|
81
81
|
expect(statusResponse.status).toBe(200);
|
|
82
82
|
const status = (await statusResponse.json()) as Record<string, any>;
|
|
83
83
|
expect(status.ok).toBe(true);
|
|
84
|
-
expect(status.
|
|
84
|
+
expect(status.health.enabled).toBe(true);
|
|
85
85
|
|
|
86
86
|
// The signal endpoint requires the token as well.
|
|
87
87
|
const unauthorizedSignal = await server.request(
|
|
@@ -6,9 +6,11 @@ import { injectTelemetryPlugin } from '../src/telemetry';
|
|
|
6
6
|
import { getDefaultAppContext, getDefaultConfig } from './helpers';
|
|
7
7
|
|
|
8
8
|
const makeTempDir = () =>
|
|
9
|
-
fs.mkdtempSync(
|
|
9
|
+
fs.mkdtempSync(
|
|
10
|
+
path.join(os.tmpdir(), 'modern-telemetry-health-observation-'),
|
|
11
|
+
);
|
|
10
12
|
|
|
11
|
-
describe('telemetry
|
|
13
|
+
describe('telemetry health observation runtime signal', () => {
|
|
12
14
|
test('accepts runtime fallback signal and persists gate snapshot', async () => {
|
|
13
15
|
const tempDir = makeTempDir();
|
|
14
16
|
const snapshotPath = path.join(tempDir, '.modern/contract-gates.json');
|
|
@@ -18,10 +20,10 @@ describe('telemetry autopilot runtime signal', () => {
|
|
|
18
20
|
config.server = {
|
|
19
21
|
telemetry: {
|
|
20
22
|
enabled: true,
|
|
21
|
-
|
|
23
|
+
health: {
|
|
22
24
|
enabled: true,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
minConsecutiveFailedEvaluations: 1,
|
|
26
|
+
snapshotObservation: {
|
|
25
27
|
enabled: true,
|
|
26
28
|
gateSnapshotPath: snapshotPath,
|
|
27
29
|
pollIntervalMs: 20,
|
|
@@ -102,10 +104,10 @@ describe('telemetry autopilot runtime signal', () => {
|
|
|
102
104
|
config.server = {
|
|
103
105
|
telemetry: {
|
|
104
106
|
enabled: true,
|
|
105
|
-
|
|
107
|
+
health: {
|
|
106
108
|
enabled: true,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
minConsecutiveFailedEvaluations: 1,
|
|
110
|
+
snapshotObservation: {
|
|
109
111
|
enabled: true,
|
|
110
112
|
gateSnapshotPath: snapshotPath,
|
|
111
113
|
runtimeFallbackSignal: {
|
|
@@ -171,10 +173,10 @@ describe('telemetry autopilot runtime signal', () => {
|
|
|
171
173
|
config.server = {
|
|
172
174
|
telemetry: {
|
|
173
175
|
enabled: true,
|
|
174
|
-
|
|
176
|
+
health: {
|
|
175
177
|
enabled: true,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
minConsecutiveFailedEvaluations: 1,
|
|
179
|
+
snapshotObservation: {
|
|
178
180
|
enabled: true,
|
|
179
181
|
gateSnapshotPath: snapshotPath,
|
|
180
182
|
runtimeFallbackSignal: {
|
|
@@ -255,10 +257,10 @@ describe('telemetry autopilot runtime signal', () => {
|
|
|
255
257
|
config.server = {
|
|
256
258
|
telemetry: {
|
|
257
259
|
enabled: true,
|
|
258
|
-
|
|
260
|
+
health: {
|
|
259
261
|
enabled: true,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
minConsecutiveFailedEvaluations: 1,
|
|
263
|
+
snapshotObservation: {
|
|
262
264
|
enabled: true,
|
|
263
265
|
gateSnapshotPath: snapshotPath,
|
|
264
266
|
runtimeFallbackSignal: {
|
|
@@ -374,10 +376,10 @@ exports.createContractGateSnapshotStore = ({ gateSnapshotPath, options }) => {
|
|
|
374
376
|
config.server = {
|
|
375
377
|
telemetry: {
|
|
376
378
|
enabled: true,
|
|
377
|
-
|
|
379
|
+
health: {
|
|
378
380
|
enabled: true,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
+
minConsecutiveFailedEvaluations: 1,
|
|
382
|
+
snapshotObservation: {
|
|
381
383
|
enabled: true,
|
|
382
384
|
gateSnapshotPath: defaultSnapshotPath,
|
|
383
385
|
stateStore: {
|
|
@@ -451,10 +453,10 @@ exports.createContractGateSnapshotStore = ({ gateSnapshotPath, options }) => {
|
|
|
451
453
|
config.server = {
|
|
452
454
|
telemetry: {
|
|
453
455
|
enabled: true,
|
|
454
|
-
|
|
456
|
+
health: {
|
|
455
457
|
enabled: true,
|
|
456
|
-
|
|
457
|
-
|
|
458
|
+
minConsecutiveFailedEvaluations: 1,
|
|
459
|
+
snapshotObservation: {
|
|
458
460
|
enabled: true,
|
|
459
461
|
gateSnapshotPath: snapshotPath,
|
|
460
462
|
runtimeFallbackSignal: {
|
|
@@ -585,10 +587,10 @@ exports.createContractGateSnapshotStore = ({ gateSnapshotPath, options }) => {
|
|
|
585
587
|
config.server = {
|
|
586
588
|
telemetry: {
|
|
587
589
|
enabled: true,
|
|
588
|
-
|
|
590
|
+
health: {
|
|
589
591
|
enabled: true,
|
|
590
|
-
|
|
591
|
-
|
|
592
|
+
minConsecutiveFailedEvaluations: 1,
|
|
593
|
+
snapshotObservation: {
|
|
592
594
|
enabled: true,
|
|
593
595
|
gateSnapshotPath: snapshotPath,
|
|
594
596
|
runtimeFallbackSignal: {
|
|
@@ -692,13 +694,13 @@ exports.createContractGateSnapshotStore = ({ gateSnapshotPath, options }) => {
|
|
|
692
694
|
config.server = {
|
|
693
695
|
telemetry: {
|
|
694
696
|
enabled: true,
|
|
695
|
-
|
|
697
|
+
health: {
|
|
696
698
|
enabled: true,
|
|
697
|
-
|
|
698
|
-
|
|
699
|
+
minConsecutiveFailedEvaluations: 1,
|
|
700
|
+
snapshotObservation: {
|
|
699
701
|
enabled: true,
|
|
700
702
|
gateSnapshotPath: snapshotPath,
|
|
701
|
-
// no runtimeFallbackSignal config: the
|
|
703
|
+
// no runtimeFallbackSignal config: the health observation switch must
|
|
702
704
|
// stay OFF by default.
|
|
703
705
|
},
|
|
704
706
|
},
|
|
@@ -751,9 +753,9 @@ exports.createContractGateSnapshotStore = ({ gateSnapshotPath, options }) => {
|
|
|
751
753
|
config.server = {
|
|
752
754
|
telemetry: {
|
|
753
755
|
enabled: true,
|
|
754
|
-
|
|
756
|
+
health: {
|
|
755
757
|
enabled: true,
|
|
756
|
-
|
|
758
|
+
snapshotObservation: {
|
|
757
759
|
enabled: true,
|
|
758
760
|
gateSnapshotPath: snapshotPath,
|
|
759
761
|
runtimeFallbackSignal: {
|
|
@@ -794,10 +796,10 @@ exports.createContractGateSnapshotStore = ({ gateSnapshotPath, options }) => {
|
|
|
794
796
|
config.server = {
|
|
795
797
|
telemetry: {
|
|
796
798
|
enabled: true,
|
|
797
|
-
|
|
799
|
+
health: {
|
|
798
800
|
enabled: true,
|
|
799
|
-
|
|
800
|
-
|
|
801
|
+
minConsecutiveFailedEvaluations: 1,
|
|
802
|
+
snapshotObservation: {
|
|
801
803
|
enabled: true,
|
|
802
804
|
gateSnapshotPath: snapshotPath,
|
|
803
805
|
runtimeFallbackSignal: {
|
|
@@ -871,9 +873,9 @@ exports.createContractGateSnapshotStore = ({ gateSnapshotPath, options }) => {
|
|
|
871
873
|
config.server = {
|
|
872
874
|
telemetry: {
|
|
873
875
|
enabled: true,
|
|
874
|
-
|
|
876
|
+
health: {
|
|
875
877
|
enabled: true,
|
|
876
|
-
|
|
878
|
+
snapshotObservation: {
|
|
877
879
|
enabled: true,
|
|
878
880
|
gateSnapshotPath: snapshotPath,
|
|
879
881
|
},
|
|
@@ -918,9 +920,9 @@ exports.createContractGateSnapshotStore = ({ gateSnapshotPath, options }) => {
|
|
|
918
920
|
config.server = {
|
|
919
921
|
telemetry: {
|
|
920
922
|
enabled: true,
|
|
921
|
-
|
|
923
|
+
health: {
|
|
922
924
|
enabled: true,
|
|
923
|
-
|
|
925
|
+
snapshotObservation: {
|
|
924
926
|
enabled: true,
|
|
925
927
|
gateSnapshotPath: snapshotPath,
|
|
926
928
|
runtimeFallbackSignal: {
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
const createTelemetryCanaryCompatibility = (registry)=>{
|
|
31
|
-
let state = 'canary';
|
|
32
|
-
return {
|
|
33
|
-
observe (evaluation) {
|
|
34
|
-
let action;
|
|
35
|
-
if ('became_healthy' === evaluation.transition && 'canary' === state) {
|
|
36
|
-
state = 'promoted';
|
|
37
|
-
action = 'promote';
|
|
38
|
-
} else {
|
|
39
|
-
if ('became_unhealthy' !== evaluation.transition || 'rolled_back' === state) return;
|
|
40
|
-
state = 'rolled_back';
|
|
41
|
-
action = 'rollback';
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
registry.enqueueMetric({
|
|
45
|
-
name: `telemetry.canary.${action}`,
|
|
46
|
-
value: 1,
|
|
47
|
-
unit: 'count',
|
|
48
|
-
tags: {
|
|
49
|
-
action,
|
|
50
|
-
state,
|
|
51
|
-
failures: String(evaluation.failures.length)
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
} catch (_error) {}
|
|
55
|
-
},
|
|
56
|
-
getStatusSnapshot (snapshot) {
|
|
57
|
-
return {
|
|
58
|
-
...snapshot,
|
|
59
|
-
state
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
__webpack_require__.d(__webpack_exports__, {}, {
|
|
65
|
-
createTelemetryCanaryCompatibility: createTelemetryCanaryCompatibility
|
|
66
|
-
});
|
|
67
|
-
exports.createTelemetryCanaryCompatibility = __webpack_exports__.createTelemetryCanaryCompatibility;
|
|
68
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
69
|
-
"createTelemetryCanaryCompatibility"
|
|
70
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
71
|
-
Object.defineProperty(exports, '__esModule', {
|
|
72
|
-
value: true
|
|
73
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const createTelemetryCanaryCompatibility = (registry)=>{
|
|
2
|
-
let state = 'canary';
|
|
3
|
-
return {
|
|
4
|
-
observe (evaluation) {
|
|
5
|
-
let action;
|
|
6
|
-
if ('became_healthy' === evaluation.transition && 'canary' === state) {
|
|
7
|
-
state = 'promoted';
|
|
8
|
-
action = 'promote';
|
|
9
|
-
} else {
|
|
10
|
-
if ('became_unhealthy' !== evaluation.transition || 'rolled_back' === state) return;
|
|
11
|
-
state = 'rolled_back';
|
|
12
|
-
action = 'rollback';
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
registry.enqueueMetric({
|
|
16
|
-
name: `telemetry.canary.${action}`,
|
|
17
|
-
value: 1,
|
|
18
|
-
unit: 'count',
|
|
19
|
-
tags: {
|
|
20
|
-
action,
|
|
21
|
-
state,
|
|
22
|
-
failures: String(evaluation.failures.length)
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
} catch (_error) {}
|
|
26
|
-
},
|
|
27
|
-
getStatusSnapshot (snapshot) {
|
|
28
|
-
return {
|
|
29
|
-
...snapshot,
|
|
30
|
-
state
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export { createTelemetryCanaryCompatibility };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
const createTelemetryCanaryCompatibility = (registry)=>{
|
|
3
|
-
let state = 'canary';
|
|
4
|
-
return {
|
|
5
|
-
observe (evaluation) {
|
|
6
|
-
let action;
|
|
7
|
-
if ('became_healthy' === evaluation.transition && 'canary' === state) {
|
|
8
|
-
state = 'promoted';
|
|
9
|
-
action = 'promote';
|
|
10
|
-
} else {
|
|
11
|
-
if ('became_unhealthy' !== evaluation.transition || 'rolled_back' === state) return;
|
|
12
|
-
state = 'rolled_back';
|
|
13
|
-
action = 'rollback';
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
registry.enqueueMetric({
|
|
17
|
-
name: `telemetry.canary.${action}`,
|
|
18
|
-
value: 1,
|
|
19
|
-
unit: 'count',
|
|
20
|
-
tags: {
|
|
21
|
-
action,
|
|
22
|
-
state,
|
|
23
|
-
failures: String(evaluation.failures.length)
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
} catch (_error) {}
|
|
27
|
-
},
|
|
28
|
-
getStatusSnapshot (snapshot) {
|
|
29
|
-
return {
|
|
30
|
-
...snapshot,
|
|
31
|
-
state
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export { createTelemetryCanaryCompatibility };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { TelemetryHealthEvaluation, TelemetryHealthStatusSnapshot } from './healthMonitor.js';
|
|
2
|
-
import type { TelemetryRegistry } from './registry.js';
|
|
3
|
-
type CanaryState = 'canary' | 'promoted' | 'rolled_back';
|
|
4
|
-
export declare const createTelemetryCanaryCompatibility: (registry: TelemetryRegistry) => {
|
|
5
|
-
observe(evaluation: TelemetryHealthEvaluation): void;
|
|
6
|
-
getStatusSnapshot(snapshot: TelemetryHealthStatusSnapshot): {
|
|
7
|
-
timestamp: number;
|
|
8
|
-
consecutiveHealthy: number;
|
|
9
|
-
consecutiveFailures: number;
|
|
10
|
-
queueStats: import("./registryTypes.js").TelemetryQueueStats;
|
|
11
|
-
unhealthyExporterCount: number;
|
|
12
|
-
requiredContractGates: string[];
|
|
13
|
-
contractGates: import("./healthMonitor.js").TelemetryContractGateStatus[];
|
|
14
|
-
failurePreview: import("./healthMonitor.js").TelemetryHealthFailure[];
|
|
15
|
-
state: CanaryState;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export type TelemetryCanaryCompatibility = ReturnType<typeof createTelemetryCanaryCompatibility>;
|
|
19
|
-
export {};
|