public static InfluxConfig createInfluxConfig ( MetricsConfig conf ) { log . info ( "Configuring stats with direct InfluxDB at {}" , conf . getInfluxDBUri ( ) ) ; return new InfluxConfig ( ) { @ Override public Duration step ( ) { return Duration . ofSeconds ( conf . getOutputFrequencySeconds ( ) . getSeconds ( ) ) ; } @ Override public String prefix ( ) { return conf . getMetricsPrefix ( ) ; } @ Override public String uri ( ) { return conf . getInfluxDBUri ( ) ; } @ Override public String db ( ) { return conf . getInfluxDBName ( ) ; } @ Override public String userName ( ) { return conf . getInfluxDBUserName ( ) ; } @ Override public String password ( ) { return conf . getInfluxDBPassword ( ) ; } @ Override public String retentionPolicy ( ) { return conf . getInfluxDBRetention ( ) ; } @ Override public String get ( String k ) { return null ; // accept the rest of the defaults, see https://micrometer.io/docs/registry/influx. } } ; }
Create InfluxConfig for InfluxDB Register .