Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect custom waitStrategy for InfluxDB #1

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

marcinmilewski93
Copy link
Owner

What does this PR do?

The purpose of this PR is to respect the provided waitStrategy for the InfluxDB container, rather than overriding it by default. This change allows the use of a custom waitStrategy when specified; if none is provided, the default waitStrategy will be applied, maintaining the same configuration as before this modification.

Why is it important?

In the current implementation, it's not possible to use a custom waitStrategy and in my case the default strategy marks the container as ready too early. The container is still not ready to receive writes. Customizing the waitStrategy to check the /health status solved this issue. Example log output when container is not ready yet:

2024/10/22 10:38:54 ✅ Container started: d5d6612ccd27
2024/10/22 10:38:54 ⏳ Waiting for container id d5d6612ccd27 image: influxdb:2.0.7. Waiting for: &{timeout:<nil> Log:Listening log_id=[0-9a-zA-Z_~]+ service=tcp-listener transport=http IsRegexp:true Occurrence:1 PollInterval:100ms}
2024/10/22 10:39:04 🔔 Container is ready: d5d6612ccd27
2024-10-22T10:39:23.408+07:00|2|ERROR||,,,testing-invalid|9469|goroutine:1783|internal/runner.go:93|Post "http://localhost:49155/api/v2/write?bucket=lp-batch&org=influxdata&precision=ns": read tcp [::1]:43726->[::1]:49155: read: connection reset by peer
2024/10/22 10:39:24 [E]! Write error: Post "http://localhost:49155/api/v2/write?bucket=lp-batch&org=influxdata&precision=ns": read tcp [::1]:55852->[::1]:49155: read: connection reset by peer
2024/10/22 10:39:24 unable to send metrics to InfluxDB. err=Post "http://localhost:49155/api/v2/write?bucket=lp-batch&org=influxdata&precision=ns": read tcp [::1]:55852->[::1]:49155: read: connection reset by peer

A different strategy could be employed, for example, to verify if InfluxDB is ready for queries and writes as you can see on below health check response:

{
  "name": "influxdb",
  "message": "ready for queries and writes",
  "status": "pass",
  "checks": [],
  "version": "2.0.7",
  "commit": "2a45f0c037"
}

Related issues

  • None

How to test this PR

I have added a test that uses a custom waitStrategy to verify this behavior.

@marcinmilewski93 marcinmilewski93 added the bug Something isn't working label Oct 22, 2024
@marcinmilewski93 marcinmilewski93 merged commit e667542 into influxdb_strategy Oct 22, 2024
@marcinmilewski93 marcinmilewski93 deleted the influxdb branch October 22, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant