mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:10:45 +00:00
fix(models): enrich local transport failure diagnostics
This commit is contained in:
@@ -1525,6 +1525,7 @@ describe("diagnostics-otel service", () => {
|
||||
api: "openai-responses",
|
||||
durationMs: 40,
|
||||
errorCategory: "ProviderError",
|
||||
failureKind: "terminated",
|
||||
upstreamRequestIdHash: "sha256:123456abcdef",
|
||||
});
|
||||
await flushDiagnosticEvents();
|
||||
@@ -1532,6 +1533,12 @@ describe("diagnostics-otel service", () => {
|
||||
const modelCall = telemetryState.tracer.startSpan.mock.calls.find(
|
||||
(call) => call[0] === "openclaw.model.call",
|
||||
);
|
||||
expect(modelCall?.[1]).toEqual({
|
||||
attributes: expect.objectContaining({
|
||||
"openclaw.failureKind": "terminated",
|
||||
}),
|
||||
startTime: expect.any(Number),
|
||||
});
|
||||
expect(modelCall?.[1]).toEqual({
|
||||
attributes: expect.not.objectContaining({
|
||||
"openclaw.upstreamRequestIdHash": expect.anything(),
|
||||
@@ -1542,6 +1549,14 @@ describe("diagnostics-otel service", () => {
|
||||
expect(span?.addEvent).toHaveBeenCalledWith("openclaw.provider.request", {
|
||||
"openclaw.upstreamRequestIdHash": "sha256:123456abcdef",
|
||||
});
|
||||
expect(
|
||||
telemetryState.histograms.get("openclaw.model_call.duration_ms")?.record,
|
||||
).toHaveBeenCalledWith(
|
||||
40,
|
||||
expect.objectContaining({
|
||||
"openclaw.failureKind": "terminated",
|
||||
}),
|
||||
);
|
||||
expect(
|
||||
telemetryState.histograms.get("openclaw.model_call.duration_ms")?.record,
|
||||
).toHaveBeenCalledWith(
|
||||
|
||||
@@ -1834,6 +1834,9 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
|
||||
const metricAttrs = {
|
||||
...modelCallMetricAttrs(evt),
|
||||
"openclaw.errorCategory": errorType,
|
||||
...(evt.failureKind
|
||||
? { "openclaw.failureKind": lowCardinalityAttr(evt.failureKind, "other") }
|
||||
: {}),
|
||||
};
|
||||
modelCallDurationHistogram.record(evt.durationMs, metricAttrs);
|
||||
recordModelCallSizeTimingMetrics(evt, metricAttrs);
|
||||
@@ -1850,6 +1853,9 @@ export function createDiagnosticsOtelService(): OpenClawPluginService {
|
||||
"openclaw.errorCategory": errorType,
|
||||
"error.type": errorType,
|
||||
};
|
||||
if (evt.failureKind) {
|
||||
spanAttrs["openclaw.failureKind"] = lowCardinalityAttr(evt.failureKind, "other");
|
||||
}
|
||||
assignGenAiModelCallAttrs(spanAttrs, evt);
|
||||
if (evt.api) {
|
||||
spanAttrs["openclaw.api"] = evt.api;
|
||||
|
||||
Reference in New Issue
Block a user