Avoid writing 0 in InfluxDB when no data is produced

influxdata
query
influxql
influxdb
#1

I am using micrometer in my Java application to wirte into my influxDB. When there is data to be recorder I call the corresponding methods of micrometer to store these data in influxDB, this works flawless.
The problem comes when there is no data to be stored but micrometer keeps writing into the DB which pollutes my data base with a lot of 0s. It will write as frequent as I configure micrometer, in this case every second. When I execute a query into the DB I see a lot of 0s

In grafana it looks as if I saved those 0s which makes the average calculation a useless value and when executing a query of several days in the past it can brake grafana.

#2

Hi @alexc ,

this sounds like a micrometer configuration problem ?
can you tell micrometer not to write to the DB when there is no data to be stored ?

best regards

#3

Hi @MarcV,
thanks for the answer. This is the core of the problem. I don’t find anyway in the configuration where to specify not to save the data constantly. One can specify the frequency (step) but if you don’t it reverts to the default of 1 every minute, with its automatic 0s.