Why after using InfluxDB v2.0 join() funciton, it can't write to a bucket?

Viewed 59

Here is my flux script, when I run it, there is no error, but there is no data in bucket “output-test-3” , and exist data in bucket "output-test-4" :( I have been troubled by this problem for a long time. Can anyone solve my problem?

option task = {name: "join-test-1", every: 5m, offset: 5s}
max_connections = from(bucket: "Node-exporter")
    |> range(start: -task.every)
    |> filter(fn: (r) =>
        (r["_measurement"] == "go_info"))
    |> last()
    |> to(bucket: "output-test-4")
used_connections = from(bucket: "Node-exporter")
   |> range(start: -task.every)
   |> filter(fn: (r) =>
        (r["_measurement"] == "go_goroutines"))
   |> last()
   |> to(bucket: "output-test-4")
a = join(tables: {max_connections: max_connections, used_connections: used_connections}, on: 
        ["_time", "_start", "_measurement", "_stop", "_field"])
   |> to(bucket: "output-test-3")
1 Answers

When using the join() function to connect two queries a and b, the variables _field, _measurement, and _value will automatically become _field_a, _filed_b, _value_a, _value_b, etc. When InfluxDB writes to the bucket, there must be three fragments of _field, _measurement, and _value, but due to the above reasons, these neighbors have disappeared. So the easiest way to solve this problem is to use the map() function to recreate these three subdivisions. The content inside can be specified. When using the data, it is good not to use the data of these specified partitions.

Related