mirror of
https://github.com/nikdoof/hg612-exporter.git
synced 2025-12-14 10:42:16 +00:00
fix: add /metrics handler and stop logging
This commit is contained in:
@@ -2,11 +2,10 @@ package rest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/gorilla/handlers"
|
"net/http"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
@@ -17,11 +16,12 @@ func New(bind string) *Server {
|
|||||||
var s Server
|
var s Server
|
||||||
|
|
||||||
r := http.NewServeMux()
|
r := http.NewServeMux()
|
||||||
|
r.Handle("/metrics", promhttp.Handler())
|
||||||
r.Handle("/prometheus", promhttp.Handler())
|
r.Handle("/prometheus", promhttp.Handler())
|
||||||
|
|
||||||
server := http.Server{
|
server := http.Server{
|
||||||
Addr: bind,
|
Addr: bind,
|
||||||
Handler: handlers.LoggingHandler(os.Stdout, r),
|
Handler: r,
|
||||||
}
|
}
|
||||||
|
|
||||||
s.httpSrv = &server
|
s.httpSrv = &server
|
||||||
|
|||||||
Reference in New Issue
Block a user