Enabling performance metrics
Setenable_metrics=True in PipelineParams when creating a worker:
Example config
Sample output
Limiting TTFB responses
If you only want the first TTFB measurement for each service, you can optionally passreport_only_initial_ttfb=True in PipelineParams:
Example config
Note: enable_metrics=True is required for this setting to have an
effect.
Disabling initial empty metrics
By default, Pipecat sends an initialMetricsFrame with zero values for all
services when the pipeline starts. To disable this behavior:
Example config
Enabling LLM/TTS Usage Metrics
Setenable_usage_metrics=True in PipelineParams when creating a worker:
Example config
Sample output
Note: Usage metrics are recorded per interaction and do not represent running totals.
Capturing Metrics Data
When metrics are enabled, Pipecat emits aMetricsFrame for each interaction. The MetricsFrame contains a list of metrics data objects, which can include:
TTFBMetricsData— Time To First ByteTTFAMetricsData— Time To First Audio (TTS)ProcessingMetricsData— Processing timeLLMUsageMetricsData— LLM token usageTTSUsageMetricsData— TTS character usageTextAggregationMetricsData— Sentence aggregation latency (TTS)TurnMetricsData— Turn completion predictions
MetricsFrames.
Example: Using MetricsLogObserver
The simplest way to log metrics is with the built-inMetricsLogObserver. Pass it as an observer when creating your PipelineWorker:
include_metrics:
Example: Using a Custom FrameProcessor
Create a custom FrameProcessor to handle metrics data. Here’s an example Metrics Processor that can be added to your pipeline after the TTS processor.Metrics Data Reference
All metrics data classes inherit fromMetricsData, which includes processor (the name of the processor that generated the metric) and an optional model field.
TTFBMetricsData
Time To First Byte — measures how long until the first byte of a response is received from a service.TTFAMetricsData
Time To First Audio — measures the time from a TTS request to the first audible audio sample. This includes the time to first byte plus any leading silence padding added by the service.TTFAMetricsData reports the latency breakdown directly, showing how much of the perceived latency is silence padding.
ProcessingMetricsData
Measures the total time taken by a service to process a request.TextAggregationMetricsData
Measures the time from the first LLM token to the first complete sentence, representing the latency cost of sentence aggregation in the TTS pipeline.LLMUsageMetricsData
Token usage for an LLM interaction. Thevalue field is an LLMTokenUsage object with:
TTSUsageMetricsData
Character usage for a TTS interaction.TurnMetricsData
Metrics from turn completion prediction, emitted by turn analyzers like Krisp Viva Turn and Smart Turn.Related Observers
In addition toMetricsLogObserver, Pipecat provides observers that track higher-level conversational metrics.