doitintl / bigquery-grafana

Google BigQuery Datasource Plugin for Grafana. (NO LONGER MAINTAINED)
https://www.doit-intl.com/labs/
MIT License
242 stars 76 forks source link

only one times series when multiple rows selected with metric #202

Closed PStump closed 4 years ago

PStump commented 4 years ago

Bug Report

Expected Behavior

If a metric row is selected together with multiple value rows, a time series should be generated for every metric value and value row name. Example:

SELECT
  axis AS metric,
  axisCurrent AS current,
  axisVoltage AS voltage
...

Where the axis row contains X and Y. The time series generated should be: X current, X voltage, Y current and Y voltage

Actual Behavior

From the example above, only the time series X and Y are generated and the values from row current and voltage are mixed together.

Steps to Reproduce the Problem

  1. Create a query with a metric row and multiple additional rows.

Specifications

JorritSalverda commented 4 years ago

I think because of this change all the metrics shown in my legend are now suffixed by f0_ or the column alias. Is there any way to avoid the column name getting suffixed?

My query looks like:

SELECT
  $__timeGroupAlias(l.inserted_at,$resolution_tplink),
  s.name AS metric,
  AVG(s.current_power_usage_watt) AS value
FROM `tp_link_hs110` AS l
  LEFT JOIN UNNEST(l.smart_plugs) AS s
WHERE
  $__timeFilter(l.inserted_at)
GROUP BY 1,2
ORDER BY 1,2

And after updating to 1.0.6 the legend in my dashboard looks like

grafana-bigquery-legend-1 0 6

avivl commented 4 years ago

@JorritSalverda I don't see any suffix in the image that you attached

PStump commented 4 years ago

He means the value in each row. One fix would be to only use the prefix, when more than one additional value (beside the metric) is selected. I will create a pull request tomorrow.

JorritSalverda commented 4 years ago

Yes, indeed it's the value part in each item in the legend. Sorry about not making this more explicit in the screenshot. Looking forward for a fix or workaround. Right now I've reverted to release 1.0.5 :(

avivl commented 4 years ago

203 merged

@JorritSalverda a fix is merged into master. Can you test?

avivl commented 4 years ago

@PStump @JorritSalverda I'll stop maintaining this data source in a couple of weeks. @Tamirklein and his team will take over. I would also like to thank you for your involvement and contribution to this project