-
Notifications
You must be signed in to change notification settings - Fork 15
feature request: add opt-in support for special handling the metric
label in time-series queries
#205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello! I don't work directly on the plugin, but we do use Grafana & BigQuery pretty extensively for analytics internally at Grafana Labs. My initial guess is that this might be related to the Grafana time series panel, rather than the data source. Do you mind sharing which version of Grafana you are on? fwiw - I tried your query SELECT
CURRENT_TIMESTAMP(),
"sku" AS metric,
1 AS cost but couldn't replicate the behavior on v10.2.0 (the version we're on for our business intelligence instance, internally), which kinda led me to think it might be a nuance with the panel. |
As a really hacky work around until v10.2, you might be able to use the Organize Fields transform to rename the cost column to a single "space" character? |
I have a similar issue here. Looks like in the new big-query plugin, keyword 'metric' is not working. I need to use "Pivot query" to do this. The problem is I can't do this if I want to use a column value as new row in the results table. Previously one is more "dynamic". And I think it's not Grafana's problem because 'metric' keyword works fine with other data source for example postgresql. |
status update: hi, the reason this works in Postgres for example, is because we do an exception there for the case where:
currently this special handling is not done in bigquery. as far as i know, it's node done in redshift-plugin either. we basically have to decide whether we should add this or not, but adding is problematic, because that's a breaking change now, people may be relying on the current behavior. for now i recommend using the |
i ran some test queries on both postgres and bigquery, and wrote down the legend-name, to illustrate the difference. all queries were run in SELECT CURRENT_TIMESTAMP as time, 'sku' AS something, 1 AS cost bigquery: SELECT CURRENT_TIMESTAMP as time, 'sku' AS metric, 1 AS cost bigquery: SELECT CURRENT_TIMESTAMP as time, 'sku' AS metric, 'xyz' as thing, 1 AS cost bigquery: as you can see, the change happens when there's one "label" field, and it's named |
technical note: these notes are mostly about the legend displayed. internally, the change is in how the grafana-dataframe is built. to be exact, the value column. what will be it's name, and what labels will be added to it. |
i asked about this in the |
metric
label in time-series queries
i discussed this, and the conclusion is that we don't think making this the default-behavior is the way to go, it would make it very confusing to new users. i adjusted this github issue to be a feature-request instead, about adding some opt-in way to enable this behavior. currently the recommended workaround is to use transforms, as described in the comments above. |
summary by @gabor : there is a special behavior in a special situation in postgres. the bigquery datasource does not do this special handling currently. we do not want to change the default behavior in bigquery, but it may be useful to offer this as an opti-in behavior. there are many open questions, like how exactly should it behave (100% mirror of the postgres behavior?), how exactly would you enable it (both in query-editor and in raw-query-editor) etc.
see discussion in grafana/sqlds#109 too.
An image is probably better to explain the problem, but I've switch from the old plugin to this plugin and with the same query I've different result. I don't mind update my queries to reproduce the previous behavior but I'm not sure this is possible
New plugin

Old plugin

Not the presence of "cost" for the name with the new plugin
My query
For the new plugin, the behavior can be reproduce via this simple query
I've try to remove the
AS cost
, but the prefix is nowf1_
The text was updated successfully, but these errors were encountered: