Analytics & Monitoring
Sentry Metrics
Performance monitoring integration with Sentry for Pipecat frame processors
Overview
SentryMetrics
extends FrameProcessorMetrics
to provide performance monitoring integration with Sentry. It tracks Time to First Byte (TTFB) and processing duration metrics for frame processors.
Installation
To use Sentry metrics, install the Sentry SDK:
Configuration
Sentry must be initialized in your application before metrics will be collected:
Metrics Collection
TTFB Metrics
Time to First Byte metrics track how long it takes to receive the first response:
start_ttfb_metrics
method
Starts a TTFB span in Sentry
stop_ttfb_metrics
method
Stops the current TTFB span
Processing Metrics
Processing metrics track the total duration of frame processing:
start_processing_metrics
method
Starts a processing span in Sentry
stop_processing_metrics
method
Stops the current processing span
Usage Example
Span Information
Each span includes:
- Operation type (
ttfb
orprocessing
) - Description with processor name
- Start timestamp
- End timestamp
- Unique span ID
Fallback Behavior
If Sentry is not available (not installed or not initialized):
- Warning logs are generated
- Metric methods execute without error
- No data is sent to Sentry
Notes
- Requires Sentry SDK to be installed and initialized
- Thread-safe metric collection
- Automatic span management
- Supports selective TTFB reporting
- Integrates with Sentry’s performance monitoring
- Provides detailed timing information
- Maintains timing data even when Sentry is unavailable