updated deps; updated healthchecks.io integration
This commit is contained in:
20
cmd/cmd.go
20
cmd/cmd.go
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -15,7 +16,7 @@ import (
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/mileusna/crontab"
|
||||
"github.com/rs/zerolog"
|
||||
"gitlab.com/etke.cc/go/healthchecks"
|
||||
"gitlab.com/etke.cc/go/healthchecks/v2"
|
||||
"gitlab.com/etke.cc/go/psd"
|
||||
"gitlab.com/etke.cc/linkpearl"
|
||||
|
||||
@@ -85,14 +86,18 @@ func initLog(cfg *config.Config) {
|
||||
}
|
||||
|
||||
func initHealthchecks(cfg *config.Config) {
|
||||
if cfg.Monitoring.HealchecksUUID == "" {
|
||||
if cfg.Monitoring.HealthchecksUUID == "" {
|
||||
return
|
||||
}
|
||||
hc = healthchecks.New(cfg.Monitoring.HealchecksUUID, func(operation string, err error) {
|
||||
log.Error().Err(err).Str("operation", operation).Msg("healthchecks operation failed")
|
||||
})
|
||||
hc = healthchecks.New(
|
||||
healthchecks.WithBaseURL(cfg.Monitoring.HealthchecksURL),
|
||||
healthchecks.WithCheckUUID(cfg.Monitoring.HealthchecksUUID),
|
||||
healthchecks.WithErrLog(func(operation string, err error) {
|
||||
log.Error().Err(err).Str("operation", operation).Msg("healthchecks operation failed")
|
||||
}),
|
||||
)
|
||||
hc.Start(strings.NewReader("starting postmoogle"))
|
||||
go hc.Auto(cfg.Monitoring.HealthechsDuration)
|
||||
go hc.Auto(cfg.Monitoring.HealthchecksDuration)
|
||||
}
|
||||
|
||||
func initMatrix(cfg *config.Config) {
|
||||
@@ -200,6 +205,9 @@ func recovery() {
|
||||
defer shutdown()
|
||||
err := recover()
|
||||
if err != nil {
|
||||
if hc != nil {
|
||||
hc.ExitStatus(1, strings.NewReader(fmt.Sprintf("panic: %v", err)))
|
||||
}
|
||||
sentry.CurrentHub().Recover(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user