transports(daily): don't send empty metrics
This commit is contained in:
@@ -678,12 +678,15 @@ class DailyOutputTransport(BaseOutputTransport):
|
|||||||
await self._client.send_message(frame)
|
await self._client.send_message(frame)
|
||||||
|
|
||||||
async def send_metrics(self, frame: MetricsFrame):
|
async def send_metrics(self, frame: MetricsFrame):
|
||||||
|
metrics = {}
|
||||||
|
if frame.ttfb:
|
||||||
|
metrics["ttfb"] = frame.ttfb
|
||||||
|
if frame.processing:
|
||||||
|
metrics["processing"] = frame.processing
|
||||||
|
|
||||||
message = DailyTransportMessageFrame(message={
|
message = DailyTransportMessageFrame(message={
|
||||||
"type": "pipecat-metrics",
|
"type": "pipecat-metrics",
|
||||||
"metrics": {
|
"metrics": metrics
|
||||||
"ttfb": frame.ttfb or [],
|
|
||||||
"processing": frame.processing or [],
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
await self._client.send_message(message)
|
await self._client.send_message(message)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user