@openclaw/diagnostics-otel 2026.2.14 → 2026.2.17
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/package.json +1 -1
- package/src/service.test.ts +6 -3
- package/src/service.ts +2 -2
package/package.json
CHANGED
package/src/service.test.ts
CHANGED
|
@@ -104,6 +104,7 @@ vi.mock("openclaw/plugin-sdk", async () => {
|
|
|
104
104
|
};
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
+
import type { OpenClawPluginServiceContext } from "openclaw/plugin-sdk";
|
|
107
108
|
import { emitDiagnosticEvent } from "openclaw/plugin-sdk";
|
|
108
109
|
import { createDiagnosticsOtelService } from "./service.js";
|
|
109
110
|
|
|
@@ -130,7 +131,7 @@ describe("diagnostics-otel service", () => {
|
|
|
130
131
|
});
|
|
131
132
|
|
|
132
133
|
const service = createDiagnosticsOtelService();
|
|
133
|
-
|
|
134
|
+
const ctx: OpenClawPluginServiceContext = {
|
|
134
135
|
config: {
|
|
135
136
|
diagnostics: {
|
|
136
137
|
enabled: true,
|
|
@@ -150,7 +151,9 @@ describe("diagnostics-otel service", () => {
|
|
|
150
151
|
error: vi.fn(),
|
|
151
152
|
debug: vi.fn(),
|
|
152
153
|
},
|
|
153
|
-
|
|
154
|
+
stateDir: "/tmp/openclaw-diagnostics-otel-test",
|
|
155
|
+
};
|
|
156
|
+
await service.start(ctx);
|
|
154
157
|
|
|
155
158
|
emitDiagnosticEvent({
|
|
156
159
|
type: "webhook.received",
|
|
@@ -222,6 +225,6 @@ describe("diagnostics-otel service", () => {
|
|
|
222
225
|
});
|
|
223
226
|
expect(logEmit).toHaveBeenCalled();
|
|
224
227
|
|
|
225
|
-
await service.stop?.();
|
|
228
|
+
await service.stop?.(ctx);
|
|
226
229
|
});
|
|
227
230
|
});
|
package/src/service.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { SeverityNumber } from "@opentelemetry/api-logs";
|
|
2
|
-
import type { DiagnosticEventPayload, OpenClawPluginService } from "openclaw/plugin-sdk";
|
|
3
1
|
import { metrics, trace, SpanStatusCode } from "@opentelemetry/api";
|
|
2
|
+
import type { SeverityNumber } from "@opentelemetry/api-logs";
|
|
4
3
|
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
|
5
4
|
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
|
|
6
5
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
@@ -10,6 +9,7 @@ import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
|
|
|
10
9
|
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
11
10
|
import { ParentBasedSampler, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
|
|
12
11
|
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
|
|
12
|
+
import type { DiagnosticEventPayload, OpenClawPluginService } from "openclaw/plugin-sdk";
|
|
13
13
|
import { onDiagnosticEvent, registerLogTransport } from "openclaw/plugin-sdk";
|
|
14
14
|
|
|
15
15
|
const DEFAULT_SERVICE_NAME = "openclaw";
|