tech.jhipster.config.metric.JHipsterMetricsEndpointConfiguration Maven / Gradle / Ivy
package tech.jhipster.config.metric;
import io.micrometer.core.annotation.Timed;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* JHipsterMetricsEndpointConfiguration class.
*/
@Configuration
@ConditionalOnClass(Timed.class)
@AutoConfigureAfter(MetricsEndpointAutoConfiguration.class)
public class JHipsterMetricsEndpointConfiguration {
/**
* jHipsterMetricsEndpoint.
*
* @param meterRegistry a {@link io.micrometer.core.instrument.MeterRegistry} object.
* @return a {@link JHipsterMetricsEndpoint} object.
*/
@Bean
@ConditionalOnBean({MeterRegistry.class})
@ConditionalOnMissingBean
@ConditionalOnAvailableEndpoint
public JHipsterMetricsEndpoint jHipsterMetricsEndpoint(MeterRegistry meterRegistry) {
return new JHipsterMetricsEndpoint(meterRegistry);
}
}