Stats collect v2 (#1291)
* initial commit * add correct label * clean up * more cleanup on adding stats * cleanup * move things to pub and sub monitors, ensure stats are correctly updated * fix merge conflict * Fix panic on MacOS (#1296) * fixing last feedback Co-authored-by: Raja Subramanian <raja.gobi@tutanota.com>
This commit is contained in:
co-authored by
Raja Subramanian
parent
0ca80a4fa7
commit
4d6f0cd0f7
@@ -6,7 +6,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gammazero/deque"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
)
|
||||
@@ -73,6 +75,10 @@ func (s *SubscriptionMonitor) PostEvent(ome types.OperationMonitorEvent, omd typ
|
||||
}
|
||||
|
||||
func (s *SubscriptionMonitor) updateSubscription(params SubscriptionOpParams) {
|
||||
if params.IsSubscribe {
|
||||
prometheus.AddSubscribeAttempt(params.SourceTrack.Kind().String())
|
||||
}
|
||||
|
||||
s.lock.Lock()
|
||||
|
||||
so := s.getOrCreateSubscriptionOpsForSource(params.SourceTrack)
|
||||
@@ -171,6 +177,10 @@ func (s *SubscriptionMonitor) update() {
|
||||
break
|
||||
}
|
||||
|
||||
if tx.isSubscribe && so.subscribedTrack != nil {
|
||||
prometheus.AddSubscribeSuccess(so.subscribedTrack.MediaTrack().Kind().String())
|
||||
}
|
||||
|
||||
if so.desiredTransitions.Len() == 0 && so.subscribedTrack == nil {
|
||||
delete(s.subscriptionOpsBySource, sourceTrack)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user