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

推荐订阅源

I
InfoQ
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
B
Blog
罗磊的独立博客
GbyAI
GbyAI
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
The GitHub Blog
The GitHub Blog
人人都是产品经理
人人都是产品经理
博客园 - Franky
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
Visual Studio Blog
MyScale Blog
MyScale Blog
Google DeepMind News
Google DeepMind News
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏

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
fix(diagnostics): harden observability exports and smokes...
vincentkoc · 2026-05-23 · via Recent Commits to openclaw:main

@@ -297,10 +297,13 @@ function histogramCreateOptions(name: string) {

297297298298

async function emitAndCaptureLog(

299299

event: Omit<Extract<Parameters<typeof emitDiagnosticEvent>[0], { type: "log.record" }>, "type">,

300-

options: { trusted?: boolean } = {},

300+

options: { captureContent?: OtelContextFlags["captureContent"]; trusted?: boolean } = {},

301301

) {

302302

const service = createDiagnosticsOtelService();

303-

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

303+

const ctx = createOtelContext(OTEL_TEST_ENDPOINT, {

304+

logs: true,

305+

...(options.captureContent !== undefined ? { captureContent: options.captureContent } : {}),

306+

});

304307

await service.start(ctx);

305308

const emit = options.trusted ? emitTrustedDiagnosticEvent : emitDiagnosticEvent;

306309

emit({

@@ -1060,12 +1063,33 @@ describe("diagnostics-otel service", () => {

10601063

await service.stop?.(ctx);

10611064

});

106210651063-

test("redacts sensitive data from log messages before export", async () => {

1066+

test("omits log message bodies from OTLP logs unless broad content capture is enabled", async () => {

10641067

const emitCall = await emitAndCaptureLog({

10651068

level: "INFO",

1066-

message: "Using API key sk-1234567890abcdef1234567890abcdef",

1069+

message: "model replied OTEL-QA-OK",

10671070

});

106810711072+

expect(emitCall?.body).toBe("log");

1073+

});

1074+1075+

test("keeps granular content capture from enabling OTLP log bodies", async () => {

1076+

const emitCall = await emitAndCaptureLog(

1077+

{

1078+

level: "INFO",

1079+

message: "model replied OTEL-QA-OK",

1080+

},

1081+

{ captureContent: { enabled: true, inputMessages: true } },

1082+

);

1083+1084+

expect(emitCall?.body).toBe("log");

1085+

});

1086+1087+

test("redacts sensitive data from log messages before export when broad content capture is enabled", async () => {

1088+

const emitCall = await emitAndCaptureLog({

1089+

level: "INFO",

1090+

message: "Using API key sk-1234567890abcdef1234567890abcdef",

1091+

}, { captureContent: true });

1092+10691093

expect(emitCall?.body).not.toContain("sk-1234567890abcdef1234567890abcdef");

10701094

expect(emitCall?.body).toContain("sk-123");

10711095

expect(emitCall?.body).toContain("…");

@@ -1332,6 +1356,81 @@ describe("diagnostics-otel service", () => {

13321356

await service.stop?.(ctx);

13331357

});

133413581359+

test("drops session-shaped agent identifiers from model usage metric attributes", async () => {

1360+

const service = createDiagnosticsOtelService();

1361+

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

1362+

await service.start(ctx);

1363+1364+

emitDiagnosticEvent({

1365+

type: "model.usage",

1366+

agentId: "Agent:qa:otel-trace-smoke",

1367+

provider: "openai",

1368+

model: "gpt-5.4",

1369+

usage: { input: 2 },

1370+

});

1371+

await flushDiagnosticEvents();

1372+1373+

expect(telemetryState.counters.get("openclaw.tokens")?.add).toHaveBeenCalledWith(2, {

1374+

"openclaw.channel": "unknown",

1375+

"openclaw.agent": "unknown",

1376+

"openclaw.provider": "openai",

1377+

"openclaw.model": "gpt-5.4",

1378+

"openclaw.token": "input",

1379+

});

1380+

expect(

1381+

JSON.stringify(telemetryState.counters.get("openclaw.tokens")?.add.mock.calls),

1382+

).not.toContain("Agent:qa:otel-trace-smoke");

1383+

await service.stop?.(ctx);

1384+

});

1385+1386+

test("drops session-shaped queue lane metric attributes", async () => {

1387+

const service = createDiagnosticsOtelService();

1388+

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

1389+

await service.start(ctx);

1390+1391+

emitDiagnosticEvent({

1392+

type: "queue.lane.enqueue",

1393+

lane: "session:Agent:qa:otel-trace-smoke",

1394+

queueSize: 2,

1395+

});

1396+

await flushDiagnosticEvents();

1397+1398+

expect(telemetryState.counters.get("openclaw.queue.lane.enqueue")?.add).toHaveBeenCalledWith(

1399+

1,

1400+

{

1401+

"openclaw.lane": "session",

1402+

},

1403+

);

1404+

expect(

1405+

JSON.stringify(telemetryState.counters.get("openclaw.queue.lane.enqueue")?.add.mock.calls),

1406+

).not.toContain("Agent:qa:otel-trace-smoke");

1407+

await service.stop?.(ctx);

1408+

});

1409+1410+

test("keeps only the bounded prefix from scoped queue lane metric attributes", async () => {

1411+

const service = createDiagnosticsOtelService();

1412+

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

1413+

await service.start(ctx);

1414+1415+

emitDiagnosticEvent({

1416+

type: "queue.lane.enqueue",

1417+

lane: "dreaming-narrative:session-main",

1418+

queueSize: 2,

1419+

});

1420+

await flushDiagnosticEvents();

1421+1422+

expect(telemetryState.counters.get("openclaw.queue.lane.enqueue")?.add).toHaveBeenCalledWith(

1423+

1,

1424+

{

1425+

"openclaw.lane": "dreaming-narrative",

1426+

},

1427+

);

1428+

expect(

1429+

JSON.stringify(telemetryState.counters.get("openclaw.queue.lane.enqueue")?.add.mock.calls),

1430+

).not.toContain("session-main");

1431+

await service.stop?.(ctx);

1432+

});

1433+13351434

test("keeps GenAI token usage metric model attribute present when model is unavailable", async () => {

13361435

const service = createDiagnosticsOtelService();

13371436

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

@@ -1677,6 +1776,26 @@ describe("diagnostics-otel service", () => {

16771776

await service.stop?.(ctx);

16781777

});

167917781779+

test("drops session-shaped queue lanes from model failover spans", async () => {

1780+

const service = createDiagnosticsOtelService();

1781+

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

1782+

await service.start(ctx);

1783+1784+

emitDiagnosticEvent({

1785+

type: "model.failover",

1786+

lane: "session:Agent:qa:otel-trace-smoke",

1787+

reason: "overloaded",

1788+

fromProvider: "anthropic",

1789+

fromModel: "claude-opus-4-6",

1790+

});

1791+

await flushDiagnosticEvents();

1792+1793+

const failoverOptions = startedSpanOptions("openclaw.model.failover");

1794+

expect(failoverOptions?.attributes?.["openclaw.lane"]).toBe("session");

1795+

expect(JSON.stringify(failoverOptions?.attributes)).not.toContain("Agent:qa:otel-trace-smoke");

1796+

await service.stop?.(ctx);

1797+

});

1798+16801799

test("maps model call APIs to GenAI operation names and error type", async () => {

16811800

const service = createDiagnosticsOtelService();

16821801

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