Deprecate processing metrics (ProcessingMetricsData)
Add deprecation warnings to start_processing_metrics() and stop_processing_metrics() on FrameProcessorMetrics and FrameProcessor. Mark ProcessingMetricsData as deprecated in docstring. All existing behavior is preserved — the warnings inform users that these will be removed in a future version.
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):
|
class ProcessingMetricsData(MetricsData):
|
||||||
"""General processing time metrics data.
|
"""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:
|
Parameters:
|
||||||
value: Processing time measurement in seconds.
|
value: Processing time measurement in seconds.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -441,19 +441,35 @@ class FrameProcessor(BaseObject):
|
|||||||
if frame:
|
if frame:
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
|
|
||||||
|
_processing_metrics_warned = False
|
||||||
|
|
||||||
async def start_processing_metrics(self, *, start_time: Optional[float] = None):
|
async def start_processing_metrics(self, *, start_time: Optional[float] = None):
|
||||||
"""Start processing metrics collection.
|
"""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:
|
Args:
|
||||||
start_time: Optional timestamp to use as the start time. If None,
|
start_time: Optional timestamp to use as the start time. If None,
|
||||||
uses the current time.
|
uses the current time.
|
||||||
"""
|
"""
|
||||||
if self.can_generate_metrics() and self.metrics_enabled:
|
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)
|
await self._metrics.start_processing_metrics(start_time=start_time)
|
||||||
|
|
||||||
async def stop_processing_metrics(self, *, end_time: Optional[float] = None):
|
async def stop_processing_metrics(self, *, end_time: Optional[float] = None):
|
||||||
"""Stop processing metrics collection and push results.
|
"""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:
|
Args:
|
||||||
end_time: Optional timestamp to use as the end time. If None, uses
|
end_time: Optional timestamp to use as the end time. If None, uses
|
||||||
the current time.
|
the current time.
|
||||||
|
|||||||
@@ -150,6 +150,10 @@ class FrameProcessorMetrics(BaseObject):
|
|||||||
async def start_processing_metrics(self, *, start_time: Optional[float] = None):
|
async def start_processing_metrics(self, *, start_time: Optional[float] = None):
|
||||||
"""Start measuring processing time.
|
"""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:
|
Args:
|
||||||
start_time: Optional timestamp to use as the start time. If None,
|
start_time: Optional timestamp to use as the start time. If None,
|
||||||
uses the current time.
|
uses the current time.
|
||||||
@@ -159,6 +163,10 @@ class FrameProcessorMetrics(BaseObject):
|
|||||||
async def stop_processing_metrics(self, *, end_time: Optional[float] = None):
|
async def stop_processing_metrics(self, *, end_time: Optional[float] = None):
|
||||||
"""Stop processing time measurement and generate metrics frame.
|
"""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:
|
Args:
|
||||||
end_time: Optional timestamp to use as the end time. If None, uses
|
end_time: Optional timestamp to use as the end time. If None, uses
|
||||||
the current time.
|
the current time.
|
||||||
|
|||||||
Reference in New Issue
Block a user