MCPcopy Create free account
hub / github.com/IIIIQIIII/claude-code / emitProcessMetadata

Function emitProcessMetadata

src/utils/telemetry/perfettoTracing.ts:340–379  ·  view source on GitHub ↗

* Emit metadata events for a process/agent

(agentInfo: AgentInfo)

Source from the content-addressed store, hash-verified

338 * Emit metadata events for a process/agent
339 */
340function emitProcessMetadata(agentInfo: AgentInfo): void {
341 if (!isEnabled) return
342
343 // Process name
344 metadataEvents.push({
345 name: 'process_name',
346 cat: '__metadata',
347 ph: 'M',
348 ts: 0,
349 pid: agentInfo.processId,
350 tid: 0,
351 args: { name: agentInfo.agentName },
352 })
353
354 // Thread name (same as process for now)
355 metadataEvents.push({
356 name: 'thread_name',
357 cat: '__metadata',
358 ph: 'M',
359 ts: 0,
360 pid: agentInfo.processId,
361 tid: agentInfo.threadId,
362 args: { name: agentInfo.agentName },
363 })
364
365 // Add parent info if available
366 if (agentInfo.parentAgentId) {
367 metadataEvents.push({
368 name: 'parent_agent',
369 cat: '__metadata',
370 ph: 'M',
371 ts: 0,
372 pid: agentInfo.processId,
373 tid: 0,
374 args: {
375 parent_agent_id: agentInfo.parentAgentId,
376 },
377 })
378 }
379}
380
381/**
382 * Check if Perfetto tracing is enabled

Callers 2

registerAgentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected