European Parliament MCP Server API - v1.0.1
    Preparing search index...

    Function withPerformanceTracking

    • Execute an async function and track its performance

      Automatically records the duration of the operation in the provided performance monitor.

      Type Parameters

      • T

        Return type of the function

      Parameters

      • monitor: PerformanceMonitor

        Performance monitor to record the duration in

      • operation: string

        Operation name for tracking (e.g., 'fetch_meps')

      • fn: () => Promise<T>

        Async function to execute and measure

      Returns Promise<T>

      Promise that resolves with the function result

      Re-throws any error thrown by fn after recording the duration

      const monitor = new PerformanceMonitor();

      const result = await withPerformanceTracking(
      monitor,
      'fetch_meps',
      async () => {
      return await client.getMEPs({ limit: 100 });
      }
      );

      0.8.0