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, enabling real-time performance monitoring and error tracking for your Pipecat applications.
Sentry Metrics API Reference
Pipecat’s API methods for Sentry metrics integration
Example Implementation
Browse examples using Sentry metrics
Sentry Documentation
Official Sentry Python SDK documentation
Sentry Platform
Access performance monitoring and error tracking
Installation
To use Sentry analytics services, install the required dependencies:Prerequisites
Sentry Account Setup
Before using Sentry metrics services, you need:- Sentry Account: Sign up at Sentry Platform
- Project Setup: Create a project and obtain your DSN
- SDK Initialization: Configure Sentry SDK in your application
- Metrics Configuration: Set up performance monitoring and error tracking
Required Configuration
- Sentry DSN: Your project’s Data Source Name for authentication
- Traces Sample Rate: Configure performance monitoring sampling
- SDK Initialization: Initialize Sentry before using metrics
Key Features
- Performance Monitoring: Track TTFB and processing duration metrics
- Error Tracking: Automatic error capture and reporting
- Frame Processor Metrics: Monitor individual processor performance
- Real-time Analytics: Live performance data and alerting
Configuration
SentryMetrics takes no constructor parameters. It automatically detects whether the Sentry SDK has been initialized and logs a warning if it has not.
You must initialize the Sentry SDK in your application before creating
SentryMetrics. The metrics collector checks sentry_sdk.is_initialized() at construction time.Usage
Basic Setup
With Multiple Services
Notes
- SDK initialization required: Sentry metrics are silently disabled if
sentry_sdk.init()has not been called. A warning is logged in this case. - Transaction types: The service creates two types of Sentry transactions:
ttfbfor time-to-first-byte tracking andprocessingfor frame processing duration. - Background processing: Transactions are completed in a background task to avoid blocking the pipeline.
- Graceful shutdown: On cleanup, the service flushes all pending transactions to Sentry with a 5-second timeout.