MCPcopy
hub / github.com/livekit/livekit / collectStats

Method collectStats

pkg/telemetry/statsworker.go:180–201  ·  view source on GitHub ↗
(
	ts *timestamppb.Timestamp,
	streamType livekit.StreamType,
	perTrack map[livekit.TrackID][]*livekit.AnalyticsStat,
	stats []*livekit.AnalyticsStat,
)

Source from the content-addressed store, hash-verified

178}
179
180func (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
203func (s *StatsWorker) MarshalLogObject(e zapcore.ObjectEncoder) error {
204 s.lock.RLock()

Callers 1

FlushMethod · 0.95

Calls 1

coalesceFunction · 0.85

Tested by

no test coverage detected