@openclaw/diagnostics-otel 2026.10.10-beta.5 → 2026.10.33
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.
|
@@ -153,13 +153,24 @@ function normalizeOtelErrorMessage(value) {
|
|
|
153
153
|
function hasPreloadedOtelSdk() {
|
|
154
154
|
return process.env[PRELOADED_OTEL_SDK_ENV] === "1";
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function createOtelContentRedactor() {
|
|
157
|
+
const redacted = /* @__PURE__ */ new Map();
|
|
158
|
+
return (value) => {
|
|
159
|
+
let result = redacted.get(value);
|
|
160
|
+
if (result === void 0) {
|
|
161
|
+
result = redactSensitiveText(value);
|
|
162
|
+
redacted.set(value, result);
|
|
163
|
+
}
|
|
164
|
+
return result;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function normalizeOtelContentValue(value, redact) {
|
|
157
168
|
if (typeof value === "string") return normalizeOtelLogString(value, MAX_OTEL_CONTENT_ATTRIBUTE_CHARS);
|
|
158
169
|
if (Array.isArray(value)) {
|
|
159
170
|
const items = value.slice(0, 200).filter((item) => typeof item === "string");
|
|
160
171
|
if (items.length > 0) return normalizeOtelLogString(items.join("\n"), MAX_OTEL_CONTENT_ATTRIBUTE_CHARS);
|
|
161
172
|
}
|
|
162
|
-
return safeJsonString(value);
|
|
173
|
+
return safeJsonString(value, redact);
|
|
163
174
|
}
|
|
164
175
|
const TRUNCATED_JSON_TEXT_SUFFIX = "...(truncated)";
|
|
165
176
|
const JSON_TRUNCATION_STRING_BUDGETS = [
|
|
@@ -184,34 +195,38 @@ const JSON_TRUNCATION_ARRAY_ITEM_BUDGETS = [
|
|
|
184
195
|
];
|
|
185
196
|
const JSON_TRUNCATION_MAX_OBJECT_FIELDS = 64;
|
|
186
197
|
const JSON_TRUNCATION_MAX_DEPTH = 8;
|
|
187
|
-
|
|
198
|
+
const MAX_OTEL_REDACTED_JSON_CANDIDATE_CHARS = 4 * MAX_OTEL_CONTENT_ATTRIBUTE_CHARS;
|
|
199
|
+
function safeJsonString(value, redact = createOtelContentRedactor()) {
|
|
188
200
|
if (value === void 0 || typeof value === "function" || typeof value === "symbol") return;
|
|
189
|
-
const
|
|
190
|
-
|
|
201
|
+
const json = serializeJsonForOtelAttribute(value);
|
|
202
|
+
const exact = json && json.length <= MAX_OTEL_REDACTED_JSON_CANDIDATE_CHARS ? redactJsonWithinAttributeBudget(serializeJsonForOtelAttribute(value, redact)) : void 0;
|
|
203
|
+
if (exact) return exact;
|
|
191
204
|
for (const maxArrayItems of JSON_TRUNCATION_ARRAY_ITEM_BUDGETS) for (const maxStringChars of JSON_TRUNCATION_STRING_BUDGETS) {
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
205
|
+
const truncated = redactJsonWithinAttributeBudget(serializeJsonForOtelAttribute(truncateJsonValueForOtelAttribute(value, maxArrayItems, maxStringChars, redact)));
|
|
206
|
+
if (truncated) return truncated;
|
|
194
207
|
}
|
|
195
|
-
|
|
208
|
+
return redactJsonWithinAttributeBudget(serializeJsonForOtelAttribute({
|
|
196
209
|
truncated: true,
|
|
197
|
-
reason:
|
|
210
|
+
reason: json ? "max_attribute_size" : "unserializable_value",
|
|
198
211
|
type: describeJsonValue(value)
|
|
199
|
-
});
|
|
200
|
-
return summary && summary.length <= MAX_OTEL_CONTENT_ATTRIBUTE_CHARS ? summary : void 0;
|
|
212
|
+
}));
|
|
201
213
|
}
|
|
202
|
-
function
|
|
214
|
+
function serializeJsonForOtelAttribute(value, redact) {
|
|
203
215
|
try {
|
|
204
|
-
|
|
205
|
-
if (!json) return;
|
|
206
|
-
return redactSensitiveText(json);
|
|
216
|
+
return JSON.stringify(value, redact ? (_key, field) => typeof field === "string" ? redact(field) : field : void 0) || void 0;
|
|
207
217
|
} catch {
|
|
208
218
|
return;
|
|
209
219
|
}
|
|
210
220
|
}
|
|
211
|
-
function
|
|
221
|
+
function redactJsonWithinAttributeBudget(json) {
|
|
222
|
+
if (!json || json.length > MAX_OTEL_REDACTED_JSON_CANDIDATE_CHARS) return;
|
|
223
|
+
const redacted = redactSensitiveText(json);
|
|
224
|
+
return redacted.length <= 131072 ? redacted : void 0;
|
|
225
|
+
}
|
|
226
|
+
function truncateJsonValueForOtelAttribute(input, maxArrayItems, maxStringChars, redact) {
|
|
212
227
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
213
228
|
function visit(value, depth) {
|
|
214
|
-
if (typeof value === "string" || typeof value === "bigint") return truncateJsonTextForOtelAttribute(String(value), maxStringChars);
|
|
229
|
+
if (typeof value === "string" || typeof value === "bigint") return truncateJsonTextForOtelAttribute(redact(String(value)), maxStringChars);
|
|
215
230
|
if (typeof value === "number" || typeof value === "boolean" || value === null) return value;
|
|
216
231
|
if (typeof value !== "object") return;
|
|
217
232
|
if (depth <= 0) return {
|
|
@@ -249,8 +264,7 @@ function truncateJsonValueForOtelAttribute(input, maxArrayItems, maxStringChars)
|
|
|
249
264
|
}
|
|
250
265
|
return visit(input, JSON_TRUNCATION_MAX_DEPTH);
|
|
251
266
|
}
|
|
252
|
-
function truncateJsonTextForOtelAttribute(
|
|
253
|
-
const redacted = redactSensitiveText(value);
|
|
267
|
+
function truncateJsonTextForOtelAttribute(redacted, maxChars) {
|
|
254
268
|
if (redacted.length <= maxChars) return redacted;
|
|
255
269
|
const suffixBudget = Math.min(14, maxChars);
|
|
256
270
|
const prefixBudget = Math.max(0, maxChars - suffixBudget);
|
|
@@ -1053,6 +1067,7 @@ function redactInternalReasoningParts(value) {
|
|
|
1053
1067
|
if (!isRecord(part)) return part;
|
|
1054
1068
|
const redacted = { ...part };
|
|
1055
1069
|
for (const field of INTERNAL_REASONING_PART_FIELDS) delete redacted[field];
|
|
1070
|
+
if (part.type === "image" && typeof redacted.data === "string" && redacted.data.length > 131072) delete redacted.data;
|
|
1056
1071
|
return redacted;
|
|
1057
1072
|
});
|
|
1058
1073
|
}
|
|
@@ -1121,12 +1136,12 @@ function normalizeGenAiToolDefinitions(value) {
|
|
|
1121
1136
|
}
|
|
1122
1137
|
return definitions;
|
|
1123
1138
|
}
|
|
1124
|
-
function assignJsonAttribute(attributes, key, value) {
|
|
1125
|
-
const json = safeJsonString(value);
|
|
1139
|
+
function assignJsonAttribute(attributes, key, value, redact) {
|
|
1140
|
+
const json = safeJsonString(value, redact);
|
|
1126
1141
|
if (json) attributes[key] = json;
|
|
1127
1142
|
}
|
|
1128
|
-
function assignOtelContentAttribute(attributes, key, value) {
|
|
1129
|
-
const normalized = normalizeOtelContentValue(value);
|
|
1143
|
+
function assignOtelContentAttribute(attributes, key, value, redact) {
|
|
1144
|
+
const normalized = normalizeOtelContentValue(value, redact);
|
|
1130
1145
|
if (normalized) attributes[key] = normalized;
|
|
1131
1146
|
}
|
|
1132
1147
|
function assignOtelToolIdentityAttributes(attributes, evt) {
|
|
@@ -1136,25 +1151,26 @@ function assignOtelToolIdentityAttributes(attributes, evt) {
|
|
|
1136
1151
|
}
|
|
1137
1152
|
function assignOtelModelContentAttributes(attributes, content, captureContent) {
|
|
1138
1153
|
if (!captureContent) return;
|
|
1154
|
+
const redact = createOtelContentRedactor();
|
|
1139
1155
|
const redactedInput = redactInternalReasoningFromMessages(content?.inputMessages);
|
|
1140
1156
|
const redactedOutput = redactInternalReasoningFromMessages(content?.outputMessages);
|
|
1141
1157
|
const inputMessages = normalizeGenAiMessages(redactedInput, "user");
|
|
1142
1158
|
if (inputMessages.length > 0) {
|
|
1143
|
-
assignJsonAttribute(attributes, ATTR_GEN_AI_INPUT_MESSAGES, inputMessages);
|
|
1144
|
-
|
|
1159
|
+
assignJsonAttribute(attributes, ATTR_GEN_AI_INPUT_MESSAGES, inputMessages, redact);
|
|
1160
|
+
if (attributes[ATTR_GEN_AI_INPUT_MESSAGES] !== void 0) attributes["input.value"] = attributes[ATTR_GEN_AI_INPUT_MESSAGES];
|
|
1145
1161
|
attributes["input.mime_type"] = "application/json";
|
|
1146
1162
|
}
|
|
1147
1163
|
const toolDefinitions = normalizeGenAiToolDefinitions(content?.toolDefinitions);
|
|
1148
|
-
if (toolDefinitions.length > 0) assignJsonAttribute(attributes, ATTR_GEN_AI_TOOL_DEFINITIONS, toolDefinitions);
|
|
1164
|
+
if (toolDefinitions.length > 0) assignJsonAttribute(attributes, ATTR_GEN_AI_TOOL_DEFINITIONS, toolDefinitions, redact);
|
|
1149
1165
|
const outputMessages = normalizeGenAiMessages(redactedOutput, "assistant");
|
|
1150
1166
|
if (outputMessages.length > 0) {
|
|
1151
|
-
assignJsonAttribute(attributes, ATTR_GEN_AI_OUTPUT_MESSAGES, outputMessages);
|
|
1152
|
-
|
|
1167
|
+
assignJsonAttribute(attributes, ATTR_GEN_AI_OUTPUT_MESSAGES, outputMessages, redact);
|
|
1168
|
+
if (attributes[ATTR_GEN_AI_OUTPUT_MESSAGES] !== void 0) attributes["output.value"] = attributes[ATTR_GEN_AI_OUTPUT_MESSAGES];
|
|
1153
1169
|
attributes["output.mime_type"] = "application/json";
|
|
1154
1170
|
}
|
|
1155
|
-
assignOtelContentAttribute(attributes, "openclaw.content.input_messages", redactedInput);
|
|
1156
|
-
assignOtelContentAttribute(attributes, "openclaw.content.tool_definitions", content?.toolDefinitions);
|
|
1157
|
-
assignOtelContentAttribute(attributes, "openclaw.content.output_messages", redactedOutput);
|
|
1171
|
+
assignOtelContentAttribute(attributes, "openclaw.content.input_messages", redactedInput, redact);
|
|
1172
|
+
assignOtelContentAttribute(attributes, "openclaw.content.tool_definitions", content?.toolDefinitions, redact);
|
|
1173
|
+
assignOtelContentAttribute(attributes, "openclaw.content.output_messages", redactedOutput, redact);
|
|
1158
1174
|
}
|
|
1159
1175
|
function assignOtelToolContentAttributes(attributes, content, captureContent) {
|
|
1160
1176
|
if (!captureContent) return;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createDiagnosticsOtelService } from "./.setup/runtime-api-
|
|
1
|
+
import { t as createDiagnosticsOtelService } from "./.setup/runtime-api-CKuEF9bs.mjs";
|
|
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({
|
package/dist/runtime-api.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as createDiagnosticsOtelService } from "./.setup/runtime-api-CKuEF9bs.mjs";
|
|
2
|
+
export { createDiagnosticsOtelService };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/diagnostics-otel",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.33",
|
|
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.
|
|
37
|
+
"pluginApi": ">=2026.11.4"
|
|
38
38
|
},
|
|
39
39
|
"build": {
|
|
40
|
-
"openclawVersion": "2026.10.
|
|
40
|
+
"openclawVersion": "2026.10.33"
|
|
41
41
|
},
|
|
42
42
|
"release": {
|
|
43
43
|
"publishToClawHub": true,
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"assets/activity.svg"
|
|
56
56
|
],
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"openclaw": ">=2026.
|
|
58
|
+
"openclaw": ">=2026.11.4"
|
|
59
59
|
},
|
|
60
60
|
"peerDependenciesMeta": {
|
|
61
61
|
"openclaw": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"entries":[{"output":"api.js","source":"extensions/diagnostics-otel/api.ts"},{"output":"index.js","source":"extensions/diagnostics-otel/index.ts"},{"output":"runtime-api.js","source":"extensions/diagnostics-otel/runtime-api.ts"}],"chunks":[{"output":".setup/runtime-api-CDJYKu2B.mjs","sha256":"50c089eba3eaccd9c8ce3eb9dc74f33be4b99dc54d850d4e6d9ec9349411e4a8","facadeSource":null,"sources":["extensions/diagnostics-otel/src/service-attributes.ts","extensions/diagnostics-otel/src/service-constants.ts","extensions/diagnostics-otel/src/service-content-normalization.ts","extensions/diagnostics-otel/src/service-events.ts","extensions/diagnostics-otel/src/service-exporter-health.ts","extensions/diagnostics-otel/src/service-exporter.ts","extensions/diagnostics-otel/src/service-genai-attributes.ts","extensions/diagnostics-otel/src/service-genai-content.ts","extensions/diagnostics-otel/src/service-logs.ts","extensions/diagnostics-otel/src/service-metrics.ts","extensions/diagnostics-otel/src/service-propagation.ts","extensions/diagnostics-otel/src/service-recorders-harness.ts","extensions/diagnostics-otel/src/service-recorders-model.ts","extensions/diagnostics-otel/src/service-recorders-operations.ts","extensions/diagnostics-otel/src/service-recorders-tools.ts","extensions/diagnostics-otel/src/service-recorders-usage.ts","extensions/diagnostics-otel/src/service-trace-context.ts","extensions/diagnostics-otel/src/service-traces.ts","extensions/diagnostics-otel/src/service.ts"]},{"output":"api.js","sha256":"605d6cf4480221a3ccac6ae6f372770ddff3ca620ff9688c2e669643ee4525c4","facadeSource":"extensions/diagnostics-otel/api.ts","sources":[]},{"output":"index.js","sha256":"b7e7c96511ca6cc60d2e25b37b4ffda37301d1fce59fff044253ce24cef4acf0","facadeSource":"extensions/diagnostics-otel/index.ts","sources":["extensions/diagnostics-otel/index.ts"]},{"output":"runtime-api.js","sha256":"f0120a14dddc2636bbc455bbfe81c29b63cb77e75ba57fd9cf996d8a86de7295","facadeSource":"extensions/diagnostics-otel/runtime-api.ts","sources":[]}],"unrenderedSources":["extensions/diagnostics-otel/api.ts","extensions/diagnostics-otel/runtime-api.ts"]}
|