sentry

Sentry integration for frame processor metrics.

class pipecat.processors.metrics.sentry.SentryMetrics[source]

Bases: FrameProcessorMetrics

Frame processor metrics integration with Sentry monitoring.

Extends FrameProcessorMetrics to send time-to-first-byte (TTFB) and processing metrics as Sentry transactions for performance monitoring and debugging.

__init__()[source]

Initialize the Sentry metrics collector.

Sets up internal state for tracking transactions and verifies Sentry SDK initialization status.

async setup(task_manager: BaseTaskManager)[source]

Setup the Sentry metrics system.

Parameters:

task_manager – The task manager to use for background operations.

async cleanup()[source]

Clean up Sentry resources and flush pending transactions.

Ensures all pending transactions are sent to Sentry before shutdown.

async start_ttfb_metrics(*, start_time: float | None = None, report_only_initial_ttfb: bool)[source]

Start tracking time-to-first-byte metrics.

Parameters:
  • start_time – Optional start timestamp override.

  • report_only_initial_ttfb – Whether to report only the initial TTFB measurement.

async stop_ttfb_metrics(*, end_time: float | None = None)[source]

Stop tracking time-to-first-byte metrics.

Parameters:

end_time – Optional end timestamp override.

Returns:

MetricsFrame produced by the base class, or None if not measuring. Returning the frame is required so FrameProcessor.stop_ttfb_metrics can push it downstream to observers.

async start_processing_metrics(*, start_time: float | None = None)[source]

Start tracking frame processing metrics.

Parameters:

start_time – Optional start timestamp override.

async stop_processing_metrics(*, end_time: float | None = None)[source]

Stop tracking frame processing metrics.

Parameters:

end_time – Optional end timestamp override.

Returns:

MetricsFrame produced by the base class, or None if not measuring. Returning the frame is required so FrameProcessor.stop_processing_metrics can push it downstream to observers.