MCPcopy
hub / github.com/vercel/next.js / Tracer

Class Tracer

packages/next/src/client/tracing/tracer.ts:59–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59class Tracer {
60 _emitter: MittEmitter<string> = mitt()
61
62 private handleSpanEnd = (span: Span) => {
63 this._emitter.emit('spanend', span)
64 }
65
66 startSpan(name: string, options: SpanOptions) {
67 return new Span(name, options, this.handleSpanEnd)
68 }
69
70 onSpanEnd(cb: (span: ISpan) => void): () => void {
71 this._emitter.on('spanend', cb)
72 return () => {
73 this._emitter.off('spanend', cb)
74 }
75 }
76}
77
78export type { ISpan as Span }
79export default new Tracer()

Callers

nothing calls this directly

Calls 2

mittFunction · 0.85
emitMethod · 0.45

Tested by

no test coverage detected