mirror of
https://github.com/cooperspencer/gickup
synced 2025-04-30 18:27:56 +02:00
* 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 <>
19 lines
351 B
Go
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())
|
|
}
|
|
}
|
|
}
|