vector icon indicating copy to clipboard operation
vector copied to clipboard

Healthcheck settings are ignored for connections to the database in Postgres sink

Open simplepad opened this issue 6 months ago • 3 comments

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

I noticed that setting healthcheck.enabled to false doesn't prevent vector from exiting with an error if the endpoint specified in the endpoint doesn't exist when it starts up. That is, if vector starts up earlier than postgres, it will exit with an error regardless of the healthcheck.enabled setting.

Configuration

sources:
  stdin:
    type: stdin

sinks:
  postgres:
    type: postgres
    table: test
    endpoint: "psql://127.0.0.1:9000" # invalid when vector starts
    healthcheck:
      enabled: false # the important bit
    inputs:
      - stdin

Version

0.47.0

Debug Output


Example Data

No response

Additional Context

No response

References

https://github.com/vectordotdev/vector/pull/21248#issuecomment-2910373131

simplepad avatar May 26 '25 18:05 simplepad

@jorgehermo9 created the issue here

simplepad avatar May 26 '25 18:05 simplepad

Responding to https://github.com/vectordotdev/vector/pull/21248#issuecomment-2910373131:

When the healthcheck is disabled, we want to be as permissive as possible assuming the environment will recover later, so ideally we would start the Vector instance when the healthcheck is disabled.

pront avatar Jun 10 '25 19:06 pront

I think the fix would be very easy, just replace connect with connect_lazy in sqlx's Pool https://docs.rs/sqlx/latest/sqlx/struct.Pool.html#method.connect_lazy

I can submit a PR with this change (and tests)

jorgehermo9 avatar Jun 11 '25 16:06 jorgehermo9

Working on this! fighting with tests mostly 😄

jorgehermo9 avatar Jul 23 '25 21:07 jorgehermo9