influxdata / influxdb1-client

The old clientv2 for InfluxDB 1.x
MIT License
190 stars 112 forks source link

Impossible to set precision to micro seconds (>=v1.8.0) #38

Open skladd opened 4 years ago

skladd commented 4 years ago

At least since InfluxDB server v1.8.0 precision in client cannot be set to micro seconds. Using "u", validation fails in NewBatchPoints(), using "us", Write() fails:

precision 'u' failed: NewBatchPoints failed: time: unknown unit u in duration 1u
precision 'us' failed: Write failed: {"error":"invalid precision \"us\" (use n, u, ms, s, m or h)"}

In influxdata/influxdb@275b02e5dd9de98bd4625fa3dcb54ebb3b808158 a verification rejecting write requests with precision "us" was added.

skladd commented 4 years ago

InfluxDB server checks in httpd.serveWriteV1() by case "", "n", "ns", "u", "ms", "s", "m", "h":.

The client checks by time.ParseDuration("1" + conf.Precision), whose valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

skladd commented 4 years ago

InfluxDB API reference says precision=[ns,u,ms,s,m,h]

halfa commented 4 years ago

Same issue here, it actually broke one of my application. Can somebody from the team take a look ?

skladd commented 4 years ago

@jsternberg @docmerlin May anybody take a look?

TMarietta commented 3 years ago

I am also experiencing this issue after an unexpected reboot of our server. Is there any solution for this?

skladd commented 3 years ago

@TMarietta Do you really need this specific precision? If not, just use ns precision.

Nevertheless someone of the InfluxDB team should take a look at this PR.

TMarietta commented 3 years ago

@TMarietta Do you really need this specific precision? If not, just use ns precision.

Nevertheless someone of the InfluxDB team should take a look at this PR.

No. We tried ms and that seems to work fine for our application. Thanks for following up.