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

Instrument circuit breaker in the connection pool #1693

Merged
merged 2 commits into from
Nov 3, 2023
Merged

Conversation

jguerra
Copy link
Contributor

@jguerra jguerra commented Nov 2, 2023

If a connection error rate is too high (as measured by DiscoveryResult.isCircuitBreakerTripped()) an active connection is closed when trying to return it to the pool. I don't think this is a great pattern, but I wanted to be able to measure it before making any changes. I added a new counter to track connections closed due to the circuit breaker

I also replaced SpectatorUtils with the injected registry

this.maxConnsPerHostExceededCounter =
SpectatorUtils.newCounter(METRIC_PREFIX + "_maxConnsPerHostExceeded", metricId);
this.closeWrtBusyConnCounter = SpectatorUtils.newCounter(METRIC_PREFIX + "_closeWrtBusyConnCounter", metricId);
this.createNewConnCounter = newCounter("_create");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move the _ to the newCounter and newGauge functions so these all read a bit better 😅

@jguerra jguerra merged commit d97cead into master Nov 3, 2023
5 checks passed
@jguerra jguerra deleted the jg/circuitBreaker branch February 29, 2024 20:38
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.

2 participants