mirror of
				https://github.com/owncast/owncast.git
				synced 2025-11-04 05:17:27 +08:00 
			
		
		
		
	* 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
		
			
				
	
	
		
			20 lines
		
	
	
		
			458 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			20 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)
 | 
						|
	}
 | 
						|
}
 |