| 132 | } |
| 133 | |
| 134 | startTracesSpan(name: string): Span { |
| 135 | const traces = this._traces |
| 136 | if (!this._otel) { |
| 137 | return traces.startSpan(name) |
| 138 | } |
| 139 | const { span, context } = traces.startContextSpan(name, this._otel.workerContext) |
| 140 | this._otel.currentContext = context |
| 141 | const end = span.end.bind(span) |
| 142 | span.end = (endTime?: TimeInput) => { |
| 143 | this._otel!.currentContext = undefined |
| 144 | return end(endTime) |
| 145 | } |
| 146 | return span |
| 147 | } |
| 148 | |
| 149 | request(method: 'run' | 'collect', context: WorkerExecuteContext): void { |
| 150 | this._otel?.files.push(...context.files.map(f => f.filepath)) |