@openclaw/diagnostics-otel 2026.9.2 → 2026.9.4
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createDiagnosticsOtelService } from "./runtime-api-
|
|
1
|
+
import { t as createDiagnosticsOtelService } from "./runtime-api-B9-DLHbi.js";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
//#region extensions/diagnostics-otel/index.ts
|
|
4
4
|
var diagnostics_otel_default = definePluginEntry({
|
|
@@ -443,10 +443,13 @@ function findOtlpExporterError(reason) {
|
|
|
443
443
|
//#region extensions/diagnostics-otel/src/service-events.ts
|
|
444
444
|
function createDiagnosticsEventHandler(params) {
|
|
445
445
|
const { logger, recorders, recordLogRecord, recordSecurityEvent } = params;
|
|
446
|
-
const { recordGatewayEventLoopSample, recordGatewayRpc, recordModelUsage, recordWebhookReceived, recordWebhookProcessed, recordWebhookError, recordMessageQueued, recordMessageReceived, recordMessageDispatchStarted, recordMessageDispatchCompleted, recordMessageProcessed, recordMessageDeliveryStarted, recordMessageDeliveryCompleted, recordMessageDeliveryError, recordTalkEvent, recordLaneEnqueue, recordLaneDequeue, recordSessionState, recordSessionTurnCreated, recordSessionStuck, recordSessionRecoveryRequested, recordSessionRecoveryCompleted, recordRunAttempt, recordHeartbeat, recordLivenessWarning, recordDiagnosticPhaseCompleted, recordRunStarted, recordRunCompleted, recordHarnessRunStarted, recordHarnessRunCompleted, recordHarnessRunError, recordContextAssembled, recordModelCallStarted,
|
|
446
|
+
const { recordGcDuration, recordGatewayEventLoopSample, recordGatewayRpc, recordModelUsage, recordWebhookReceived, recordWebhookProcessed, recordWebhookError, recordMessageQueued, recordMessageReceived, recordMessageDispatchStarted, recordMessageDispatchCompleted, recordMessageProcessed, recordMessageDeliveryStarted, recordMessageDeliveryCompleted, recordMessageDeliveryError, recordTalkEvent, recordLaneEnqueue, recordLaneDequeue, recordSessionState, recordSessionTurnCreated, recordSessionStuck, recordSessionRecoveryRequested, recordSessionRecoveryCompleted, recordRunAttempt, recordHeartbeat, recordLivenessWarning, recordDiagnosticPhaseCompleted, recordRunStarted, recordRunCompleted, recordHarnessRunStarted, recordHarnessRunCompleted, recordHarnessRunError, recordContextAssembled, recordModelCallStarted, recordModelCallFinished, recordToolExecutionStarted, recordToolExecutionFinished, recordToolExecutionBlocked, recordSkillUsed, recordExecProcessCompleted, recordToolLoop, recordMemorySample, recordMemoryPressure, recordAsyncQueueDropped, recordTelemetryExporter, recordPayloadLarge, recordModelFailover } = recorders;
|
|
447
447
|
return (evt, metadata, privateData) => {
|
|
448
448
|
try {
|
|
449
449
|
switch (evt.type) {
|
|
450
|
+
case "diagnostic.gc":
|
|
451
|
+
recordGcDuration(evt, metadata);
|
|
452
|
+
return;
|
|
450
453
|
case "gateway.event_loop.sample":
|
|
451
454
|
recordGatewayEventLoopSample(evt, metadata);
|
|
452
455
|
return;
|
|
@@ -551,19 +554,15 @@ function createDiagnosticsEventHandler(params) {
|
|
|
551
554
|
recordModelCallStarted(evt, metadata);
|
|
552
555
|
return;
|
|
553
556
|
case "model.call.completed":
|
|
554
|
-
recordModelCallCompleted(evt, metadata, privateData.modelContent);
|
|
555
|
-
return;
|
|
556
557
|
case "model.call.error":
|
|
557
|
-
|
|
558
|
+
recordModelCallFinished(evt, metadata, privateData.modelContent);
|
|
558
559
|
return;
|
|
559
560
|
case "tool.execution.started":
|
|
560
561
|
recordToolExecutionStarted(evt, metadata);
|
|
561
562
|
return;
|
|
562
563
|
case "tool.execution.completed":
|
|
563
|
-
recordToolExecutionCompleted(evt, metadata, privateData.toolContent);
|
|
564
|
-
return;
|
|
565
564
|
case "tool.execution.error":
|
|
566
|
-
|
|
565
|
+
recordToolExecutionFinished(evt, metadata, privateData.toolContent);
|
|
567
566
|
return;
|
|
568
567
|
case "tool.execution.blocked":
|
|
569
568
|
recordToolExecutionBlocked(evt, metadata);
|
|
@@ -1062,6 +1061,11 @@ function createDiagnosticsMetrics(meter, metricNamePrefix = DEFAULT_METRIC_NAME_
|
|
|
1062
1061
|
const createCounter = (name, options) => meter.createCounter(resolveMetricName(name), options);
|
|
1063
1062
|
const createHistogram = (name, options) => meter.createHistogram(resolveMetricName(name), options);
|
|
1064
1063
|
return {
|
|
1064
|
+
gcDurationHistogram: createHistogram("openclaw.gc.duration_ms", {
|
|
1065
|
+
unit: "ms",
|
|
1066
|
+
description: "Elapsed garbage collection duration for the hosting JavaScript isolate",
|
|
1067
|
+
advice: { explicitBucketBoundaries: AGENT_DURATION_MS_BUCKETS }
|
|
1068
|
+
}),
|
|
1065
1069
|
gatewayEventLoopDelayMaxHistogram: createHistogram("openclaw.gateway.event_loop.delay_max_ms", {
|
|
1066
1070
|
unit: "ms",
|
|
1067
1071
|
description: "Maximum event-loop delay per completed Gateway observation window",
|
|
@@ -1911,15 +1915,6 @@ function createModelRecorders(runtime) {
|
|
|
1911
1915
|
"openclaw.transport": normalizeDiagnosticValue(evt.transport),
|
|
1912
1916
|
"openclaw.model_call.observation_unit": modelCallObservationUnit(evt)
|
|
1913
1917
|
});
|
|
1914
|
-
const genAiModelCallMetricAttrs = (evt, errorType) => ({
|
|
1915
|
-
"gen_ai.operation.name": genAiOperationName(evt.api, evt.observationUnit),
|
|
1916
|
-
"gen_ai.provider.name": normalizeDiagnosticValue(evt.provider),
|
|
1917
|
-
"gen_ai.request.model": normalizeDiagnosticValue(evt.model),
|
|
1918
|
-
...errorType ? { "error.type": errorType } : {}
|
|
1919
|
-
});
|
|
1920
|
-
const recordGenAiModelCallDuration = (evt, errorType) => {
|
|
1921
|
-
genAiOperationDurationHistogram.record(evt.durationMs / 1e3, genAiModelCallMetricAttrs(evt, errorType));
|
|
1922
|
-
};
|
|
1923
1918
|
const recordModelCallSizeTimingMetrics = (evt, attrs) => {
|
|
1924
1919
|
const requestPayloadBytes = positiveFiniteNumber(evt.requestPayloadBytes);
|
|
1925
1920
|
if (requestPayloadBytes !== void 0) modelCallRequestBytesHistogram.record(requestPayloadBytes, attrs);
|
|
@@ -1946,50 +1941,31 @@ function createModelRecorders(runtime) {
|
|
|
1946
1941
|
startTimeMs: evt.ts
|
|
1947
1942
|
})).spanContext();
|
|
1948
1943
|
};
|
|
1949
|
-
const
|
|
1950
|
-
const
|
|
1951
|
-
modelCallDurationHistogram.record(evt.durationMs, metricAttrs);
|
|
1952
|
-
recordModelCallSizeTimingMetrics(evt, metricAttrs);
|
|
1953
|
-
recordGenAiModelCallDuration(evt);
|
|
1954
|
-
if (!tracesEnabled) return;
|
|
1955
|
-
const spanAttrs = {
|
|
1956
|
-
"openclaw.provider": evt.provider,
|
|
1957
|
-
"openclaw.model": evt.model
|
|
1958
|
-
};
|
|
1959
|
-
assignGenAiModelCallAttrs(spanAttrs, evt);
|
|
1960
|
-
if (evt.api) spanAttrs["openclaw.api"] = evt.api;
|
|
1961
|
-
if (evt.transport) spanAttrs["openclaw.transport"] = evt.transport;
|
|
1962
|
-
assignModelCallSizeTimingAttrs(spanAttrs, evt);
|
|
1963
|
-
assignModelCallPromptStatsAttrs(spanAttrs, evt);
|
|
1964
|
-
assignModelCallUsageAttrs(spanAttrs, evt);
|
|
1965
|
-
assignOtelModelContentAttributes(spanAttrs, modelContent, contentCapturePolicy);
|
|
1966
|
-
const span = takeTrackedTrustedSpan(evt, metadata) ?? spanWithDuration(modelCallSpanName(evt), spanAttrs, evt.durationMs, {
|
|
1967
|
-
kind: modelCallSpanKind(),
|
|
1968
|
-
parentContext: activeTrustedParentContext(evt, metadata),
|
|
1969
|
-
endTimeMs: evt.ts
|
|
1970
|
-
});
|
|
1971
|
-
setSpanAttrs(span, spanAttrs);
|
|
1972
|
-
addUpstreamRequestIdSpanEvent(span, evt.upstreamRequestIdHash);
|
|
1973
|
-
span.end(evt.ts);
|
|
1974
|
-
};
|
|
1975
|
-
const recordModelCallError = (evt, metadata, modelContent) => {
|
|
1976
|
-
const errorType = normalizeDiagnosticValue(evt.errorCategory, "other");
|
|
1944
|
+
const recordModelCallFinished = (evt, metadata, modelContent) => {
|
|
1945
|
+
const errorType = evt.type === "model.call.error" ? normalizeDiagnosticValue(evt.errorCategory, "other") : void 0;
|
|
1977
1946
|
const metricAttrs = {
|
|
1978
1947
|
...modelCallMetricAttrs(evt),
|
|
1979
|
-
"openclaw.errorCategory": errorType,
|
|
1980
|
-
...evt.failureKind ? { "openclaw.failureKind": normalizeDiagnosticValue(evt.failureKind, "other") } : {}
|
|
1948
|
+
...errorType !== void 0 ? { "openclaw.errorCategory": errorType } : {},
|
|
1949
|
+
...evt.type === "model.call.error" && evt.failureKind ? { "openclaw.failureKind": normalizeDiagnosticValue(evt.failureKind, "other") } : {}
|
|
1981
1950
|
};
|
|
1982
1951
|
modelCallDurationHistogram.record(evt.durationMs, metricAttrs);
|
|
1983
1952
|
recordModelCallSizeTimingMetrics(evt, metricAttrs);
|
|
1984
|
-
|
|
1953
|
+
genAiOperationDurationHistogram.record(evt.durationMs / 1e3, {
|
|
1954
|
+
"gen_ai.operation.name": genAiOperationName(evt.api, evt.observationUnit),
|
|
1955
|
+
"gen_ai.provider.name": normalizeDiagnosticValue(evt.provider),
|
|
1956
|
+
"gen_ai.request.model": normalizeDiagnosticValue(evt.model),
|
|
1957
|
+
...errorType ? { "error.type": errorType } : {}
|
|
1958
|
+
});
|
|
1985
1959
|
if (!tracesEnabled) return;
|
|
1986
1960
|
const spanAttrs = {
|
|
1987
1961
|
"openclaw.provider": evt.provider,
|
|
1988
1962
|
"openclaw.model": evt.model,
|
|
1989
|
-
|
|
1990
|
-
|
|
1963
|
+
...errorType !== void 0 ? {
|
|
1964
|
+
"openclaw.errorCategory": errorType,
|
|
1965
|
+
"error.type": errorType
|
|
1966
|
+
} : {}
|
|
1991
1967
|
};
|
|
1992
|
-
if (evt.failureKind) spanAttrs["openclaw.failureKind"] = normalizeDiagnosticValue(evt.failureKind, "other");
|
|
1968
|
+
if (evt.type === "model.call.error" && evt.failureKind) spanAttrs["openclaw.failureKind"] = normalizeDiagnosticValue(evt.failureKind, "other");
|
|
1993
1969
|
assignGenAiModelCallAttrs(spanAttrs, evt);
|
|
1994
1970
|
if (evt.api) spanAttrs["openclaw.api"] = evt.api;
|
|
1995
1971
|
if (evt.transport) spanAttrs["openclaw.transport"] = evt.transport;
|
|
@@ -2004,17 +1980,15 @@ function createModelRecorders(runtime) {
|
|
|
2004
1980
|
});
|
|
2005
1981
|
setSpanAttrs(span, spanAttrs);
|
|
2006
1982
|
addUpstreamRequestIdSpanEvent(span, evt.upstreamRequestIdHash);
|
|
2007
|
-
span.setStatus({
|
|
1983
|
+
if (evt.type === "model.call.error") span.setStatus({
|
|
2008
1984
|
code: SpanStatusCode.ERROR,
|
|
2009
1985
|
message: redactSensitiveText(evt.errorCategory)
|
|
2010
1986
|
});
|
|
2011
1987
|
span.end(evt.ts);
|
|
2012
1988
|
};
|
|
2013
1989
|
return {
|
|
2014
|
-
recordModelCallSizeTimingMetrics,
|
|
2015
1990
|
recordModelCallStarted,
|
|
2016
|
-
|
|
2017
|
-
recordModelCallError
|
|
1991
|
+
recordModelCallFinished
|
|
2018
1992
|
};
|
|
2019
1993
|
}
|
|
2020
1994
|
//#endregion
|
|
@@ -2250,7 +2224,7 @@ function createOperationsRecorders(runtime) {
|
|
|
2250
2224
|
//#endregion
|
|
2251
2225
|
//#region extensions/diagnostics-otel/src/service-recorders-tools.ts
|
|
2252
2226
|
function createToolAndSystemRecorders(runtime) {
|
|
2253
|
-
const { gatewayEventLoopDelayMaxHistogram, gatewayEventLoopObservedCounter, queueDepthHistogram, skillUsedCounter, toolExecutionDurationHistogram, toolExecutionBlockedCounter, execProcessDurationHistogram, payloadLargeCounter, payloadLargeBytesHistogram, livenessWarningCounter, livenessEventLoopDelayP99Histogram, livenessEventLoopDelayMaxHistogram, livenessEventLoopUtilizationHistogram, livenessCpuCoreRatioHistogram, telemetryExporterCounter, spanWithDuration, activeTrustedParentContext, exportedInternalOrTrustedContext, trackTrustedSpan, getTrackedInternalOrTrustedSpan, takeTrackedTrustedSpan, setSpanAttrs, addRunAttrs, paramsSummaryAttrs, contentCapturePolicy, tracesEnabled } = runtime;
|
|
2227
|
+
const { gcDurationHistogram, gatewayEventLoopDelayMaxHistogram, gatewayEventLoopObservedCounter, queueDepthHistogram, skillUsedCounter, toolExecutionDurationHistogram, toolExecutionBlockedCounter, execProcessDurationHistogram, payloadLargeCounter, payloadLargeBytesHistogram, livenessWarningCounter, livenessEventLoopDelayP99Histogram, livenessEventLoopDelayMaxHistogram, livenessEventLoopUtilizationHistogram, livenessCpuCoreRatioHistogram, telemetryExporterCounter, spanWithDuration, activeTrustedParentContext, exportedInternalOrTrustedContext, trackTrustedSpan, getTrackedInternalOrTrustedSpan, takeTrackedTrustedSpan, setSpanAttrs, addRunAttrs, paramsSummaryAttrs, contentCapturePolicy, tracesEnabled } = runtime;
|
|
2254
2228
|
const toolExecutionBaseAttrs = (evt) => ({
|
|
2255
2229
|
"openclaw.toolName": evt.toolName,
|
|
2256
2230
|
"openclaw.tool.source": normalizeDiagnosticValue(evt.toolSource, "core"),
|
|
@@ -2291,39 +2265,22 @@ function createToolAndSystemRecorders(runtime) {
|
|
|
2291
2265
|
startTimeMs: toolTimestampMs(evt)
|
|
2292
2266
|
})).spanContext();
|
|
2293
2267
|
};
|
|
2294
|
-
const
|
|
2268
|
+
const recordToolExecutionFinished = (evt, metadata, toolContent) => {
|
|
2295
2269
|
const attrs = toolExecutionBaseAttrs(evt);
|
|
2270
|
+
if (evt.type === "tool.execution.error") attrs["openclaw.errorCategory"] = normalizeDiagnosticValue(evt.errorCategory, "other");
|
|
2296
2271
|
toolExecutionDurationHistogram.record(evt.durationMs, attrs);
|
|
2297
2272
|
if (!tracesEnabled) return;
|
|
2298
2273
|
const spanAttrs = { ...attrs };
|
|
2299
2274
|
addRunAttrs(spanAttrs, evt);
|
|
2300
2275
|
assignOtelToolIdentityAttributes(spanAttrs, evt);
|
|
2276
|
+
if (evt.type === "tool.execution.error" && evt.errorCode) spanAttrs["openclaw.errorCode"] = normalizeDiagnosticValue(evt.errorCode, "other");
|
|
2301
2277
|
assignOtelToolContentAttributes(spanAttrs, toolContent, contentCapturePolicy);
|
|
2302
2278
|
const span = takeTrackedTrustedSpan(evt, metadata) ?? spanWithDuration("openclaw.tool.execution", spanAttrs, evt.durationMs, {
|
|
2303
2279
|
parentContext: activeTrustedParentContext(evt, metadata),
|
|
2304
2280
|
endTimeMs: toolTimestampMs(evt)
|
|
2305
2281
|
});
|
|
2306
2282
|
setSpanAttrs(span, spanAttrs);
|
|
2307
|
-
span.
|
|
2308
|
-
};
|
|
2309
|
-
const recordToolExecutionError = (evt, metadata, toolContent) => {
|
|
2310
|
-
const attrs = {
|
|
2311
|
-
...toolExecutionBaseAttrs(evt),
|
|
2312
|
-
"openclaw.errorCategory": normalizeDiagnosticValue(evt.errorCategory, "other")
|
|
2313
|
-
};
|
|
2314
|
-
toolExecutionDurationHistogram.record(evt.durationMs, attrs);
|
|
2315
|
-
if (!tracesEnabled) return;
|
|
2316
|
-
const spanAttrs = { ...attrs };
|
|
2317
|
-
addRunAttrs(spanAttrs, evt);
|
|
2318
|
-
assignOtelToolIdentityAttributes(spanAttrs, evt);
|
|
2319
|
-
if (evt.errorCode) spanAttrs["openclaw.errorCode"] = normalizeDiagnosticValue(evt.errorCode, "other");
|
|
2320
|
-
assignOtelToolContentAttributes(spanAttrs, toolContent, contentCapturePolicy);
|
|
2321
|
-
const span = takeTrackedTrustedSpan(evt, metadata) ?? spanWithDuration("openclaw.tool.execution", spanAttrs, evt.durationMs, {
|
|
2322
|
-
parentContext: activeTrustedParentContext(evt, metadata),
|
|
2323
|
-
endTimeMs: toolTimestampMs(evt)
|
|
2324
|
-
});
|
|
2325
|
-
setSpanAttrs(span, spanAttrs);
|
|
2326
|
-
span.setStatus({
|
|
2283
|
+
if (evt.type === "tool.execution.error") span.setStatus({
|
|
2327
2284
|
code: SpanStatusCode.ERROR,
|
|
2328
2285
|
message: redactSensitiveText(evt.errorCategory)
|
|
2329
2286
|
});
|
|
@@ -2387,6 +2344,10 @@ function createToolAndSystemRecorders(runtime) {
|
|
|
2387
2344
|
});
|
|
2388
2345
|
span.end(evt.ts);
|
|
2389
2346
|
};
|
|
2347
|
+
const recordGcDuration = (evt, metadata) => {
|
|
2348
|
+
if (!metadata.trusted && !isInternalDiagnosticEventMetadata(metadata)) return;
|
|
2349
|
+
gcDurationHistogram.record(evt.durationMs, void 0, ROOT_CONTEXT);
|
|
2350
|
+
};
|
|
2390
2351
|
const recordGatewayEventLoopSample = (evt, metadata) => {
|
|
2391
2352
|
if (!metadata.trusted && !isInternalDiagnosticEventMetadata(metadata)) return;
|
|
2392
2353
|
gatewayEventLoopDelayMaxHistogram.record(evt.delayMaxMs, void 0, ROOT_CONTEXT);
|
|
@@ -2449,11 +2410,11 @@ function createToolAndSystemRecorders(runtime) {
|
|
|
2449
2410
|
});
|
|
2450
2411
|
};
|
|
2451
2412
|
return {
|
|
2413
|
+
recordGcDuration,
|
|
2452
2414
|
recordGatewayEventLoopSample,
|
|
2453
2415
|
recordSkillUsed,
|
|
2454
2416
|
recordToolExecutionStarted,
|
|
2455
|
-
|
|
2456
|
-
recordToolExecutionError,
|
|
2417
|
+
recordToolExecutionFinished,
|
|
2457
2418
|
recordToolExecutionBlocked,
|
|
2458
2419
|
recordPayloadLarge,
|
|
2459
2420
|
recordExecProcessCompleted,
|
|
@@ -3257,7 +3218,7 @@ function createDiagnosticsOtelService() {
|
|
|
3257
3218
|
recorders,
|
|
3258
3219
|
recordLogRecord,
|
|
3259
3220
|
recordSecurityEvent
|
|
3260
|
-
}), metricsActive ? void 0 : tracesActive ? { exclude: ["gateway.event_loop.sample"] } : { include: ["log.record", "security.event"] });
|
|
3221
|
+
}), metricsActive ? void 0 : tracesActive ? { exclude: ["gateway.event_loop.sample", "diagnostic.gc"] } : { include: ["log.record", "security.event"] });
|
|
3261
3222
|
if (tracesActive) active.unregisterTracePropagationBridge = ctx.internalDiagnostics?.registerTracePropagationBridge?.({
|
|
3262
3223
|
shouldPrepareEvent(event) {
|
|
3263
3224
|
return event.type === "model.call.started" || event.type === "tool.execution.started";
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createDiagnosticsOtelService } from "./runtime-api-
|
|
1
|
+
import { t as createDiagnosticsOtelService } from "./runtime-api-B9-DLHbi.js";
|
|
2
2
|
export { createDiagnosticsOtelService };
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diagnostics-otel",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.4",
|
|
4
4
|
"description": "OpenClaw diagnostics OpenTelemetry exporter for metrics, traces, and logs.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"minHostVersion": ">=2026.4.25"
|
|
35
35
|
},
|
|
36
36
|
"compat": {
|
|
37
|
-
"pluginApi": ">=2026.9.
|
|
37
|
+
"pluginApi": ">=2026.9.4"
|
|
38
38
|
},
|
|
39
39
|
"build": {
|
|
40
|
-
"openclawVersion": "2026.9.
|
|
40
|
+
"openclawVersion": "2026.9.4"
|
|
41
41
|
},
|
|
42
42
|
"release": {
|
|
43
43
|
"publishToClawHub": true,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"README.md"
|
|
54
54
|
],
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"openclaw": ">=2026.9.
|
|
56
|
+
"openclaw": ">=2026.9.4"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"openclaw": {
|