Add stream health overview collection + apis
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/owncast/owncast/core"
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/metrics"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/router/middleware"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@@ -16,11 +17,12 @@ func Status(w http.ResponseWriter, r *http.Request) {
|
||||
broadcaster := core.GetBroadcaster()
|
||||
status := core.GetStatus()
|
||||
currentBroadcast := core.GetCurrentBroadcast()
|
||||
|
||||
health := metrics.GetStreamHealthOverview()
|
||||
response := adminStatusResponse{
|
||||
Broadcaster: broadcaster,
|
||||
CurrentBroadcast: currentBroadcast,
|
||||
Online: status.Online,
|
||||
Health: health,
|
||||
ViewerCount: status.ViewerCount,
|
||||
OverallPeakViewerCount: status.OverallMaxViewerCount,
|
||||
SessionPeakViewerCount: status.SessionMaxViewerCount,
|
||||
@@ -38,12 +40,13 @@ func Status(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
type adminStatusResponse struct {
|
||||
Broadcaster *models.Broadcaster `json:"broadcaster"`
|
||||
CurrentBroadcast *models.CurrentBroadcast `json:"currentBroadcast"`
|
||||
Online bool `json:"online"`
|
||||
ViewerCount int `json:"viewerCount"`
|
||||
OverallPeakViewerCount int `json:"overallPeakViewerCount"`
|
||||
SessionPeakViewerCount int `json:"sessionPeakViewerCount"`
|
||||
StreamTitle string `json:"streamTitle"`
|
||||
VersionNumber string `json:"versionNumber"`
|
||||
Broadcaster *models.Broadcaster `json:"broadcaster"`
|
||||
CurrentBroadcast *models.CurrentBroadcast `json:"currentBroadcast"`
|
||||
Online bool `json:"online"`
|
||||
ViewerCount int `json:"viewerCount"`
|
||||
OverallPeakViewerCount int `json:"overallPeakViewerCount"`
|
||||
SessionPeakViewerCount int `json:"sessionPeakViewerCount"`
|
||||
StreamTitle string `json:"streamTitle"`
|
||||
Health *models.StreamHealthOverview `json:"health"`
|
||||
VersionNumber string `json:"versionNumber"`
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncast/owncast/metrics"
|
||||
"github.com/owncast/owncast/utils"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -32,9 +33,11 @@ func ReportPlaybackMetrics(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
metrics.RegisterPlaybackErrorCount(request.Errors)
|
||||
metrics.RegisterPlayerBandwidth(request.Bandwidth)
|
||||
metrics.RegisterPlayerLatency(request.Latency)
|
||||
metrics.RegisterPlayerSegmentDownloadDuration(request.DownloadDuration)
|
||||
metrics.RegisterQualityVariantChangesCount(request.QualityVariantChanges)
|
||||
clientID := utils.GenerateClientIDFromRequest(r)
|
||||
|
||||
metrics.RegisterPlaybackErrorCount(clientID, request.Errors)
|
||||
metrics.RegisterPlayerBandwidth(clientID, request.Bandwidth)
|
||||
metrics.RegisterPlayerLatency(clientID, request.Latency)
|
||||
metrics.RegisterPlayerSegmentDownloadDuration(clientID, request.DownloadDuration)
|
||||
metrics.RegisterQualityVariantChangesCount(clientID, request.QualityVariantChanges)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user