(spanId: string)
| 916 | * End an interaction span |
| 917 | */ |
| 918 | export function endInteractionPerfettoSpan(spanId: string): void { |
| 919 | if (!isEnabled || !spanId) return |
| 920 | |
| 921 | const pending = pendingSpans.get(spanId) |
| 922 | if (!pending) return |
| 923 | |
| 924 | const endTime = getTimestamp() |
| 925 | const duration = endTime - pending.startTime |
| 926 | |
| 927 | // Emit end event |
| 928 | events.push({ |
| 929 | name: pending.name, |
| 930 | cat: pending.category, |
| 931 | ph: 'E', |
| 932 | ts: endTime, |
| 933 | pid: pending.agentInfo.processId, |
| 934 | tid: pending.agentInfo.threadId, |
| 935 | args: { |
| 936 | ...pending.args, |
| 937 | duration_ms: duration / 1000, |
| 938 | }, |
| 939 | }) |
| 940 | |
| 941 | pendingSpans.delete(spanId) |
| 942 | } |
| 943 | |
| 944 | // --------------------------------------------------------------------------- |
| 945 | // Periodic write helpers |
no test coverage detected