Add support for auto-provisioning Healthchecks jobs #815

Closed
opened 2024-01-18 23:31:44 +00:00 by barry-luijten · 4 comments

What I would like to do

I'm a happy user of borgmatic (running on Docker Swarm) combined with a self-hosted version of Healthchecks. Since Healthchecks version 3.0, their Ping API supports the create query parameter, which allows you to auto-provision checks for the slug that you are passing. I have configured borgmatic to use an "archive-prefix" constant as a base for the archive names and I'm using this same constant as a slug in the healthchecks url, instead of a check uuid. Each backup job therefore has its own check and I can track progress/failure for each of them. If you are adding a bunch of jobs to borgmatic, it can be tedious and easily forgotten to provision the Healthchecks checks manually for all added jobs.

What I have tried

I have searched the borgmatic documentation, but I could not find an option to specify this query parameter, which should be added to each call that is made to Healthchecks. It cannot be added to the ping_url configuration key, because that url is merely a prefix for the full url that is eventually called by borgmatic.

What I propose

Add support for a configuration option that enables or disables Healthchecks check-auto-provisioning. When the option is enabled, a query parameter ?create=1 will be added to each call that is made to Healthchecks. When the option is disabled, no query parameter is added to the call.

Additional information

Healthchecks Ping API documentation

Other notes / implementation ideas

No response

## What I would like to do I'm a happy user of borgmatic (running on Docker Swarm) combined with a self-hosted version of Healthchecks. Since Healthchecks version 3.0, their Ping API supports the `create` query parameter, which allows you to auto-provision checks for the slug that you are passing. I have configured borgmatic to use an "archive-prefix" constant as a base for the archive names and I'm using this same constant as a slug in the healthchecks url, instead of a check uuid. Each backup job therefore has its own check and I can track progress/failure for each of them. If you are adding a bunch of jobs to borgmatic, it can be tedious and easily forgotten to provision the Healthchecks checks manually for all added jobs. ## What I have tried I have searched the borgmatic documentation, but I could not find an option to specify this query parameter, which should be added to each call that is made to Healthchecks. It cannot be added to the ping_url configuration key, because that url is merely a prefix for the full url that is eventually called by borgmatic. ## What I propose Add support for a configuration option that enables or disables Healthchecks check-auto-provisioning. When the option is enabled, a query parameter `?create=1` will be added to each call that is made to Healthchecks. When the option is disabled, no query parameter is added to the call. ## Additional information [Healthchecks Ping API documentation](https://healthchecks.io/docs/http_api/#start-slug) ### Other notes / implementation ideas _No response_
Owner

Makes sense to me.. Thanks for taking the time to file this! I'm thinking this feature should be disabled by default, such that you have to opt into it with a borgmatic configuration option.. And maybe the new configuration option should look something like this?

healthchecks:
    ping_url: https://hc-ping.com/addffa72-da17-40ae-be9c-ff591afb942a
    create: true

Let me know your thoughts.

Makes sense to me.. Thanks for taking the time to file this! I'm thinking this feature should be disabled by default, such that you have to opt into it with a borgmatic configuration option.. And maybe the new configuration option should look something like this? ```yaml healthchecks: ping_url: https://hc-ping.com/addffa72-da17-40ae-be9c-ff591afb942a create: true ``` Let me know your thoughts.
Author

Thank you @witten! I agree that the option should be disabled by default, since this is also the default in the Healtchecks API. Using the same name for the configuration option sounds consistent too. There is one catch: the create param is only valid when you are using slugs, combined with a ping-key. So maybe it's better to name the option create_slug or auto_create_slug, so it's clear that this only works when using this url scheme https://hc-ping.com/<ping-key>/<slug> as opposed to https://hc-ping.com/<uuid>.

Thank you @witten! I agree that the option should be disabled by default, since this is also the default in the Healtchecks API. Using the same name for the configuration option sounds consistent too. There is one catch: the create param is only valid when you are using slugs, combined with a ping-key. So maybe it's better to name the option `create_slug` or `auto_create_slug`, so it's clear that this only works when using this url scheme `https://hc-ping.com/<ping-key>/<slug>` as opposed to `https://hc-ping.com/<uuid>`.
Owner

Sounds good, thanks!

Sounds good, thanks!
witten added the
good first issue
label 2024-01-19 19:59:52 +00:00
Owner

Implemented by @estebanthi in main and will be part of the next release!

Implemented by @estebanthi in main and will be part of the next release!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#815
No description provided.