grafana / influxdb-flux-datasource

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

Trying to graph two time series but only one is showing up #78

Open alsargent opened 4 years ago

alsargent commented 4 years ago

I have a Grafana dashboard that uses Flux to display response time and availability of various Zoom URLs over the past 24 hours.

Using Grafana version 6.7.2 on localhost, and InfluxDB Cloud 2 running on AWS Oregon.

Last weekend, I was able to plot two time-series graphs, one for the median response time of these Zoom URLs, and another for the max response time. Now I can only view the max response time.

Here's the panel in Grafana:

image

... as you can see, both time-series are being picked up in the legend (the red legend for max response time has a very long name, and green legend for median has no name) but only one is showing up.

Here's the Flux code for each of these time series, which is in the Query section of the panel:

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")

Here are the settings for the chart:

image

ryantxu commented 4 years ago

Do you have this configured in two queries? Or is this all in a single query? I expect it would work if split into two queries, but would not work if all within one box