@openclaw/diagnostics-otel 2026.3.2 → 2026.3.8-beta.1

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/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
2
- import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
1
+ import type { OpenClawPluginApi } from "openclaw/plugin-sdk/diagnostics-otel";
2
+ import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/diagnostics-otel";
3
3
  import { createDiagnosticsOtelService } from "./src/service.js";
4
4
 
5
5
  const plugin = {
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@openclaw/diagnostics-otel",
3
- "version": "2026.3.2",
3
+ "version": "2026.3.8-beta.1",
4
4
  "description": "OpenClaw diagnostics OpenTelemetry exporter",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@opentelemetry/api": "^1.9.0",
8
- "@opentelemetry/api-logs": "^0.212.0",
9
- "@opentelemetry/exporter-logs-otlp-proto": "^0.212.0",
10
- "@opentelemetry/exporter-metrics-otlp-proto": "^0.212.0",
11
- "@opentelemetry/exporter-trace-otlp-proto": "^0.212.0",
12
- "@opentelemetry/resources": "^2.5.1",
13
- "@opentelemetry/sdk-logs": "^0.212.0",
14
- "@opentelemetry/sdk-metrics": "^2.5.1",
15
- "@opentelemetry/sdk-node": "^0.212.0",
16
- "@opentelemetry/sdk-trace-base": "^2.5.1",
8
+ "@opentelemetry/api-logs": "^0.213.0",
9
+ "@opentelemetry/exporter-logs-otlp-proto": "^0.213.0",
10
+ "@opentelemetry/exporter-metrics-otlp-proto": "^0.213.0",
11
+ "@opentelemetry/exporter-trace-otlp-proto": "^0.213.0",
12
+ "@opentelemetry/resources": "^2.6.0",
13
+ "@opentelemetry/sdk-logs": "^0.213.0",
14
+ "@opentelemetry/sdk-metrics": "^2.6.0",
15
+ "@opentelemetry/sdk-node": "^0.213.0",
16
+ "@opentelemetry/sdk-trace-base": "^2.6.0",
17
17
  "@opentelemetry/semantic-conventions": "^1.40.0"
18
18
  },
19
19
  "openclaw": {
@@ -98,16 +98,18 @@ vi.mock("@opentelemetry/semantic-conventions", () => ({
98
98
  ATTR_SERVICE_NAME: "service.name",
99
99
  }));
100
100
 
101
- vi.mock("openclaw/plugin-sdk", async () => {
102
- const actual = await vi.importActual<typeof import("openclaw/plugin-sdk")>("openclaw/plugin-sdk");
101
+ vi.mock("openclaw/plugin-sdk/diagnostics-otel", async () => {
102
+ const actual = await vi.importActual<typeof import("openclaw/plugin-sdk/diagnostics-otel")>(
103
+ "openclaw/plugin-sdk/diagnostics-otel",
104
+ );
103
105
  return {
104
106
  ...actual,
105
107
  registerLogTransport: registerLogTransportMock,
106
108
  };
107
109
  });
108
110
 
109
- import type { OpenClawPluginServiceContext } from "openclaw/plugin-sdk";
110
- import { emitDiagnosticEvent } from "openclaw/plugin-sdk";
111
+ import type { OpenClawPluginServiceContext } from "openclaw/plugin-sdk/diagnostics-otel";
112
+ import { emitDiagnosticEvent } from "openclaw/plugin-sdk/diagnostics-otel";
111
113
  import { createDiagnosticsOtelService } from "./service.js";
112
114
 
113
115
  const OTEL_TEST_STATE_DIR = "/tmp/openclaw-diagnostics-otel-test";
@@ -327,13 +329,13 @@ describe("diagnostics-otel service", () => {
327
329
 
328
330
  test("redacts sensitive data from log attributes before export", async () => {
329
331
  const emitCall = await emitAndCaptureLog({
330
- 0: '{"token":"ghp_abcdefghijklmnopqrstuvwxyz123456"}',
332
+ 0: '{"token":"ghp_abcdefghijklmnopqrstuvwxyz123456"}', // pragma: allowlist secret
331
333
  1: "auth configured",
332
334
  _meta: { logLevelName: "DEBUG", date: new Date() },
333
335
  });
334
336
 
335
337
  const tokenAttr = emitCall?.attributes?.["openclaw.token"];
336
- expect(tokenAttr).not.toBe("ghp_abcdefghijklmnopqrstuvwxyz123456");
338
+ expect(tokenAttr).not.toBe("ghp_abcdefghijklmnopqrstuvwxyz123456"); // pragma: allowlist secret
337
339
  if (typeof tokenAttr === "string") {
338
340
  expect(tokenAttr).toContain("…");
339
341
  }
@@ -347,7 +349,7 @@ describe("diagnostics-otel service", () => {
347
349
  emitDiagnosticEvent({
348
350
  type: "session.state",
349
351
  state: "waiting",
350
- reason: "token=ghp_abcdefghijklmnopqrstuvwxyz123456",
352
+ reason: "token=ghp_abcdefghijklmnopqrstuvwxyz123456", // pragma: allowlist secret
351
353
  });
352
354
 
353
355
  const sessionCounter = telemetryState.counters.get("openclaw.session.state");
@@ -360,7 +362,7 @@ describe("diagnostics-otel service", () => {
360
362
  const attrs = sessionCounter?.add.mock.calls[0]?.[1] as Record<string, unknown> | undefined;
361
363
  expect(typeof attrs?.["openclaw.reason"]).toBe("string");
362
364
  expect(String(attrs?.["openclaw.reason"])).not.toContain(
363
- "ghp_abcdefghijklmnopqrstuvwxyz123456",
365
+ "ghp_abcdefghijklmnopqrstuvwxyz123456", // pragma: allowlist secret
364
366
  );
365
367
  await service.stop?.(ctx);
366
368
  });
package/src/service.ts CHANGED
@@ -9,8 +9,15 @@ import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
9
9
  import { NodeSDK } from "@opentelemetry/sdk-node";
10
10
  import { ParentBasedSampler, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
11
11
  import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
12
- import type { DiagnosticEventPayload, OpenClawPluginService } from "openclaw/plugin-sdk";
13
- import { onDiagnosticEvent, redactSensitiveText, registerLogTransport } from "openclaw/plugin-sdk";
12
+ import type {
13
+ DiagnosticEventPayload,
14
+ OpenClawPluginService,
15
+ } from "openclaw/plugin-sdk/diagnostics-otel";
16
+ import {
17
+ onDiagnosticEvent,
18
+ redactSensitiveText,
19
+ registerLogTransport,
20
+ } from "openclaw/plugin-sdk/diagnostics-otel";
14
21
 
15
22
  const DEFAULT_SERVICE_NAME = "openclaw";
16
23