Skip to content

Commit c2ce760

Browse files
enhance: add timeout resilience to Docker acquisition (socket proxy errors) (#3873)
* feat: add timeout resilience to Docker acquisition - Add configurable retry mechanism for Docker log readers - Implement per-container log options to prevent race conditions - Add intelligent consecutive failure tracking with reset logic - Use typed errors for better failure classification - Preserve EOF-resilient behavior with proper Since timestamp management Fixes socket proxy timeout issues that previously caused containers to be permanently removed from monitoring after temporary failures. * fix: address linting errors in docker acquisition - Fix indent-error-flow: remove unnecessary else clause - Fix early-return: invert conditions to reduce nesting - Improve code readability and follow Go best practices * feat: add configurable retry mechanism for Docker acquisition - Add RetryBackoffDuration config option (default: 5s) - Fix race condition with shared Since timestamp by creating per-container log options - Implement container/service health checks via Docker API instead of log activity - Add EOF-resilient retry logic that distinguishes between container death and network issues - Simplify retry mechanism: indefinite retries for healthy containers with backoff - Fix test mocks to properly initialize ContainerState and add ServiceInspectWithRaw Fixes timeout issues when using Docker socket proxies by retrying failed connections while ensuring containers that are actually stopped are removed from monitoring. * enhance: remove retry count as we rely on container status * enhance: add log once reconnected and remove retry code since we know its running * enhance: clear up log confusion * fix: docker tests, what a mess * fix: docker tests, love you too CI * fix: docker tests, love you too CI * dry / extract constructor from closures * wip * backoff * 3 * simpler tests * deps: update github.com/cenkalti/backoff * lint --------- Co-authored-by: marco <[email protected]>
1 parent 757c323 commit c2ce760

File tree

4 files changed

+428
-196
lines changed

4 files changed

+428
-196
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/beevik/etree v1.4.1
2121
github.com/bluele/gcache v0.0.2
2222
github.com/buger/jsonparser v1.1.1
23-
github.com/cenkalti/backoff/v5 v5.0.2
23+
github.com/cenkalti/backoff/v5 v5.0.3
2424
github.com/cespare/xxhash/v2 v2.3.0
2525
github.com/corazawaf/coraza/v3 v3.3.3
2626
github.com/corazawaf/libinjection-go v0.2.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCN
109109
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
110110
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
111111
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
112-
github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8=
113-
github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
112+
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
113+
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
114114
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
115115
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
116116
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=

0 commit comments

Comments
 (0)