feat: add status probe

This commit is contained in:
2022-04-15 09:20:28 +02:00
parent c23bc5cbbe
commit ccec4f70dd
33 changed files with 4191 additions and 5 deletions

View File

@@ -1,16 +1,19 @@
package main
import (
"context"
"domogeek/calendar"
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"time"
"github.com/hellofresh/health-go/v4"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"net/http"
"time"
)
var (
@@ -107,5 +110,16 @@ func main() {
&CalendarHandler{})))
http.Handle("/calendar", &h)
http.Handle("/metrics", promhttp.Handler())
healthz, _ := health.New(health.WithChecks(health.Config{
Name: "calendar",
Timeout: time.Second * 5,
SkipOnErr: false,
Check: func(ctx context.Context) error {
return nil
},
},
))
http.Handle("/status", healthz.Handler())
log.Fatal(http.ListenAndServe(addr, nil))
}