Log stats worker when it not closable. (#4313)
This commit is contained in:
@@ -132,7 +132,6 @@ func (t *telemetryService) ParticipantActive(
|
|||||||
guard,
|
guard,
|
||||||
)
|
)
|
||||||
if !found {
|
if !found {
|
||||||
// need to also account for participant count
|
|
||||||
prometheus.AddParticipant()
|
prometheus.AddParticipant()
|
||||||
}
|
}
|
||||||
worker.SetConnected()
|
worker.SetConnected()
|
||||||
@@ -193,6 +192,15 @@ func (t *telemetryService) ParticipantLeft(ctx context.Context,
|
|||||||
isConnected = worker.IsConnected()
|
isConnected = worker.IsConnected()
|
||||||
if worker.Close(guard) {
|
if worker.Close(guard) {
|
||||||
prometheus.SubParticipant()
|
prometheus.SubParticipant()
|
||||||
|
} else {
|
||||||
|
logger.Infow(
|
||||||
|
"stats worker active",
|
||||||
|
"room", room.Name,
|
||||||
|
"roomID", room.Sid,
|
||||||
|
"participant", participant.Identity,
|
||||||
|
"pID", participant.Sid,
|
||||||
|
"worker", worker,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.uber.org/zap/zapcore"
|
||||||
"google.golang.org/protobuf/types/known/timestamppb"
|
"google.golang.org/protobuf/types/known/timestamppb"
|
||||||
|
|
||||||
"github.com/livekit/livekit-server/pkg/utils"
|
"github.com/livekit/livekit-server/pkg/utils"
|
||||||
@@ -51,6 +52,13 @@ func (s *ReferenceCount) Release(guard *ReferenceGuard) bool {
|
|||||||
return s.count == 0
|
return s.count == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s ReferenceCount) MarshalLogObject(e zapcore.ObjectEncoder) error {
|
||||||
|
e.AddInt("count", s.count)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------
|
||||||
|
|
||||||
// StatsWorker handles participant stats
|
// StatsWorker handles participant stats
|
||||||
type StatsWorker struct {
|
type StatsWorker struct {
|
||||||
next *StatsWorker
|
next *StatsWorker
|
||||||
@@ -192,6 +200,20 @@ func (s *StatsWorker) collectStats(
|
|||||||
return stats
|
return stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StatsWorker) MarshalLogObject(e zapcore.ObjectEncoder) error {
|
||||||
|
s.lock.RLock()
|
||||||
|
defer s.lock.RUnlock()
|
||||||
|
|
||||||
|
e.AddString("room", string(s.roomName))
|
||||||
|
e.AddString("roomID", string(s.roomID))
|
||||||
|
e.AddString("participant", string(s.participantIdentity))
|
||||||
|
e.AddString("pID", string(s.participantID))
|
||||||
|
e.AddBool("isConnected", s.isConnected)
|
||||||
|
e.AddTime("closedAt", s.closedAt)
|
||||||
|
e.AddObject("refCount", s.refCount)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
// create a single stream and single video layer post aggregation
|
// create a single stream and single video layer post aggregation
|
||||||
|
|||||||
Reference in New Issue
Block a user