@openclaw/diagnostics-otel 2026.8.1-beta.3 → 2026.8.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/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Restart the Gateway after installing or updating the plugin.
|
|
|
14
14
|
|
|
15
15
|
## Configure
|
|
16
16
|
|
|
17
|
-
Enable the plugin and set the
|
|
17
|
+
Enable the plugin, set `diagnostics.otel.enabled` to `true`, and set the collector URL in `diagnostics.otel.endpoint`.
|
|
18
18
|
|
|
19
19
|
The full config surface, metric names, span names, and collector examples live in the docs:
|
|
20
20
|
|
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-DaBnxBEO.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({
|
|
@@ -45,8 +45,8 @@ const DROPPED_OTEL_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
|
|
|
45
45
|
"openclaw.trace_id"
|
|
46
46
|
]);
|
|
47
47
|
const SECURITY_TARGET_NAME_VALUE_RE = /^[A-Za-z0-9@/_.:-]{1,256}$/u;
|
|
48
|
-
const MAX_OTEL_LOG_BODY_CHARS =
|
|
49
|
-
const MAX_OTEL_LOG_ATTRIBUTE_VALUE_CHARS =
|
|
48
|
+
const MAX_OTEL_LOG_BODY_CHARS = 4096;
|
|
49
|
+
const MAX_OTEL_LOG_ATTRIBUTE_VALUE_CHARS = 4096;
|
|
50
50
|
const OTEL_LOG_RAW_ATTRIBUTE_KEY_RE = /^[A-Za-z0-9_.:-]{1,64}$/u;
|
|
51
51
|
const OTEL_LOG_ATTRIBUTE_KEY_RE = /^[A-Za-z0-9_.:-]{1,96}$/u;
|
|
52
52
|
const BLOCKED_OTEL_LOG_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -145,8 +145,8 @@ const CONTEXT_TOKENS_BUCKETS = [
|
|
|
145
145
|
const MAX_RETAINED_TRUSTED_SPAN_CONTEXTS = 1024;
|
|
146
146
|
//#endregion
|
|
147
147
|
//#region extensions/diagnostics-otel/src/service-content-normalization.ts
|
|
148
|
-
const MAX_OTEL_CONTENT_ATTRIBUTE_CHARS =
|
|
149
|
-
const MAX_OTEL_ERROR_MESSAGE_CHARS =
|
|
148
|
+
const MAX_OTEL_CONTENT_ATTRIBUTE_CHARS = 131072;
|
|
149
|
+
const MAX_OTEL_ERROR_MESSAGE_CHARS = 4096;
|
|
150
150
|
const PRELOADED_OTEL_SDK_ENV = "OPENCLAW_OTEL_PRELOADED";
|
|
151
151
|
const NO_CONTENT_CAPTURE = {
|
|
152
152
|
inputMessages: false,
|
|
@@ -298,7 +298,8 @@ function truncateJsonTextForOtelAttribute(value, maxChars) {
|
|
|
298
298
|
const redacted = redactSensitiveText(value);
|
|
299
299
|
if (redacted.length <= maxChars) return redacted;
|
|
300
300
|
const suffixBudget = Math.min(14, maxChars);
|
|
301
|
-
|
|
301
|
+
const prefixBudget = Math.max(0, maxChars - suffixBudget);
|
|
302
|
+
return `${truncateUtf16Safe(redacted, prefixBudget)}${TRUNCATED_JSON_TEXT_SUFFIX.slice(14 - suffixBudget)}`;
|
|
302
303
|
}
|
|
303
304
|
function describeJsonValue(value) {
|
|
304
305
|
if (Array.isArray(value)) return "array";
|
|
@@ -308,8 +309,7 @@ function describeJsonValue(value) {
|
|
|
308
309
|
//#endregion
|
|
309
310
|
//#region extensions/diagnostics-otel/src/service-exporter.ts
|
|
310
311
|
function normalizeEndpoint(endpoint) {
|
|
311
|
-
|
|
312
|
-
return trimmed ? trimmed.replace(/\/+$/, "") : void 0;
|
|
312
|
+
return endpoint?.trim() || void 0;
|
|
313
313
|
}
|
|
314
314
|
const SIGNAL_QUALIFIED_OTLP_PATH_PATTERN = /\/v1\/(traces|metrics|logs)$/iu;
|
|
315
315
|
function appendOrReplaceSignalPath(value, path) {
|
|
@@ -317,9 +317,11 @@ function appendOrReplaceSignalPath(value, path) {
|
|
|
317
317
|
return SIGNAL_QUALIFIED_OTLP_PATH_PATTERN.test(base) ? base.replace(SIGNAL_QUALIFIED_OTLP_PATH_PATTERN, `/${path}`) : `${base}/${path}`;
|
|
318
318
|
}
|
|
319
319
|
function resolveSharedOtelUrl(endpoint, path) {
|
|
320
|
-
const
|
|
320
|
+
const endpointWithoutQueryOrFragment = endpoint.split(/[?#]/, 1)[0] ?? endpoint;
|
|
321
|
+
const base = endpointWithoutQueryOrFragment.replace(/\/+$/u, "");
|
|
322
|
+
const matchedSignal = base.match(SIGNAL_QUALIFIED_OTLP_PATH_PATTERN)?.[1];
|
|
321
323
|
const requestedSignal = path.slice(path.lastIndexOf("/") + 1);
|
|
322
|
-
if (matchedSignal?.toLowerCase() === requestedSignal.toLowerCase()) return endpoint;
|
|
324
|
+
if (matchedSignal?.toLowerCase() === requestedSignal.toLowerCase()) return endpoint === endpointWithoutQueryOrFragment ? base : endpoint;
|
|
323
325
|
if (/[?#]/u.test(endpoint)) {
|
|
324
326
|
const url = new URL(endpoint);
|
|
325
327
|
url.pathname = appendOrReplaceSignalPath(url.pathname, path);
|
|
@@ -327,11 +329,8 @@ function resolveSharedOtelUrl(endpoint, path) {
|
|
|
327
329
|
}
|
|
328
330
|
return appendOrReplaceSignalPath(endpoint, path);
|
|
329
331
|
}
|
|
330
|
-
function normalizeSignalEndpoint(endpoint) {
|
|
331
|
-
return endpoint?.trim() || void 0;
|
|
332
|
-
}
|
|
333
332
|
function resolveSignalOtelUrl(params) {
|
|
334
|
-
const signalEndpoint =
|
|
333
|
+
const signalEndpoint = normalizeEndpoint(params.signalEndpoint ?? params.signalEnvEndpoint);
|
|
335
334
|
const endpoint = signalEndpoint ?? params.endpoint;
|
|
336
335
|
const signalEnvEndpoint = params.signalEnvEndpoint?.trim() ? params.signalEnvEndpoint : void 0;
|
|
337
336
|
const sharedEnvEndpoint = params.sharedEnvEndpoint?.trim() ? params.sharedEnvEndpoint : void 0;
|
|
@@ -916,19 +915,21 @@ function createDiagnosticsLogExporter(params) {
|
|
|
916
915
|
let otelLogger;
|
|
917
916
|
const activeTransports = [...logsToOtlp ? ["otlp-http-protobuf"] : [], ...logsToStdout ? ["stdout"] : []];
|
|
918
917
|
if (logsToOtlp) {
|
|
918
|
+
const logExporter = observeOtlpExporterHealth(new OTLPLogExporter({
|
|
919
|
+
...logUrl ? { url: logUrl } : {},
|
|
920
|
+
...headers ? { headers } : {},
|
|
921
|
+
...logHttpAgentOptions ? { httpAgentOptions: logHttpAgentOptions } : {}
|
|
922
|
+
}), {
|
|
923
|
+
emitExporterEvent,
|
|
924
|
+
signal: "logs"
|
|
925
|
+
});
|
|
926
|
+
const logProcessor = new BatchLogRecordProcessor({
|
|
927
|
+
exporter: logExporter,
|
|
928
|
+
...typeof flushIntervalMs === "number" ? { scheduledDelayMillis: Math.max(1e3, flushIntervalMs) } : {}
|
|
929
|
+
});
|
|
919
930
|
logProvider = new LoggerProvider({
|
|
920
931
|
resource,
|
|
921
|
-
processors: [
|
|
922
|
-
exporter: observeOtlpExporterHealth(new OTLPLogExporter({
|
|
923
|
-
...logUrl ? { url: logUrl } : {},
|
|
924
|
-
...headers ? { headers } : {},
|
|
925
|
-
...logHttpAgentOptions ? { httpAgentOptions: logHttpAgentOptions } : {}
|
|
926
|
-
}), {
|
|
927
|
-
emitExporterEvent,
|
|
928
|
-
signal: "logs"
|
|
929
|
-
}),
|
|
930
|
-
...typeof flushIntervalMs === "number" ? { scheduledDelayMillis: Math.max(1e3, flushIntervalMs) } : {}
|
|
931
|
-
})]
|
|
932
|
+
processors: [logProcessor]
|
|
932
933
|
});
|
|
933
934
|
otelLogger = logProvider.getLogger("openclaw");
|
|
934
935
|
}
|
|
@@ -1680,13 +1681,7 @@ function contentParts(value) {
|
|
|
1680
1681
|
if (!isRecord(part)) continue;
|
|
1681
1682
|
const text = textPartContent(part);
|
|
1682
1683
|
if (text !== void 0) parts.push(textPart(text));
|
|
1683
|
-
else if (part.type === "toolCall" && typeof part.name === "string") parts.push({
|
|
1684
|
-
type: "tool_call",
|
|
1685
|
-
name: part.name,
|
|
1686
|
-
...typeof part.id === "string" ? { id: part.id } : {},
|
|
1687
|
-
...part.arguments !== void 0 ? { arguments: part.arguments } : {}
|
|
1688
|
-
});
|
|
1689
|
-
else if (part.type === "tool_call" && typeof part.name === "string") parts.push({
|
|
1684
|
+
else if ((part.type === "toolCall" || part.type === "tool_call") && typeof part.name === "string") parts.push({
|
|
1690
1685
|
type: "tool_call",
|
|
1691
1686
|
name: part.name,
|
|
1692
1687
|
...typeof part.id === "string" ? { id: part.id } : {},
|
|
@@ -1800,7 +1795,10 @@ function assignJsonAttribute(attributes, key, value) {
|
|
|
1800
1795
|
if (json) attributes[key] = json;
|
|
1801
1796
|
}
|
|
1802
1797
|
function assignGenAiModelContentAttributes(attributes, content, policy) {
|
|
1803
|
-
if (policy.systemPrompt && typeof content?.systemPrompt === "string")
|
|
1798
|
+
if (policy.systemPrompt && typeof content?.systemPrompt === "string") {
|
|
1799
|
+
const systemInstructions = [textPart(content.systemPrompt)];
|
|
1800
|
+
assignJsonAttribute(attributes, ATTR_GEN_AI_SYSTEM_INSTRUCTIONS, systemInstructions);
|
|
1801
|
+
}
|
|
1804
1802
|
if (policy.inputMessages) {
|
|
1805
1803
|
const inputMessages = normalizeGenAiMessages(content?.inputMessages, "user");
|
|
1806
1804
|
if (inputMessages.length > 0) {
|
|
@@ -3123,15 +3121,16 @@ function createDiagnosticsOtelService() {
|
|
|
3123
3121
|
}) : void 0;
|
|
3124
3122
|
if (traceExporter) {
|
|
3125
3123
|
const maxQueueSize = readPositiveOtelNumber("OTEL_BSP_MAX_QUEUE_SIZE", 2048);
|
|
3124
|
+
const spanProcessor = new BatchSpanProcessor(traceExporter, {
|
|
3125
|
+
maxQueueSize,
|
|
3126
|
+
maxExportBatchSize: Math.min(readPositiveOtelNumber("OTEL_BSP_MAX_EXPORT_BATCH_SIZE", 512), maxQueueSize),
|
|
3127
|
+
scheduledDelayMillis: typeof otel.flushIntervalMs === "number" ? Math.max(1e3, otel.flushIntervalMs) : readPositiveOtelNumber("OTEL_BSP_SCHEDULE_DELAY", 5e3),
|
|
3128
|
+
exportTimeoutMillis: readPositiveOtelNumber("OTEL_BSP_EXPORT_TIMEOUT", 3e4),
|
|
3129
|
+
...sdkMetricsEnabled && meterProvider ? { selfObsMeterProvider: meterProvider } : {}
|
|
3130
|
+
});
|
|
3126
3131
|
traceProvider = new BasicTracerProvider({
|
|
3127
3132
|
resource: detectedResource,
|
|
3128
|
-
spanProcessors: [
|
|
3129
|
-
maxQueueSize,
|
|
3130
|
-
maxExportBatchSize: Math.min(readPositiveOtelNumber("OTEL_BSP_MAX_EXPORT_BATCH_SIZE", 512), maxQueueSize),
|
|
3131
|
-
scheduledDelayMillis: typeof otel.flushIntervalMs === "number" ? Math.max(1e3, otel.flushIntervalMs) : readPositiveOtelNumber("OTEL_BSP_SCHEDULE_DELAY", 5e3),
|
|
3132
|
-
exportTimeoutMillis: readPositiveOtelNumber("OTEL_BSP_EXPORT_TIMEOUT", 3e4),
|
|
3133
|
-
...sdkMetricsEnabled && meterProvider ? { selfObsMeterProvider: meterProvider } : {}
|
|
3134
|
-
})],
|
|
3133
|
+
spanProcessors: [spanProcessor],
|
|
3135
3134
|
...sampleRate !== void 0 ? { sampler: new ParentBasedSampler({ root: new TraceIdRatioBasedSampler(sampleRate) }) } : {},
|
|
3136
3135
|
...sdkMetricsEnabled && meterProvider ? { meterProvider } : {}
|
|
3137
3136
|
});
|
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-DaBnxBEO.js";
|
|
2
2
|
export { createDiagnosticsOtelService };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diagnostics-otel",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.2",
|
|
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.8.
|
|
37
|
+
"pluginApi": ">=2026.8.2"
|
|
38
38
|
},
|
|
39
39
|
"build": {
|
|
40
|
-
"openclawVersion": "2026.8.
|
|
40
|
+
"openclawVersion": "2026.8.2"
|
|
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.8.
|
|
56
|
+
"openclaw": ">=2026.8.2"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"openclaw": {
|