Have a look at this tutorial I wrote, even though it's using InfluxDB version 3, it should work same way with previous version that you're using: https://www.influxdata.com/blog/springboot-application-monitoring-guide-influxdb