Convert value to tag?

Hi,

New to Flux so bear with me!

I have two tables which I am trying joining with the goal of creating a line graph in Chronograf charting the process names with their respective CPU amounts.

“perf” table has CPU amount
“run” table as the process name

After the join I don’t see the process name in the dashboard. I believe it’s because the process name is a “value” and the CPU amount is also a “value” (not field or tag). If this is the case I am curious how I can convert this process name in a tag. Here’s my flux so far:

run = from(bucket: "ttc-snmp")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) => 
    r._measurement == "snmp_swrun" and
    r._field == "hrSWRunName"
    )
    |> aggregateWindow(every: 1m, fn: last)
    |> keep(columns: ["_time", "_field", "_value", "hrSWRunIndex", "source"])
    |> rename(columns: {"hrSWRunIndex": "index"})

perf = from(bucket: "ttc-snmp")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) => 
    r._measurement == "snmp_swrunperf" and 
    r._field == "hrSWRunPerfCPU"
    )
    |> aggregateWindow(every: 1m, fn: last)
    |> keep(columns: ["_time", "_field", "index", "source", "_value"])


join(tables: {perf:perf, run:run}, on: ["source", "_time", "index"])

This gives me:
_field_perf = hwSWRunPerfCPU
_field_run = hwSWRunName
_time = 2020-03-27T19:38:00Z
_value_perf = 26
_value_run = init
index = 1
source = CERS1

_value_run is the name I’d like to see. I can all the other fields and tags fine except _value_run in my line chart. I’m assuming I cannot see _value_run because it’s not a tag? Any idea what I’m doing wrong here?

Thanks for any help!
AlexW

Figured this out. Just need a group statement at the end.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.