Commit 6605c92a authored by Kevin Lyda's avatar Kevin Lyda 💬

More tweaks on web server.

parent d072b3dd
Pipeline #1219 passed with stage
in 1 minute
...@@ -8,15 +8,23 @@ ...@@ -8,15 +8,23 @@
package main package main
import ( import (
"flag"
"fmt" "fmt"
"log"
"net/http" "net/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
) )
var addr = flag.String("listen-address", ":8080", "Address for HTTP requests.")
func metricsHandler(w http.ResponseWriter, r *http.Request) { func metricsHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Some metrics.") fmt.Fprintf(w, "Some metrics.")
} }
func main() { func main() {
flag.Parse()
http.HandleFunc("/", metricsHandler) http.HandleFunc("/", metricsHandler)
http.ListenAndServe(":8080", nil) http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(*addr, nil))
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment