Skip to content

fix(analytics): wait for logflare before starting vector#4989

Merged
jgoux merged 2 commits intosupabase:developfrom
okedeji:fix/vector-logflare-startup-race
Mar 25, 2026
Merged

fix(analytics): wait for logflare before starting vector#4989
jgoux merged 2 commits intosupabase:developfrom
okedeji:fix/vector-logflare-startup-race

Conversation

@okedeji
Copy link
Contributor

@okedeji okedeji commented Mar 25, 2026

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Vector starts before Logflare is ready to accept requests. During startup, Logflare returns 401 Unauthorized while its auth is still initializing. Vector treats 401 as a non-retriable client error (hardcoded in Vector's HTTP retry logic — only 408, 429, and 5xx are retried) and permanently drops those log batches. This results in missing startup logs in Studio and noisy error output in Vector's container logs.

What is the new behavior?

Vector's entrypoint now polls Logflare's health endpoint (/health) every 2 seconds before starting. Vector only launches once Logflare is confirmed ready, eliminating the 401 errors and ensuring all logs are delivered from the moment Vector starts collecting.

Tested locally — before: 37 x 401 errors, after: 0.

Additional context

Vector's HTTP sink retry logic is hardcoded and not configurable — 401 will never be retried regardless of retry_max_duration_secs. The wait loop uses wget which is already available in the Vector Alpine image (used by its own healthcheck).

@okedeji okedeji requested a review from a team as a code owner March 25, 2026 16:23
@aantti
Copy link

aantti commented Mar 25, 2026

@singh-inder, @luizfelmach fyi

@coveralls
Copy link

Pull Request Test Coverage Report for Build 23560482012

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 63.165%

Files with Coverage Reduction New Missed Lines %
internal/utils/git.go 5 57.14%
Totals Coverage Status
Change from base Build 23560420141: -0.02%
Covered Lines: 9193
Relevant Lines: 14554

💛 - Coveralls

@jgoux jgoux merged commit 3ea701e into supabase:develop Mar 25, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants