Sfu/buffer stats for telemetry (#173)

* more buffer stats for analytics

* update names

* fix jitter and lost rate

* don't return on participantLeft if they never published
This commit is contained in:
David Colburn
2021-11-09 02:06:07 -06:00
committed by GitHub
parent c5830f9060
commit bf46e998b2
9 changed files with 295 additions and 191 deletions
+16
View File
@@ -3,6 +3,7 @@ package service
import (
"context"
"errors"
"time"
"github.com/livekit/protocol/logger"
livekit "github.com/livekit/protocol/proto"
@@ -62,7 +63,9 @@ func (s *RecordingService) StartRecording(ctx context.Context, req *livekit.Star
return nil, err
}
logger.Debugw("recording started", "recordingID", recordingId)
s.telemetry.RecordingStarted(ctx, recordingId, req)
return &livekit.StartRecordingResponse{RecordingId: recordingId}, nil
}
@@ -142,6 +145,19 @@ func (s *RecordingService) resultsWorker() {
logger.Errorw("failed to read results", err)
continue
}
// log results
values := []interface{}{"recordingID", res.Id}
if res.Error != "" {
values = append(values, "error", res.Error)
} else {
values = append(values, "duration", time.Duration(res.Duration*1e9))
if res.DownloadUrl != "" {
values = append(values, "url", res.DownloadUrl)
}
}
logger.Debugw("recording ended", values...)
s.telemetry.RecordingEnded(res)
case <-s.shutdown:
_ = sub.Close()