@beignet/core
Version:
Core framework primitives for Beignet
17 lines • 748 B
JavaScript
import { resolveTracingPort, runWithTracing, } from "./index.js";
/**
* Resolve a lazy application context inside a span when the runtime tracing
* port is available independently from that context.
*/
export async function runWithResolvedTracingContext(args) {
const resolveContext = async () => typeof args.ctx === "function"
? await args.ctx()
: args.ctx;
if (args.tracing) {
return await runWithTracing(args.tracing, args.operation, async (span) => args.run(await resolveContext(), span));
}
const ctx = await resolveContext();
const tracing = resolveTracingPort(ctx);
return await runWithTracing(tracing, args.operation, (span) => args.run(ctx, span));
}
//# sourceMappingURL=execution.js.map