owncast/webserver/handlers/adminApiHardwareStats.go
Gabe Kangas b80ccc4966
WIP
2024-03-25 09:04:05 -07:00

21 lines
434 B
Go

package handlers
import (
"encoding/json"
"net/http"
"github.com/owncast/owncast/services/metrics"
log "github.com/sirupsen/logrus"
)
// GetHardwareStats will return hardware utilization over time.
func (h *Handlers) GetHardwareStats(w http.ResponseWriter, r *http.Request) {
m := metrics.Get()
w.Header().Set("Content-Type", "application/json")
err := json.NewEncoder(w).Encode(m)
if err != nil {
log.Errorln(err)
}
}