Reputation: 51
I want configure actuator in a way that:
Security configuration is disabled:
management.security.enabled=false
And only available information is status:
"status" : "UP",
But after disabling security I get full complet of reduntant for me information. I tried to disable health properties but after disabling all I ended with:
"status" : "UP", "application", "UP"
Upvotes: 1
Views: 101
Reputation: 51
Ok I managed to do it. First I create own HealthEndpoint where I cut down information other than status:
public class StatusOnlyHealthEndpoint extends HealthEndpoint {
public StatusOnlyHealthEndpoint(final Map<String, HealthIndicator> healthIndicators) {
super(new OrderedHealthAggregator(), healthIndicators);
}
@Override
public Health invoke() {
Health health = super.invoke();
return Health.status(health.getStatus())
.build();
}}
Then I just override HealthEndpoint Bean with use of recent created Bean - thanks to that I can configure which indicators influence status from properties:
@Configuration
public class ApplicationHealth extends EndpointAutoConfiguration {
public ApplicationHealth(final ObjectProvider<HealthAggregator> healthAggregator,
final ObjectProvider<Map<String, HealthIndicator>> healthIndicators,
final ObjectProvider<List<InfoContributor>> infoContributors,
final ObjectProvider<Collection<PublicMetrics>> publicMetrics,
final ObjectProvider<TraceRepository> traceRepository) {
super(healthAggregator, healthIndicators, infoContributors, publicMetrics, traceRepository);
}
@Bean
@ConditionalOnMissingBean
public HealthEndpoint healthEndpoint() {
return new StatusOnlyHealthEndpoint(super.healthEndpoint());
}}
Upvotes: 1