Flux how to debug

How to print, log a line of code or var etc in flux scripting?

1 Like

I am having the same question: how to debug like echo or print a variable in influxdb 2.0.4 its “Query Explorer”?

Like to see whether a secret is configured correctly?

import "influxdata/influxdb/secrets"

yield(name: "${ID_ELECTRICITY_6}")

Note: yield is a failing try. As the result is:

 compilation failed: error at @2:25-2:43: invalid expression @2:24-2:25: :

or when I fix the forgotten function call “secrets.get”, the result is:

 type error @4:1-4:35: missing required argument tables

Any debugging features in flux or “Query Explorer” for a var?

I have not found anything natively, but found this Debug Flux Queries using VSCode

See it helps.

Hello @cj0,
As @Ashish_Sikarwar mentioned you can print values with VSCode. The data explorer only lets you visualizes tables.
You can however query some of your other time series data, and include your value in the table with a map() function to visualize it.