Take control over your live stream video by running it yourself. Streaming + chat out of the box.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
649 B

package metrics
import (
"time"
)
// How often we poll for updates
const metricsPollingInterval = 15 * time.Second
type metrics struct {
CPUUtilizations []timestampedValue
RAMUtilizations []timestampedValue
Viewers []timestampedValue
}
// Metrics is the shared Metrics instance
var Metrics *metrics
// Start will begin the metrics collection and alerting
func Start() {
Metrics = new(metrics)
startViewerCollectionMetrics()
for range time.Tick(metricsPollingInterval) {
handlePolling()
}
}
func handlePolling() {
// Collect hardware stats
collectCPUUtilization()
collectRAMUtilization()
// Alerting
handleAlerting()
}