diff --git a/go.mod b/go.mod index 49e111a9d..771ce1f46 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/gorilla/websocket v1.4.2 github.com/hashicorp/golang-lru v0.5.4 github.com/jxskiss/base62 v0.0.0-20191017122030-4f11678b909b - github.com/livekit/protocol v0.10.1 + github.com/livekit/protocol v0.10.2-0.20211123200935-68ce1a0d04d6 github.com/magefile/mage v1.11.0 github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0 github.com/mitchellh/go-homedir v1.1.0 diff --git a/go.sum b/go.sum index f6ee26e33..a923216d3 100644 --- a/go.sum +++ b/go.sum @@ -134,6 +134,8 @@ github.com/lithammer/shortuuid/v3 v3.0.6 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts= github.com/livekit/protocol v0.10.1 h1:soly7H4qPaEsVPyR8Wq5XyJXif/aycnoShb/gd+4Gn8= github.com/livekit/protocol v0.10.1/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg= +github.com/livekit/protocol v0.10.2-0.20211123200935-68ce1a0d04d6 h1:yRLUB1VtWZ//x/wk1Zeyz958DWE7dyTutdaIFK+Berw= +github.com/livekit/protocol v0.10.2-0.20211123200935-68ce1a0d04d6/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg= github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls= github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= diff --git a/pkg/telemetry/events.go b/pkg/telemetry/events.go index 47a9cca40..7fe219696 100644 --- a/pkg/telemetry/events.go +++ b/pkg/telemetry/events.go @@ -45,7 +45,7 @@ func (t *TelemetryService) RoomEnded(ctx context.Context, room *livekit.Room) { func (t *TelemetryService) ParticipantJoined(ctx context.Context, room *livekit.Room, participant *livekit.ParticipantInfo) { t.Lock() - t.workers[participant.Sid] = NewStatsWorker(t, room.Sid, participant.Sid) + t.workers[participant.Sid] = NewStatsWorker(t, room.Sid, participant.Sid, room.Name) t.Unlock() prometheus.AddParticipant() diff --git a/pkg/telemetry/statsworker.go b/pkg/telemetry/statsworker.go index e4b1712ad..a95dc4a1f 100644 --- a/pkg/telemetry/statsworker.go +++ b/pkg/telemetry/statsworker.go @@ -16,6 +16,7 @@ const updateFrequency = time.Second * 10 type StatsWorker struct { t *TelemetryService roomID string + roomName string participantID string sync.RWMutex @@ -37,11 +38,12 @@ type Stats struct { prevBytes uint64 } -func NewStatsWorker(t *TelemetryService, roomID, participantID string) *StatsWorker { +func NewStatsWorker(t *TelemetryService, roomID, participantID, roomName string) *StatsWorker { s := &StatsWorker{ t: t, roomID: roomID, participantID: participantID, + roomName: roomName, buffers: make(map[uint32]*buffer.Buffer), drain: make(map[uint32]bool), @@ -50,11 +52,13 @@ func NewStatsWorker(t *TelemetryService, roomID, participantID string) *StatsWor Kind: livekit.StreamType_UPSTREAM, RoomId: roomID, ParticipantId: participantID, + RoomName: roomName, }}, outgoing: &Stats{next: &livekit.AnalyticsStat{ Kind: livekit.StreamType_DOWNSTREAM, RoomId: roomID, ParticipantId: participantID, + RoomName: roomName, }}, close: make(chan struct{}, 1), @@ -163,6 +167,7 @@ func (s *StatsWorker) update(stats *Stats, ts *timestamppb.Timestamp) *livekit.A Kind: next.Kind, RoomId: s.roomID, ParticipantId: s.participantID, + RoomName: s.roomName, } next.TimeStamp = ts