cooperspencer / gickup

https://cooperspencer.github.io/gickup-documentation/
Apache License 2.0
962 stars 34 forks source link

feat: add heartbeat metrics #100

Closed mtoohey31 closed 2 years ago

mtoohey31 commented 2 years ago

Prometheus is a bit overkill for my use case, so I was wondering if you'd be interested in adding a more simple metrics option. Basically, if the user provides a non-empty URL, gickup makes a GET request to the URL after each backup. I totally understand if this seems like an unecessary feature though. Similar functionality can already be accomplished by using your own scheduling method and making the request with CURL if gickup exited successfully, though this feels kind of hacky too since scheduling is already built-in.

If you're interested in adding this feature, I had one implementation question: should I make the config section a mapping with a url key so we can expand it without breaking changes if neccessary (though I can't think of how we'd need to), or should I just make heartbeat a string that takes the url?

cooperspencer commented 2 years ago

I am not against, but I don't really get the use case. In my opinion a heartbeat would make more sense for the sources/destinations if they are reachable.

Otherwise if you want to implement it like this, I think the url parameter is fine. Maybe it makes sense to make a list of urls, if there is more to monitor.

mtoohey31 commented 2 years ago

My specific usecase is https://healthchecks.io/. I have a handful of scripts running here and there for backups and other important things that need to run on a regular schedule, so I have them make a request to there whenever they succeed, and that service notifies me if they haven't checked in within the required interval.

Having multiple urls is definitely a good idea, but thinking about this more, it kind of feels like feature creep. Like I mentioned, this is already possible if you use an external cron scheduler to schedule gickup conf.yaml && curl ..., so I think what I'll do is create a repo with a Dockerfile that extends the main gickup container and takes the URL(s) as an environment variable. I'll link it here once it's done in case anyone looking for a similar solution comes across this PR.