惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
H
Help Net Security
小众软件
小众软件
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
Last Week in AI
Last Week in AI
爱范儿
爱范儿
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
博客园 - 【当耐特】
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
博客园_首页
Jina AI
Jina AI
D
Docker
博客园 - 司徒正美
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
阮一峰的网络日志
阮一峰的网络日志

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
feat(diagnostics): add outbound delivery lifecycle events...
vincentkoc · 2026-04-25 · via Recent Commits to openclaw:main

@@ -878,6 +878,107 @@ describe("diagnostics-otel service", () => {

878878

await service.stop?.(ctx);

879879

});

880880881+

test("exports message delivery spans and metrics with low-cardinality attributes", async () => {

882+

const service = createDiagnosticsOtelService();

883+

const ctx = createOtelContext(OTEL_TEST_ENDPOINT, { traces: true, metrics: true });

884+

await service.start(ctx);

885+886+

emitDiagnosticEvent({

887+

type: "message.delivery.started",

888+

channel: "matrix",

889+

deliveryKind: "text",

890+

sessionKey: "session-secret",

891+

});

892+

emitDiagnosticEvent({

893+

type: "message.delivery.completed",

894+

channel: "matrix",

895+

deliveryKind: "text",

896+

durationMs: 25,

897+

resultCount: 1,

898+

sessionKey: "session-secret",

899+

});

900+

emitDiagnosticEvent({

901+

type: "message.delivery.error",

902+

channel: "discord",

903+

deliveryKind: "media",

904+

durationMs: 40,

905+

errorCategory: "TypeError",

906+

sessionKey: "session-secret",

907+

});

908+

await flushDiagnosticEvents();

909+910+

expect(

911+

telemetryState.counters.get("openclaw.message.delivery.started")?.add,

912+

).toHaveBeenCalledWith(1, {

913+

"openclaw.channel": "matrix",

914+

"openclaw.delivery.kind": "text",

915+

});

916+

expect(

917+

telemetryState.histograms.get("openclaw.message.delivery.duration_ms")?.record,

918+

).toHaveBeenCalledWith(

919+

25,

920+

expect.objectContaining({

921+

"openclaw.channel": "matrix",

922+

"openclaw.delivery.kind": "text",

923+

"openclaw.outcome": "completed",

924+

}),

925+

);

926+

expect(

927+

telemetryState.histograms.get("openclaw.message.delivery.duration_ms")?.record,

928+

).toHaveBeenCalledWith(

929+

40,

930+

expect.objectContaining({

931+

"openclaw.channel": "discord",

932+

"openclaw.delivery.kind": "media",

933+

"openclaw.outcome": "error",

934+

"openclaw.errorCategory": "TypeError",

935+

}),

936+

);

937+938+

const deliverySpanCalls = telemetryState.tracer.startSpan.mock.calls.filter(

939+

(call) => call[0] === "openclaw.message.delivery",

940+

);

941+

expect(deliverySpanCalls).toHaveLength(2);

942+

expect(deliverySpanCalls[0]?.[1]).toMatchObject({

943+

attributes: {

944+

"openclaw.channel": "matrix",

945+

"openclaw.delivery.kind": "text",

946+

"openclaw.outcome": "completed",

947+

"openclaw.delivery.result_count": 1,

948+

},

949+

startTime: expect.any(Number),

950+

});

951+

expect(deliverySpanCalls[1]?.[1]).toMatchObject({

952+

attributes: {

953+

"openclaw.channel": "discord",

954+

"openclaw.delivery.kind": "media",

955+

"openclaw.outcome": "error",

956+

"openclaw.errorCategory": "TypeError",

957+

},

958+

startTime: expect.any(Number),

959+

});

960+

for (const call of deliverySpanCalls) {

961+

expect(call[1]).toEqual({

962+

attributes: expect.not.objectContaining({

963+

"openclaw.sessionKey": expect.anything(),

964+

"openclaw.messageId": expect.anything(),

965+

"openclaw.conversationId": expect.anything(),

966+

"openclaw.content": expect.anything(),

967+

"openclaw.to": expect.anything(),

968+

}),

969+

startTime: expect.any(Number),

970+

});

971+

}

972+

const errorSpan = telemetryState.spans.find(

973+

(span) => span.name === "openclaw.message.delivery" && span.setStatus.mock.calls.length > 0,

974+

);

975+

expect(errorSpan?.setStatus).toHaveBeenCalledWith({

976+

code: 2,

977+

message: "TypeError",

978+

});

979+

await service.stop?.(ctx);

980+

});

981+881982

test("does not export model or tool content unless capture is explicitly enabled", async () => {

882983

const service = createDiagnosticsOtelService();

883984

const ctx = createOtelContext(OTEL_TEST_ENDPOINT, { traces: true, metrics: true });