summaryrefslogtreecommitdiffstats
path: root/internal/metrics/metrics.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/metrics/metrics.go')
-rw-r--r--internal/metrics/metrics.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/metrics/metrics.go b/internal/metrics/metrics.go
index 9030d67..9030775 100644
--- a/internal/metrics/metrics.go
+++ b/internal/metrics/metrics.go
@@ -1,6 +1,7 @@
1package metrics 1package metrics
2 2
3import ( 3import (
4 _ "embed"
4 "net/http" 5 "net/http"
5 6
6 "github.com/prometheus/client_golang/prometheus" 7 "github.com/prometheus/client_golang/prometheus"
@@ -284,8 +285,15 @@ const (
284 StatusInvalidRequest RequestStatus = "invalid_request" 285 StatusInvalidRequest RequestStatus = "invalid_request"
285) 286)
286 287
288//go:embed dashboard.html
289var dashboardHTML []byte
290
287func (m *Metrics) Serve(addr, path string) error { 291func (m *Metrics) Serve(addr, path string) error {
288 mux := http.NewServeMux() 292 mux := http.NewServeMux()
289 mux.Handle(path, promhttp.Handler()) 293 mux.Handle(path, promhttp.Handler())
294 mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
295 w.Header().Set("Content-Type", "text/html; charset=utf-8")
296 w.Write(dashboardHTML)
297 })
290 return http.ListenAndServe(addr, mux) 298 return http.ListenAndServe(addr, mux)
291} 299}