feat: add Release A monitor PG capability
This commit is contained in:
@@ -336,9 +336,14 @@ export interface HwlabRuntimeObservabilitySpec {
|
||||
export interface HwlabRuntimeObservabilityWebProbeSpec {
|
||||
readonly sentinel?: HwlabRuntimeWebProbeSentinelSpec;
|
||||
readonly sentinels?: readonly HwlabRuntimeWebProbeSentinelRegistryItemSpec[];
|
||||
readonly monitor?: HwlabRuntimeWebProbeMonitorSpec;
|
||||
readonly monitorRoot?: HwlabRuntimeWebProbeMonitorRootSpec;
|
||||
}
|
||||
|
||||
export interface HwlabRuntimeWebProbeMonitorSpec {
|
||||
readonly configRef: string;
|
||||
}
|
||||
|
||||
export interface HwlabRuntimeObservabilityMetricsEndpointSpec {
|
||||
readonly serviceName: string;
|
||||
readonly containerName: string;
|
||||
@@ -1867,13 +1872,14 @@ function observabilityConfig(value: unknown, path: string): HwlabRuntimeObservab
|
||||
function observabilityWebProbeConfig(value: unknown, path: string): HwlabRuntimeObservabilityWebProbeSpec | undefined {
|
||||
if (value === undefined) return undefined;
|
||||
const raw = asRecord(value, path);
|
||||
const allowed = new Set(["sentinel", "sentinels", "monitorRoot"]);
|
||||
const allowed = new Set(["sentinel", "sentinels", "monitor", "monitorRoot"]);
|
||||
for (const key of Object.keys(raw)) {
|
||||
if (!allowed.has(key)) throw new Error(`${path}.${key} is not allowed; observability.webProbe currently only owns sentinel/sentinels/monitorRoot`);
|
||||
if (!allowed.has(key)) throw new Error(`${path}.${key} is not allowed; observability.webProbe currently only owns sentinel/sentinels/monitor/monitorRoot`);
|
||||
}
|
||||
if (raw.sentinel !== undefined && raw.sentinels !== undefined) throw new Error(`${path} may declare sentinel or sentinels, not both`);
|
||||
const sentinel = raw.sentinel === undefined ? undefined : webProbeSentinelConfig(raw.sentinel, `${path}.sentinel`);
|
||||
const sentinels = raw.sentinels === undefined ? undefined : webProbeSentinelRegistryConfig(raw.sentinels, `${path}.sentinels`);
|
||||
const monitor = raw.monitor === undefined ? undefined : webProbeMonitorConfig(raw.monitor, `${path}.monitor`);
|
||||
const monitorRoot = raw.monitorRoot === undefined ? undefined : webProbeMonitorRootConfig(raw.monitorRoot, `${path}.monitorRoot`);
|
||||
if (monitorRoot !== undefined) {
|
||||
if (sentinels !== undefined && !sentinels.some((item) => item.id === monitorRoot.sentinelId)) {
|
||||
@@ -1886,10 +1892,20 @@ function observabilityWebProbeConfig(value: unknown, path: string): HwlabRuntime
|
||||
return {
|
||||
...(sentinel === undefined ? {} : { sentinel }),
|
||||
...(sentinels === undefined ? {} : { sentinels }),
|
||||
...(monitor === undefined ? {} : { monitor }),
|
||||
...(monitorRoot === undefined ? {} : { monitorRoot }),
|
||||
};
|
||||
}
|
||||
|
||||
function webProbeMonitorConfig(value: unknown, path: string): HwlabRuntimeWebProbeMonitorSpec {
|
||||
const raw = asRecord(value, path);
|
||||
const allowed = new Set(["configRef"]);
|
||||
for (const key of Object.keys(raw)) if (!allowed.has(key)) throw new Error(`${path}.${key} is not allowed; monitor may only contain configRef`);
|
||||
const configRef = stringField(raw, "configRef", path);
|
||||
if (!configRef.startsWith("config/") || !configRef.includes("#")) throw new Error(`${path}.configRef must be a config YAML selector`);
|
||||
return { configRef };
|
||||
}
|
||||
|
||||
function webProbeMonitorRootConfig(value: unknown, path: string): HwlabRuntimeWebProbeMonitorRootSpec {
|
||||
const raw = asRecord(value, path);
|
||||
const allowed = new Set(["enabled", "sentinelId", "publicBaseUrl", "routePrefix", "caddyManagedBlockOwner"]);
|
||||
|
||||
Reference in New Issue
Block a user