mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-14 18:15:37 +00:00
Some checks failed
Build Snapshot / build-snapshot (push) Waiting to run
DevSkim / DevSkim (push) Waiting to run
Buf CI / buf (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Codestyle checks / codestyle (push) Has been cancelled
20 lines
505 B
Go
20 lines
505 B
Go
package httpservers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
config "github.com/OliveTin/OliveTin/internal/config"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/collectors"
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
)
|
|
|
|
func StartPrometheus(cfg *config.Config) {
|
|
if !cfg.Prometheus.DefaultGoMetrics {
|
|
prometheus.Unregister(collectors.NewGoCollector())
|
|
}
|
|
|
|
http.Handle("/", promhttp.Handler())
|
|
http.ListenAndServe(cfg.ListenAddressPrometheus, nil)
|
|
}
|