Search in sources :

Example 1 with InfluxDbConnectionFactory

use of org.apereo.cas.influxdb.InfluxDbConnectionFactory in project cas by apereo.

the class CasMetricsRepositoryConfiguration method influxDbMetricsWriter.

@ConditionalOnProperty(prefix = "cas.metrics.influxDb", name = "url")
@Bean
@ExportMetricWriter
public GaugeWriter influxDbMetricsWriter() {
    final MetricsProperties.InfluxDb influxDb = casProperties.getMetrics().getInfluxDb();
    final InfluxDbConnectionFactory factory = new InfluxDbConnectionFactory(influxDb);
    return value -> {
        final Point point = Point.measurement(value.getName()).time(value.getTimestamp().getTime(), TimeUnit.MILLISECONDS).addField("value", value.getValue()).addField("name", value.getName()).tag("type", value.getClass().getSimpleName()).build();
        factory.write(point, influxDb.getDatabase());
    };
}
Also used : CasConfigurationProperties(org.apereo.cas.configuration.CasConfigurationProperties) Getter(lombok.Getter) MongoDbConnectionFactory(org.apereo.cas.mongo.MongoDbConnectionFactory) Date(java.util.Date) Autowired(org.springframework.beans.factory.annotation.Autowired) MetricsProperties(org.apereo.cas.configuration.model.core.metrics.MetricsProperties) StatsdMetricWriter(org.springframework.boot.actuate.metrics.statsd.StatsdMetricWriter) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) ToString(lombok.ToString) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty) MongoTemplate(org.springframework.data.mongodb.core.MongoTemplate) MetricWriter(org.springframework.boot.actuate.metrics.writer.MetricWriter) RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory) GaugeWriter(org.springframework.boot.actuate.metrics.writer.GaugeWriter) RedisObjectFactory(org.apereo.cas.redis.core.RedisObjectFactory) RedisMetricRepository(org.springframework.boot.actuate.metrics.repository.redis.RedisMetricRepository) InfluxDbConnectionFactory(org.apereo.cas.influxdb.InfluxDbConnectionFactory) Serializable(java.io.Serializable) ExportMetricWriter(org.springframework.boot.actuate.autoconfigure.ExportMetricWriter) Configuration(org.springframework.context.annotation.Configuration) TimeUnit(java.util.concurrent.TimeUnit) Slf4j(lombok.extern.slf4j.Slf4j) JsonTypeInfo(com.fasterxml.jackson.annotation.JsonTypeInfo) Metric(org.springframework.boot.actuate.metrics.Metric) OpenTsdbGaugeWriter(org.springframework.boot.actuate.metrics.opentsdb.OpenTsdbGaugeWriter) Point(org.influxdb.dto.Point) Bean(org.springframework.context.annotation.Bean) MetricsProperties(org.apereo.cas.configuration.model.core.metrics.MetricsProperties) Point(org.influxdb.dto.Point) InfluxDbConnectionFactory(org.apereo.cas.influxdb.InfluxDbConnectionFactory) ExportMetricWriter(org.springframework.boot.actuate.autoconfigure.ExportMetricWriter) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty) Bean(org.springframework.context.annotation.Bean)

Aggregations

JsonTypeInfo (com.fasterxml.jackson.annotation.JsonTypeInfo)1 Serializable (java.io.Serializable)1 Date (java.util.Date)1 TimeUnit (java.util.concurrent.TimeUnit)1 Getter (lombok.Getter)1 ToString (lombok.ToString)1 Slf4j (lombok.extern.slf4j.Slf4j)1 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)1 MetricsProperties (org.apereo.cas.configuration.model.core.metrics.MetricsProperties)1 InfluxDbConnectionFactory (org.apereo.cas.influxdb.InfluxDbConnectionFactory)1 MongoDbConnectionFactory (org.apereo.cas.mongo.MongoDbConnectionFactory)1 RedisObjectFactory (org.apereo.cas.redis.core.RedisObjectFactory)1 Point (org.influxdb.dto.Point)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 ExportMetricWriter (org.springframework.boot.actuate.autoconfigure.ExportMetricWriter)1 Metric (org.springframework.boot.actuate.metrics.Metric)1 OpenTsdbGaugeWriter (org.springframework.boot.actuate.metrics.opentsdb.OpenTsdbGaugeWriter)1 RedisMetricRepository (org.springframework.boot.actuate.metrics.repository.redis.RedisMetricRepository)1 StatsdMetricWriter (org.springframework.boot.actuate.metrics.statsd.StatsdMetricWriter)1 GaugeWriter (org.springframework.boot.actuate.metrics.writer.GaugeWriter)1