pipeline: add send_initial_empty_metrics flag
This commit is contained in:
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unrelease]
|
## [Unrelease]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added `send_initial_empty_metrics` flag to `PipelineParams` to request for
|
||||||
|
initial empty metrics (zero values). True by default.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- STT services should be using ISO 8601 time format for transcription frames.
|
- STT services should be using ISO 8601 time format for transcription frames.
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class Pipeline(BasePipeline):
|
|||||||
services = []
|
services = []
|
||||||
for p in self._processors:
|
for p in self._processors:
|
||||||
if isinstance(p, BasePipeline):
|
if isinstance(p, BasePipeline):
|
||||||
services += p.processors_with_metrics()
|
services.extend(p.processors_with_metrics())
|
||||||
elif p.can_generate_metrics():
|
elif p.can_generate_metrics():
|
||||||
services.append(p)
|
services.append(p)
|
||||||
return services
|
return services
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ from loguru import logger
|
|||||||
class PipelineParams(BaseModel):
|
class PipelineParams(BaseModel):
|
||||||
allow_interruptions: bool = False
|
allow_interruptions: bool = False
|
||||||
enable_metrics: bool = False
|
enable_metrics: bool = False
|
||||||
|
send_initial_empty_metrics: bool = True
|
||||||
report_only_initial_ttfb: bool = False
|
report_only_initial_ttfb: bool = False
|
||||||
|
|
||||||
|
|
||||||
@@ -106,7 +107,9 @@ class PipelineTask:
|
|||||||
report_only_initial_ttfb=self._params.report_only_initial_ttfb
|
report_only_initial_ttfb=self._params.report_only_initial_ttfb
|
||||||
)
|
)
|
||||||
await self._source.process_frame(start_frame, FrameDirection.DOWNSTREAM)
|
await self._source.process_frame(start_frame, FrameDirection.DOWNSTREAM)
|
||||||
await self._source.process_frame(self._initial_metrics_frame(), FrameDirection.DOWNSTREAM)
|
|
||||||
|
if self._params.send_initial_empty_metrics:
|
||||||
|
await self._source.process_frame(self._initial_metrics_frame(), FrameDirection.DOWNSTREAM)
|
||||||
|
|
||||||
running = True
|
running = True
|
||||||
should_cleanup = True
|
should_cleanup = True
|
||||||
|
|||||||
Reference in New Issue
Block a user