@openclaw/diagnostics-otel 2026.8.1 → 2026.8.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.
@@ -1,4 +1,4 @@
1
- import { isValidDiagnosticSpanId, isValidDiagnosticTraceFlags, isValidDiagnosticTraceId, redactSensitiveText } from "./api.js";
1
+ import { isValidDiagnosticSpanId, isValidDiagnosticTraceFlags, isValidDiagnosticTraceId, redactSensitiveText } from "../api.js";
2
2
  import { ROOT_CONTEXT, SpanKind, SpanStatusCode, TraceFlags, context, createContextKey, diag, isSpanContextValid, metrics, propagation, trace } from "@opentelemetry/api";
3
3
  import * as otelCore from "@opentelemetry/core";
4
4
  import { CompositePropagator, ExportResultCode, W3CBaggagePropagator, W3CTraceContextPropagator, getStringListFromEnv } from "@opentelemetry/core";
@@ -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 = 4 * 1024;
49
- const MAX_OTEL_LOG_ATTRIBUTE_VALUE_CHARS = 4 * 1024;
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 = 128 * 1024;
149
- const MAX_OTEL_ERROR_MESSAGE_CHARS = 4 * 1024;
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
- return `${truncateUtf16Safe(redacted, Math.max(0, maxChars - suffixBudget))}${TRUNCATED_JSON_TEXT_SUFFIX.slice(14 - suffixBudget)}`;
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";
@@ -914,19 +915,21 @@ function createDiagnosticsLogExporter(params) {
914
915
  let otelLogger;
915
916
  const activeTransports = [...logsToOtlp ? ["otlp-http-protobuf"] : [], ...logsToStdout ? ["stdout"] : []];
916
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
+ });
917
930
  logProvider = new LoggerProvider({
918
931
  resource,
919
- processors: [new BatchLogRecordProcessor({
920
- exporter: observeOtlpExporterHealth(new OTLPLogExporter({
921
- ...logUrl ? { url: logUrl } : {},
922
- ...headers ? { headers } : {},
923
- ...logHttpAgentOptions ? { httpAgentOptions: logHttpAgentOptions } : {}
924
- }), {
925
- emitExporterEvent,
926
- signal: "logs"
927
- }),
928
- ...typeof flushIntervalMs === "number" ? { scheduledDelayMillis: Math.max(1e3, flushIntervalMs) } : {}
929
- })]
932
+ processors: [logProcessor]
930
933
  });
931
934
  otelLogger = logProvider.getLogger("openclaw");
932
935
  }
@@ -1792,7 +1795,10 @@ function assignJsonAttribute(attributes, key, value) {
1792
1795
  if (json) attributes[key] = json;
1793
1796
  }
1794
1797
  function assignGenAiModelContentAttributes(attributes, content, policy) {
1795
- if (policy.systemPrompt && typeof content?.systemPrompt === "string") assignJsonAttribute(attributes, ATTR_GEN_AI_SYSTEM_INSTRUCTIONS, [textPart(content.systemPrompt)]);
1798
+ if (policy.systemPrompt && typeof content?.systemPrompt === "string") {
1799
+ const systemInstructions = [textPart(content.systemPrompt)];
1800
+ assignJsonAttribute(attributes, ATTR_GEN_AI_SYSTEM_INSTRUCTIONS, systemInstructions);
1801
+ }
1796
1802
  if (policy.inputMessages) {
1797
1803
  const inputMessages = normalizeGenAiMessages(content?.inputMessages, "user");
1798
1804
  if (inputMessages.length > 0) {
@@ -3115,15 +3121,16 @@ function createDiagnosticsOtelService() {
3115
3121
  }) : void 0;
3116
3122
  if (traceExporter) {
3117
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
+ });
3118
3131
  traceProvider = new BasicTracerProvider({
3119
3132
  resource: detectedResource,
3120
- spanProcessors: [new BatchSpanProcessor(traceExporter, {
3121
- maxQueueSize,
3122
- maxExportBatchSize: Math.min(readPositiveOtelNumber("OTEL_BSP_MAX_EXPORT_BATCH_SIZE", 512), maxQueueSize),
3123
- scheduledDelayMillis: typeof otel.flushIntervalMs === "number" ? Math.max(1e3, otel.flushIntervalMs) : readPositiveOtelNumber("OTEL_BSP_SCHEDULE_DELAY", 5e3),
3124
- exportTimeoutMillis: readPositiveOtelNumber("OTEL_BSP_EXPORT_TIMEOUT", 3e4),
3125
- ...sdkMetricsEnabled && meterProvider ? { selfObsMeterProvider: meterProvider } : {}
3126
- })],
3133
+ spanProcessors: [spanProcessor],
3127
3134
  ...sampleRate !== void 0 ? { sampler: new ParentBasedSampler({ root: new TraceIdRatioBasedSampler(sampleRate) }) } : {},
3128
3135
  ...sdkMetricsEnabled && meterProvider ? { meterProvider } : {}
3129
3136
  });
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createDiagnosticsOtelService } from "./runtime-api-DYYOitFJ.js";
1
+ import { t as createDiagnosticsOtelService } from "./.setup/runtime-api-Aqqi08bK.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({
@@ -1,2 +1,2 @@
1
- import { t as createDiagnosticsOtelService } from "./runtime-api-DYYOitFJ.js";
1
+ import { t as createDiagnosticsOtelService } from "./.setup/runtime-api-Aqqi08bK.mjs";
2
2
  export { createDiagnosticsOtelService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/diagnostics-otel",
3
- "version": "2026.8.1",
3
+ "version": "2026.8.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.8.1"
37
+ "pluginApi": ">=2026.8.33"
38
38
  },
39
39
  "build": {
40
- "openclawVersion": "2026.8.1"
40
+ "openclawVersion": "2026.8.33"
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.1"
56
+ "openclaw": ">=2026.8.33"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "openclaw": {