mirror of
https://github.com/owncast/owncast.git
synced 2024-11-23 05:14:20 +03:00
4d2066a76d
* Start cleaning up linter errors. For #357 * Fix unmarshalling NullTime values * More linter fixes * Remove commented code * Move defer up * Consolidate error check lines * Move error check to make sure row iteration was successful * Cleaner error check + do not recreate pipe if it exists * Consolidate hashing to generate client id
19 lines
458 B
Go
19 lines
458 B
Go
package admin
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/owncast/owncast/metrics"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// GetViewersOverTime will return the number of viewers at points in time.
|
|
func GetViewersOverTime(w http.ResponseWriter, r *http.Request) {
|
|
viewersOverTime := metrics.Metrics.Viewers
|
|
w.Header().Set("Content-Type", "application/json")
|
|
err := json.NewEncoder(w).Encode(viewersOverTime)
|
|
if err != nil {
|
|
log.Errorln(err)
|
|
}
|
|
}
|