I am trying to make a combined query, assigning a value to a variable and passing it to the main query. I think it is due the result type of the first query, that is not a simple string.
desc = v1.tagValues(
bucket: "telemetry",
tag: "/interfaces/interface/subinterfaces/subinterface/state/description",
predicate: (r) => r["device"] == "cpr1" and r["interface_name"] == "${core_int}" and r["subinterface_index"] == "3000",
start: -1d
)
from(bucket: "telemetry")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "/interfaces/")
|> filter(fn: (r) => r["_field"] == "/interfaces/interface/subinterfaces/subinterface/state/counters/in-octets")
|> filter(fn: (r) => r["device"] == "${device}")
|> filter(fn: (r) => r["interface_name"] == "${core_int}")
|> map(fn: (r) => ({r with _value: r._value * 8}))
|> derivative(nonNegative: true, unit: 1s)
|> set(key: "_field", value: "input")
|> set(key: "_desc", value: "${desc}")
Error received:
invalid: error @22:34-22:38: stream[{A with _value: B, _value: string}] is not Stringable