Skip to content

Commit

Permalink
fix: add tracing to workers acquire
Browse files Browse the repository at this point in the history
  • Loading branch information
esroyo committed Oct 20, 2024
1 parent 1ac908d commit 1822e0f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/to-systemjs.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import opentelemetry from '@opentelemetry/api';
import { type Pool } from 'generic-pool';
import {
InputOptions,
Expand Down Expand Up @@ -60,7 +61,11 @@ export const toSystemjsWorker = async (
sourceModule: string | SourceModule,
rollupOutputOptions: OutputOptions = {},
): Promise<BuildResult> => {
const tracer = opentelemetry.trace.getTracer('web');
const workerAcquireSpan = tracer.startSpan('worker-acquire');
const worker = await workerPool.acquire();
workerAcquireSpan.end();

return new Promise((resolve) => {
worker.addEventListener(
'message',
Expand Down

0 comments on commit 1822e0f

Please sign in to comment.