feat: shared HTTP client pool with per-host budgets - #732
Closed
Killerjunior wants to merge 1 commit into
Closed
Killerjunior wants to merge 1 commit into
Killerjunior wants to merge 1 commit into
Conversation
|
@Killerjunior Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Author
|
Review please. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduces a shared, resilient HTTP client pool in
internal/httpxwith per-host connection budgets, per-host circuit breakers, and periodic DNS refresh to avoid stale A-record connection storms during failovers.Changes Included
1. Core HTTP Client Pool (
internal/httpx)MaxConnsPerHostandMaxIdleConnsPerHostlimits per remote target host to prevent noisy neighbors from starving outbound slots.gobreakerstate per host to fast-fail requests withErrCircuitOpenwhen upstream failure thresholds are breached.net.Resolverwith a pluggableClockinterface. Automatically re-resolves target hosts whenDNSTTLexpires (or on every dial whenDNSTTL = 0). Recycles idle connections whenever host address changes occur.http_client_conn_reuse_ratiogauge labeled byhostto monitor connection reuse efficiency.2. Outbox & Integrations Wiring
HTTPPublisherandSlackPublisherthroughhttpx.PoolviaPooledHTTPClientandPooledSlackClient.outbox.NewServiceto accept optional customHTTPPoolwhile defaulting to the package-level shared pool.internal/integrations/pagerduty) to back outbound event delivery using the sharedhttpx.Pool.Verification
internal/httpx/client_test.gocovering:Closes #687