question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HealthIndicator with registry

See original GitHub issue

Enhancement

Currently, in resilience4j-spring-boot2, HealthIndicator is made with each CircuitBreaker or RateLimiter.

If make HealthIndicator with Registry, it doesn’t need to add HealthIndicator Singleton on each time CircuitBreaker is created. We can just return with CircuitBreakerRegistry.getAllCircuitBreakers().

public class CircuitBreakerHealthIndicator implements HealthIndicator {
	
	private final CircuitBreakerRegistry circuitBreakerRegistry;

	@Override
	public Health health() {
		return Optional.of(CircuitBreakerRegistry.getAllCircuitBreakers())
			...;
	}
} 

With CompositeHealthIndicatorConfiguration, there is no need to register to HealthIndicatorRegistry manually. So it would be more easier to control HealthIndicator.

Additionally, without org.springframework.boot:spring-boot-starter-actuator, resilience4j-spring-boot2 cannot run. Error log is below.

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.health.HealthIndicatorRegistry
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
	... 48 common frames omitted

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
RobWincommented, Aug 19, 2019

Thanks for your contributions.

1reaction
dlsrb6342commented, Aug 16, 2019

Ok. I’ll make HealthIndicator with Registry.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HealthIndicatorRegistry (Spring Boot 2.3.12.RELEASE API)
Returns a snapshot of the registered health indicators and their names. void, register(String name, HealthIndicator healthIndicator). Deprecated. Registers the ...
Read more >
Health Indicators in Spring Boot - Baeldung
In addition to the built-in ones, we can register custom HealthIndicators to report the health of a component or subsystem. In order to...
Read more >
org.springframework.boot.actuate.health ... - Tabnine
public void addHealthIndicator(String name, HealthIndicator indicator) { this.registry.register(name, indicator);
Read more >
Add and remove Spring Boot health checks dynamically
Whenever the health endpoint is queried, the registry is asked for a snapshot ... It could then call register(String, HealthIndicator) and ...
Read more >
Spring Boot & Kubernetes - Cloud Native Tutorials
Health Check Actuator; Custom Health Indicator; Custom Configuration ... set the actuator dependencies, so we don't need to register them in the pom.xml...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found