| 178 | } |
| 179 | |
| 180 | func (s *StatsWorker) collectStats( |
| 181 | ts *timestamppb.Timestamp, |
| 182 | streamType livekit.StreamType, |
| 183 | perTrack map[livekit.TrackID][]*livekit.AnalyticsStat, |
| 184 | stats []*livekit.AnalyticsStat, |
| 185 | ) []*livekit.AnalyticsStat { |
| 186 | for trackID, analyticsStats := range perTrack { |
| 187 | coalesced := coalesce(analyticsStats) |
| 188 | if coalesced == nil { |
| 189 | continue |
| 190 | } |
| 191 | |
| 192 | coalesced.TimeStamp = ts |
| 193 | coalesced.TrackId = string(trackID) |
| 194 | coalesced.Kind = streamType |
| 195 | coalesced.RoomId = string(s.roomID) |
| 196 | coalesced.ParticipantId = string(s.participantID) |
| 197 | coalesced.RoomName = string(s.roomName) |
| 198 | stats = append(stats, coalesced) |
| 199 | } |
| 200 | return stats |
| 201 | } |
| 202 | |
| 203 | func (s *StatsWorker) MarshalLogObject(e zapcore.ObjectEncoder) error { |
| 204 | s.lock.RLock() |