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());
};
}
Aggregations