grafana / influxdb-flux-datasource

Grafana datasource plugin for Flux (InfluxDB)
Apache License 2.0
51 stars 21 forks source link

Allow user to specify series name #79

Closed alsargent closed 4 years ago

alsargent commented 4 years ago

This is a feature request. Check out the chart below, which has two time series legends for it:

image

The red legend, for max response time, is very long. The green legend, for median resposne time, is null.

It'd be great if I, as a dashboard builder, could somehow specify the name a series to something more readable.

As for how to solve this, a couple of possibilities come to mind:

  1. Provide a UI in the panel editor.
  2. Use the "yield" statement to determine what to use as the series name. For example, given the two yield statements below, the series names would be "max" and "median".
from(bucket: "http-response")
  // Don't show the last two minutes of data, because it's possible that
  // you get a dip down to zero, due a null reading.
  |> range(start: -24h, stop: -2m)
  |> filter(fn: (r) => r._measurement == "http_response")
  |> filter(fn: (r) => r.company == "Zoom")
  |> filter(fn: (r) => r.service == "Zoom")
  |> filter(fn: (r) => r._field == "response_time")
  |> group(columns: [""], mode:"by")
  // 10m shows dips and spikes, without being too jagged to understand.
  |> aggregateWindow(every: 10m, fn: max)
  |> yield(name: "max")

from(bucket: "http-response")
  // Don't show the last two minutes of data, because it's possible that
  // you get a dip down to zero, due a null reading.
  |> range(start: -24h, stop: -2m)
  |> filter(fn: (r) => r._measurement == "http_response")
  |> filter(fn: (r) => r.company == "Zoom")
  |> filter(fn: (r) => r.service == "Zoom")
  |> filter(fn: (r) => r._field == "response_time")
  |> group(columns: [""], mode:"by")
//   10m shows dips and spikes, without being too jagged to understand.
  |> aggregateWindow(every: 10m, fn: median)
  |> yield(name: "median")
ryantxu commented 4 years ago

flux support was added to grafana 7.1 (released today :tada: ) https://www.influxdata.com/blog/how-grafana-dashboard-influxdb-flux-influxql/

This looks interesting, can you post an issue if this is still relevant? https://github.com/grafana/grafana/issues