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

推荐订阅源

博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
L
LangChain Blog
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
Microsoft Azure Blog
Microsoft Azure Blog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
Y
Y Combinator Blog
D
DataBreaches.Net
Engineering at Meta
Engineering at Meta
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements

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: propagate diagnostics timeline phase · openclaw/open...
shakkernerd · 2026-05-07 · via Recent Commits to openclaw:main

@@ -1,3 +1,4 @@

1+

import { AsyncLocalStorage } from "node:async_hooks";

12

import { randomUUID } from "node:crypto";

23

import { mkdirSync } from "node:fs";

34

import { dirname } from "node:path";

@@ -60,8 +61,17 @@ type DiagnosticsTimelineOptions = {

6061

env?: NodeJS.ProcessEnv;

6162

};

626364+

export type ActiveDiagnosticsTimelineSpan = {

65+

name: string;

66+

phase?: string;

67+

spanId: string;

68+

parentSpanId?: string;

69+

attributes?: DiagnosticsTimelineAttributes;

70+

};

71+6372

let warnedAboutTimelineWrite = false;

6473

const createdTimelineDirs = new Set<string>();

74+

const activeDiagnosticsTimelineSpan = new AsyncLocalStorage<ActiveDiagnosticsTimelineSpan>();

65756676

function resolveDiagnosticsTimelineOptions(

6777

options: DiagnosticsTimelineOptions = {},

@@ -177,6 +187,10 @@ export function emitDiagnosticsTimelineEvent(

177187

}

178188

}

179189190+

export function getActiveDiagnosticsTimelineSpan(): ActiveDiagnosticsTimelineSpan | undefined {

191+

return activeDiagnosticsTimelineSpan.getStore();

192+

}

193+180194

export async function measureDiagnosticsTimelineSpan<T>(

181195

name: string,

182196

run: () => Promise<T> | T,

@@ -186,28 +200,40 @@ export async function measureDiagnosticsTimelineSpan<T>(

186200

if (!isDiagnosticsTimelineEnabled({ config: options.config, env })) {

187201

return await run();

188202

}

203+

const activeSpan = getActiveDiagnosticsTimelineSpan();

189204

const spanId = randomUUID();

205+

const phase = options.phase ?? activeSpan?.phase;

206+

const parentSpanId = options.parentSpanId ?? activeSpan?.spanId;

190207

const startedAt = performance.now();

191208

emitDiagnosticsTimelineEvent(

192209

{

193210

type: "span.start",

194211

name,

195-

phase: options.phase,

212+

phase,

196213

spanId,

197-

parentSpanId: options.parentSpanId,

214+

parentSpanId,

198215

attributes: options.attributes,

199216

},

200217

{ config: options.config, env },

201218

);

202219

try {

203-

const result = await run();

220+

const result = await activeDiagnosticsTimelineSpan.run(

221+

{

222+

name,

223+

...(phase ? { phase } : {}),

224+

spanId,

225+

...(parentSpanId ? { parentSpanId } : {}),

226+

...(options.attributes ? { attributes: options.attributes } : {}),

227+

},

228+

() => run(),

229+

);

204230

emitDiagnosticsTimelineEvent(

205231

{

206232

type: "span.end",

207233

name,

208-

phase: options.phase,

234+

phase,

209235

spanId,

210-

parentSpanId: options.parentSpanId,

236+

parentSpanId,

211237

durationMs: performance.now() - startedAt,

212238

attributes: options.attributes,

213239

},

@@ -219,9 +245,9 @@ export async function measureDiagnosticsTimelineSpan<T>(

219245

{

220246

type: "span.error",

221247

name,

222-

phase: options.phase,

248+

phase,

223249

spanId,

224-

parentSpanId: options.parentSpanId,

250+

parentSpanId,

225251

durationMs: performance.now() - startedAt,

226252

attributes: options.attributes,

227253

errorName: error instanceof Error ? error.name : typeof error,

@@ -242,28 +268,40 @@ export function measureDiagnosticsTimelineSpanSync<T>(

242268

if (!isDiagnosticsTimelineEnabled({ config: options.config, env })) {

243269

return run();

244270

}

271+

const activeSpan = getActiveDiagnosticsTimelineSpan();

245272

const spanId = randomUUID();

273+

const phase = options.phase ?? activeSpan?.phase;

274+

const parentSpanId = options.parentSpanId ?? activeSpan?.spanId;

246275

const startedAt = performance.now();

247276

emitDiagnosticsTimelineEvent(

248277

{

249278

type: "span.start",

250279

name,

251-

phase: options.phase,

280+

phase,

252281

spanId,

253-

parentSpanId: options.parentSpanId,

282+

parentSpanId,

254283

attributes: options.attributes,

255284

},

256285

{ config: options.config, env },

257286

);

258287

try {

259-

const result = run();

288+

const result = activeDiagnosticsTimelineSpan.run(

289+

{

290+

name,

291+

...(phase ? { phase } : {}),

292+

spanId,

293+

...(parentSpanId ? { parentSpanId } : {}),

294+

...(options.attributes ? { attributes: options.attributes } : {}),

295+

},

296+

run,

297+

);

260298

emitDiagnosticsTimelineEvent(

261299

{

262300

type: "span.end",

263301

name,

264-

phase: options.phase,

302+

phase,

265303

spanId,

266-

parentSpanId: options.parentSpanId,

304+

parentSpanId,

267305

durationMs: performance.now() - startedAt,

268306

attributes: options.attributes,

269307

},

@@ -275,9 +313,9 @@ export function measureDiagnosticsTimelineSpanSync<T>(

275313

{

276314

type: "span.error",

277315

name,

278-

phase: options.phase,

316+

phase,

279317

spanId,

280-

parentSpanId: options.parentSpanId,

318+

parentSpanId,

281319

durationMs: performance.now() - startedAt,

282320

attributes: options.attributes,

283321

errorName: error instanceof Error ? error.name : typeof error,