Search in sources :

Example 1 with RedisMetricRepository

use of org.springframework.boot.actuate.metrics.repository.redis.RedisMetricRepository in project cas by apereo.

the class CasMetricsRepositoryConfiguration method redisMetricWriter.

@ConditionalOnProperty(prefix = "cas.metrics.redis", name = "prefix")
@Bean
@ExportMetricWriter
public MetricWriter redisMetricWriter() {
    final MetricsProperties.Redis redis = casProperties.getMetrics().getRedis();
    final RedisObjectFactory factory = new RedisObjectFactory();
    final RedisConnectionFactory connectionFactory = factory.newRedisConnectionFactory(redis);
    return new RedisMetricRepository(connectionFactory, redis.getPrefix(), redis.getKey());
}
Also used : MetricsProperties(org.apereo.cas.configuration.model.core.metrics.MetricsProperties) RedisObjectFactory(org.apereo.cas.redis.core.RedisObjectFactory) RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory) RedisMetricRepository(org.springframework.boot.actuate.metrics.repository.redis.RedisMetricRepository) ExportMetricWriter(org.springframework.boot.actuate.autoconfigure.ExportMetricWriter) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty) Bean(org.springframework.context.annotation.Bean)

Aggregations

MetricsProperties (org.apereo.cas.configuration.model.core.metrics.MetricsProperties)1 RedisObjectFactory (org.apereo.cas.redis.core.RedisObjectFactory)1 ExportMetricWriter (org.springframework.boot.actuate.autoconfigure.ExportMetricWriter)1 RedisMetricRepository (org.springframework.boot.actuate.metrics.repository.redis.RedisMetricRepository)1 ConditionalOnProperty (org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)1 Bean (org.springframework.context.annotation.Bean)1 RedisConnectionFactory (org.springframework.data.redis.connection.RedisConnectionFactory)1