Surface the % of players represented in metrics
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"github.com/owncast/owncast/core"
|
||||
"github.com/owncast/owncast/utils"
|
||||
)
|
||||
|
||||
@@ -326,3 +327,11 @@ func collectQualityVariantChanges() {
|
||||
func GetQualityVariantChangesOverTime() []TimestampedValue {
|
||||
return metrics.qualityVariantChanges
|
||||
}
|
||||
|
||||
// GetPlaybackMetricsRepresentation returns what percentage of all known players
|
||||
// the metrics represent.
|
||||
func GetPlaybackMetricsRepresentation() int {
|
||||
totalPlayerCount := len(core.GetActiveViewers())
|
||||
representation := utils.IntPercentage(len(windowedBandwidths), totalPlayerCount)
|
||||
return representation
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user