mirror of
https://github.com/livekit/livekit.git
synced 2026-05-25 01:35:39 +00:00
Send room name along in stat message (#205)
Signed-off-by: shishir gowda <shishir@livekit.io>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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=
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user