





























@@ -373,21 +373,56 @@ describe("diagnostics-otel service", () => {
373373attempt: 2,
374374});
375375376-expect(telemetryState.counters.get("openclaw.webhook.received")?.add).toHaveBeenCalled();
376+expect(telemetryState.counters.get("openclaw.webhook.received")?.add).toHaveBeenCalledWith(1, {
377+"openclaw.channel": "telegram",
378+"openclaw.webhook": "telegram-post",
379+});
377380expect(
378381telemetryState.histograms.get("openclaw.webhook.duration_ms")?.record,
379-).toHaveBeenCalled();
380-expect(telemetryState.counters.get("openclaw.message.queued")?.add).toHaveBeenCalled();
381-expect(telemetryState.counters.get("openclaw.message.processed")?.add).toHaveBeenCalled();
382+).toHaveBeenCalledWith(120, {
383+"openclaw.channel": "telegram",
384+"openclaw.webhook": "telegram-post",
385+});
386+expect(telemetryState.counters.get("openclaw.message.queued")?.add).toHaveBeenCalledWith(1, {
387+"openclaw.channel": "telegram",
388+"openclaw.source": "telegram",
389+});
390+expect(telemetryState.histograms.get("openclaw.queue.depth")?.record).toHaveBeenCalledTimes(2);
391+expect(telemetryState.histograms.get("openclaw.queue.depth")?.record).toHaveBeenCalledWith(2, {
392+"openclaw.channel": "telegram",
393+"openclaw.source": "telegram",
394+});
395+expect(telemetryState.histograms.get("openclaw.queue.depth")?.record).toHaveBeenCalledWith(3, {
396+"openclaw.lane": "main",
397+});
398+expect(telemetryState.counters.get("openclaw.message.processed")?.add).toHaveBeenCalledWith(1, {
399+"openclaw.channel": "telegram",
400+"openclaw.outcome": "completed",
401+});
382402expect(
383403telemetryState.histograms.get("openclaw.message.duration_ms")?.record,
384-).toHaveBeenCalled();
385-expect(telemetryState.histograms.get("openclaw.queue.wait_ms")?.record).toHaveBeenCalled();
386-expect(telemetryState.counters.get("openclaw.session.stuck")?.add).toHaveBeenCalled();
404+).toHaveBeenCalledWith(55, {
405+"openclaw.channel": "telegram",
406+"openclaw.outcome": "completed",
407+});
408+expect(telemetryState.histograms.get("openclaw.queue.wait_ms")?.record).toHaveBeenCalledWith(
409+10,
410+{
411+"openclaw.lane": "main",
412+},
413+);
414+expect(telemetryState.counters.get("openclaw.session.stuck")?.add).toHaveBeenCalledTimes(1);
415+expect(telemetryState.counters.get("openclaw.session.stuck")?.add).toHaveBeenCalledWith(1, {
416+"openclaw.state": "processing",
417+});
387418expect(
388419telemetryState.histograms.get("openclaw.session.stuck_age_ms")?.record,
389-).toHaveBeenCalled();
390-expect(telemetryState.counters.get("openclaw.run.attempt")?.add).toHaveBeenCalled();
420+).toHaveBeenCalledWith(125_000, {
421+"openclaw.state": "processing",
422+});
423+expect(telemetryState.counters.get("openclaw.run.attempt")?.add).toHaveBeenCalledWith(1, {
424+"openclaw.attempt": 2,
425+});
391426392427const spanNames = telemetryState.tracer.startSpan.mock.calls.map((call) => call[0]);
393428expect(spanNames).toContain("openclaw.webhook.processed");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。