Execute an async function and track its performance
Automatically records the duration of the operation in the provided performance monitor.
Return type of the function
Performance monitor to record the duration in
Operation name for tracking (e.g., 'fetch_meps')
'fetch_meps'
Async function to execute and measure
Promise that resolves with the function result
Re-throws any error thrown by fn after recording the duration
fn
const monitor = new PerformanceMonitor();const result = await withPerformanceTracking( monitor, 'fetch_meps', async () => { return await client.getMEPs({ limit: 100 }); }); Copy
const monitor = new PerformanceMonitor();const result = await withPerformanceTracking( monitor, 'fetch_meps', async () => { return await client.getMEPs({ limit: 100 }); });
0.8.0
Execute an async function and track its performance
Automatically records the duration of the operation in the provided performance monitor.