1
1
mirror of https://github.com/cooperspencer/gickup synced 2024-09-18 23:01:35 +02:00
gickup/metrics/heartbeat/heartbeat.go
Jordan Crawford 510e234e52
feat: Support multiple heartbeat URLs (#109)
* feat: add heartbeat metrics

* feat: Support multiple heartbeat URLs

#100 introduced heartbeat support but only supported one URL. This PR was closed, however I've re-introduced this feature and added support for multiple heartbeat URLs as discussed in the #100 discussion.

This also resolves #108 which is a feature request for the heartbeat feature.

* fix: When sending the heartbeat fails, log an error but don't crash the program

This prevents problems with external services from causing the program to quit.

Co-authored-by: Matthew Toohey <contact@mtoohey.com>
Co-authored-by: Jordan Crawford <>
2022-05-17 13:12:07 +02:00

19 lines
351 B
Go

package heartbeat
import (
"net/http"
"github.com/cooperspencer/gickup/types"
"github.com/rs/zerolog/log"
)
func Send(conf types.HeartbeatConfig) {
for _, u := range conf.URLs {
log.Info().Str("url", u).Msg("sending heartbeat")
_, err := http.Get(u)
if err != nil {
log.Error().Str("monitoring", "heartbeat").Msg(err.Error())
}
}
}