Merge pull request #3852 from pipecat-ai/mb/deprecate-processing-metrics
Deprecate processing metrics (ProcessingMetricsData)
This commit is contained in:
1
changelog/3852.deprecated.md
Normal file
1
changelog/3852.deprecated.md
Normal file
@@ -0,0 +1 @@
|
||||
- Deprecated `ProcessingMetricsData` and `start_processing_metrics()`/`stop_processing_metrics()` on `FrameProcessor` and `FrameProcessorMetrics`. These metrics don't accurately depict a service's performance. Instead, TTFB metrics are recommended. Processing metrics will be removed in the 1.0.0 version.
|
||||
@@ -41,6 +41,10 @@ class TTFBMetricsData(MetricsData):
|
||||
class ProcessingMetricsData(MetricsData):
|
||||
"""General processing time metrics data.
|
||||
|
||||
.. deprecated:: 0.0.104
|
||||
Processing metrics are deprecated and will be removed in a future version.
|
||||
Use TTFB metrics instead.
|
||||
|
||||
Parameters:
|
||||
value: Processing time measurement in seconds.
|
||||
"""
|
||||
|
||||
@@ -441,19 +441,35 @@ class FrameProcessor(BaseObject):
|
||||
if frame:
|
||||
await self.push_frame(frame)
|
||||
|
||||
_processing_metrics_warned = False
|
||||
|
||||
async def start_processing_metrics(self, *, start_time: Optional[float] = None):
|
||||
"""Start processing metrics collection.
|
||||
|
||||
.. deprecated:: 0.0.104
|
||||
Processing metrics are deprecated and will be removed in a future version.
|
||||
Use TTFB metrics instead.
|
||||
|
||||
Args:
|
||||
start_time: Optional timestamp to use as the start time. If None,
|
||||
uses the current time.
|
||||
"""
|
||||
if self.can_generate_metrics() and self.metrics_enabled:
|
||||
if not FrameProcessor._processing_metrics_warned:
|
||||
FrameProcessor._processing_metrics_warned = True
|
||||
logger.warning(
|
||||
"Processing metrics are deprecated and will be removed in a future version. "
|
||||
"Use TTFB metrics instead."
|
||||
)
|
||||
await self._metrics.start_processing_metrics(start_time=start_time)
|
||||
|
||||
async def stop_processing_metrics(self, *, end_time: Optional[float] = None):
|
||||
"""Stop processing metrics collection and push results.
|
||||
|
||||
.. deprecated:: 0.0.104
|
||||
Processing metrics are deprecated and will be removed in a future version.
|
||||
Use TTFB metrics instead.
|
||||
|
||||
Args:
|
||||
end_time: Optional timestamp to use as the end time. If None, uses
|
||||
the current time.
|
||||
|
||||
@@ -150,6 +150,10 @@ class FrameProcessorMetrics(BaseObject):
|
||||
async def start_processing_metrics(self, *, start_time: Optional[float] = None):
|
||||
"""Start measuring processing time.
|
||||
|
||||
.. deprecated:: 0.0.104
|
||||
Processing metrics are deprecated and will be removed in a future version.
|
||||
Use TTFB metrics instead.
|
||||
|
||||
Args:
|
||||
start_time: Optional timestamp to use as the start time. If None,
|
||||
uses the current time.
|
||||
@@ -159,6 +163,10 @@ class FrameProcessorMetrics(BaseObject):
|
||||
async def stop_processing_metrics(self, *, end_time: Optional[float] = None):
|
||||
"""Stop processing time measurement and generate metrics frame.
|
||||
|
||||
.. deprecated:: 0.0.104
|
||||
Processing metrics are deprecated and will be removed in a future version.
|
||||
Use TTFB metrics instead.
|
||||
|
||||
Args:
|
||||
end_time: Optional timestamp to use as the end time. If None, uses
|
||||
the current time.
|
||||
|
||||
Reference in New Issue
Block a user