Configurable json body size for healthchecks hooks (don't truncate) #294

Closed
opened 3 years ago by nightah · 4 comments

What I'm trying to do and why

When using HTTP POST to the Healthchecks endpoint, you can include arbitrary payload in the request body. If the request body looks like a UTF-8 string, Healthchecks.io will log the first 10 kilobytes of the request body, so you can inspect it later.

This limit is now configurable/removable as part of 58a118c494.

Due to this I would like if we can configure the current truncation so that the full contents of a log can be POSTed to Healthchecks instead of the default 10kb.

Other notes / implementation ideas

This is a continuation of #241 and #249, to allow the full body of the borgmatic output to get to Healthchecks.

#### What I'm trying to do and why When using HTTP POST to the Healthchecks endpoint, you can include arbitrary payload in the request body. If the request body looks like a UTF-8 string, Healthchecks.io will log the first 10 kilobytes of the request body, so you can inspect it later. This limit is now configurable/removable as part of https://github.com/healthchecks/healthchecks/commit/58a118c49499ed814d3aedf3a761bc83624b460d. Due to this I would like if we can configure the current truncation so that the full contents of a log can be POSTed to Healthchecks instead of the default 10kb. #### Other notes / implementation ideas This is a continuation of #241 and #249, to allow the full body of the borgmatic output to get to Healthchecks.
Owner

Makes sense! I could see having a configuration option for setting the truncation size (or disabling truncation altogether).

I think the biggest challenge here is not implementing the configurable truncation, but rather figuring out how to fit the option into the current borgmatic config file schema.. The current schema looks like:

hooks:
    healthchecks: https://hc-ping.com/your-uuid-here

So the best option may be to change the single scalar value to a map. So something like:

hooks:
    healthchecks:
        url: https://hc-ping.com/your-uuid-here
        body_size: 1234

And then put in some code to make loading of the previous schema backwards-compatible. (There's precedent for that.)

Makes sense! I could see having a configuration option for setting the truncation size (or disabling truncation altogether). I think the biggest challenge here is not implementing the configurable truncation, but rather figuring out how to fit the option into the current borgmatic config file schema.. The current schema looks like: ```yaml hooks: healthchecks: https://hc-ping.com/your-uuid-here ``` So the best option may be to change the single scalar value to a map. So something like: ```yaml hooks: healthchecks: url: https://hc-ping.com/your-uuid-here body_size: 1234 ``` And then put in some code to make loading of the previous schema backwards-compatible. (There's precedent for that.)
Poster

Yep that looks great to me!

Yep that looks great to me!
witten added the
design finalized
label 2 years ago
Owner

Well, it took a while to get to it (my apologies!), but this is now implemented in master. There's a new ping_body_limit option under healthchecks: that you can set to a number of bytes or even set to zero to disable truncation. Thanks for suggesting this!

Well, it took a while to get to it (my apologies!), but this is now implemented in master. There's a new `ping_body_limit` option under `healthchecks:` that you can set to a number of bytes or even set to zero to disable truncation. Thanks for suggesting this!
witten closed this issue 3 months ago
Owner

Released in borgmatic 1.6.1!

Released in borgmatic 1.6.1!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#294
Loading…
There is no content yet.