I’m trying to fault find an issue with my TICK script. It simply monitors one measurement, performs some processing and spits the results back out into another measurement:
stream
|from()
.measurement('sensor_data_raw')
@process_raw_data()
|log()
|influxDBOut()
.measurement('sensor_data')
All is well, except ideally I’d like influx to timestamp the new point rather than providing one. I see the Line Protocol supports this by simply omitting the time in the INSERT statement. Further, I see InfluxDBOut attempts to support this by defining zero as the default time, and then detecting the zero when constructing the Line Protocol representation. From kapacitor/influxdb/client.go:525
:
if p.Time.IsZero() {
bytes = make([]byte, fl+kl+1)
copy(bytes, key)
bytes[kl] = ' '
copy(bytes[kl+1:], fields)
} else {
timeStr := strconv.FormatInt(p.Time.UnixNano()/imodels.GetPrecisionMultiplier(precision), 10)
Only it doesn’t work… when I trigger the TICK script, log faithfully shows time=1970-01-01T00:00:00Z
and according to the Go documentation this should satisfy the IsZero
call.
But the point that appears in sensor_data
literally has 1970-01-01T00:00:00Z
as the time, instead of now
.
Is this a bug? Is there a workaround? And further… how can I debug this? It’s murder trying to sift through the source unpicking how it’s supposed to work. What’s the quickest way to spin up a dev environment that allows me to see these Go lines executing?