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

Closed
opened 2020-02-18 07:47:18 +00:00 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.)
Author

Yep that looks great to me!

Yep that looks great to me!
witten added the
design finalized
label 2020-04-30 04:22:52 +00:00
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!
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
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#294
No description provided.