@openclaw/diagnostics-prometheus 2026.9.1-beta.1 → 2026.9.2
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/dist/index.js +24 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -178,7 +178,8 @@ function createPrometheusMetricStore() {
|
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
function safeErrorMessage(err) {
|
|
181
|
-
|
|
181
|
+
const message = err instanceof Error ? err.message ?? err.name : String(err);
|
|
182
|
+
return truncateUtf16Safe(redactSensitiveText(message).replaceAll("\0", " ").replace(/[\r\n\t\u2028\u2029]/gu, " "), 500);
|
|
182
183
|
}
|
|
183
184
|
function shouldRecordDiagnosticEvent(metadata) {
|
|
184
185
|
return metadata.trusted || isInternalDiagnosticEventMetadata(metadata);
|
|
@@ -372,6 +373,27 @@ function recordModelUsage(store, evt) {
|
|
|
372
373
|
function recordDiagnosticEvent(store, evt, metadata) {
|
|
373
374
|
if (!shouldRecordDiagnosticEvent(metadata)) return;
|
|
374
375
|
switch (evt.type) {
|
|
376
|
+
case "gateway.event_loop.sample":
|
|
377
|
+
store.histogram("openclaw_gateway_event_loop_delay_max_seconds", "Maximum event-loop delay per completed Gateway observation window in seconds.", {}, seconds(evt.delayMaxMs));
|
|
378
|
+
store.counter("openclaw_gateway_event_loop_observed_seconds_total", "Elapsed seconds covered by completed Gateway event-loop observation windows.", {}, evt.intervalMs / 1e3);
|
|
379
|
+
return;
|
|
380
|
+
case "gateway.rpc": {
|
|
381
|
+
const labels = { method: evt.method };
|
|
382
|
+
if (evt.phase === "received") {
|
|
383
|
+
store.counter("openclaw_gateway_rpc_requests_total", "Authenticated Gateway WebSocket requests received.", labels);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
store.counter("openclaw_gateway_rpc_outcomes_total", "Gateway RPC observations by phase and outcome.", {
|
|
387
|
+
phase: evt.phase,
|
|
388
|
+
outcome: evt.outcome
|
|
389
|
+
});
|
|
390
|
+
if (evt.phase === "response" && (evt.outcome === "ok" || evt.outcome === "error")) store.histogram("openclaw_gateway_rpc_first_response_seconds", "Elapsed time until the first Gateway RPC response is sent.", labels, seconds(evt.durationMs));
|
|
391
|
+
else if (evt.phase === "handler") {
|
|
392
|
+
store.histogram("openclaw_gateway_rpc_handler_seconds", "Gateway RPC handler duration until return or throw.", labels, seconds(evt.durationMs));
|
|
393
|
+
store.histogram("openclaw_gateway_rpc_admission_seconds", "Elapsed time from Gateway RPC receipt until handler invocation.", labels, seconds(evt.admissionMs));
|
|
394
|
+
} else if (evt.phase === "dispatch") store.histogram("openclaw_gateway_rpc_queue_wait_seconds", "Gateway operator request start queue wait.", labels, seconds(evt.queueWaitMs));
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
375
397
|
case "model.usage":
|
|
376
398
|
recordModelUsage(store, evt);
|
|
377
399
|
return;
|
|
@@ -524,7 +546,7 @@ function recordDiagnosticEvent(store, evt, metadata) {
|
|
|
524
546
|
store.histogram("openclaw_liveness_event_loop_delay_p99_seconds", "P99 event-loop delay reported by diagnostic liveness warnings in seconds.", livenessLabels(evt), seconds(evt.eventLoopDelayP99Ms));
|
|
525
547
|
store.histogram("openclaw_liveness_event_loop_delay_max_seconds", "Maximum event-loop delay reported by diagnostic liveness warnings in seconds.", livenessLabels(evt), seconds(evt.eventLoopDelayMaxMs));
|
|
526
548
|
store.histogram("openclaw_liveness_event_loop_utilization_ratio", "Event-loop utilization reported by diagnostic liveness warnings.", livenessLabels(evt), asNonNegativeFiniteNumber(evt.eventLoopUtilization), RATIO_BUCKETS);
|
|
527
|
-
store.histogram("openclaw_liveness_cpu_core_ratio", "CPU core
|
|
549
|
+
store.histogram("openclaw_liveness_cpu_core_ratio", "Whole-process CPU usage in core equivalents, including worker and native threads; can exceed 1.", livenessLabels(evt), asNonNegativeFiniteNumber(evt.cpuCoreRatio), RATIO_BUCKETS);
|
|
528
550
|
return;
|
|
529
551
|
case "diagnostic.async_queue.dropped":
|
|
530
552
|
store.counter("openclaw_diagnostic_async_queue_dropped_total", "Async diagnostic queue drops by dropped event class.", { drop_class: "total" }, asNonNegativeFiniteNumber(evt.droppedEvents));
|
|
@@ -545,7 +567,6 @@ function recordDiagnosticEvent(store, evt, metadata) {
|
|
|
545
567
|
case "payload.large":
|
|
546
568
|
store.counter("openclaw_payload_large_total", "Oversized payload diagnostics by surface and action.", payloadLargeLabels(evt));
|
|
547
569
|
store.histogram("openclaw_payload_large_bytes", "Oversized payload byte sizes by surface and action.", payloadLargeLabels(evt), asNonNegativeFiniteNumber(evt.bytes), BYTE_BUCKETS);
|
|
548
|
-
default:
|
|
549
570
|
}
|
|
550
571
|
}
|
|
551
572
|
function createMetricsHandler(store) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diagnostics-prometheus",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.2",
|
|
4
4
|
"description": "OpenClaw diagnostics Prometheus exporter for runtime metrics.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.4.25"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.9.
|
|
21
|
+
"pluginApi": ">=2026.9.2"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.9.
|
|
24
|
+
"openclawVersion": "2026.9.2"
|
|
25
25
|
},
|
|
26
26
|
"release": {
|
|
27
27
|
"publishToClawHub": true,
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"README.md"
|
|
38
38
|
],
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"openclaw": ">=2026.9.
|
|
40
|
+
"openclaw": ">=2026.9.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
43
43
|
"openclaw": {
|