moxious / triage

testing triage actions for issues
0 stars 1 forks source link

Config from query results & Ymax Variable #175

Open tonypowa opened 8 months ago

tonypowa commented 8 months ago

What happened?

WITH FundTotalReturns AS (

SELECT

'edgehill' AS fund_name,

EXP(SUM(LN(1 + "Daily PnL")) OVER (ORDER BY "Date" ASC)) - 1 AS "Total Return"

FROM

"edgehill_daily_data"

WHERE 'edgehill' IN (${fund})

AND extract(epoch from "Date") BETWEEN ${from:date:seconds} AND ${to:date:seconds}

UNION ALL

SELECT

'tagus' AS fund_name,

EXP(SUM(LN(1 + "Daily PnL")) OVER (ORDER BY "Date" ASC)) - 1 AS "Total Return"

FROM

"tagus_daily_data"

WHERE 'tagus' IN (${fund})

AND extract(epoch from "Date") BETWEEN ${from:date:seconds} AND ${to:date:seconds}

)

SELECT

MAX("Total Return") AS "Global Max Total Return",

MIN("Total Return") AS "Global Min Total Return"

FROM FundTotalReturns;

What did you expect to happen?

I have the following sql code above where im looking to query the global max return of selected funds.

I am using repeated rows and I have a mutli select variable called ${fund} where I have several funds liked edgehill and tagus.

My goal is simple, the ymax should be determined based on the selected funds. For example, if i select only tagus, the ymax is based off the tagus data only. If i select only edgehill, the ymax is based off the edgehill data only. However, if i select both tagus and edgehill, the ymax is based off the edgehill and tagus data.

Did this work before?

Yes, the code above works but there is only 1 problem. If I select only tagus or edgehill, it still gives me the ymax as if ive chose both. So its not really dynamic.

How do we reproduce it?

N/A

Is the bug inside a dashboard panel?

No response

Environment (with versions)?

Grafana:

OS:

Browser:

Grafana platform?

None

Datasource(s)?

No response

tonypowa commented 8 months ago

This issue is a test copy of an issue in another repo. Original issue: https://github.com/grafana/grafana/issues/#78991

moxious commented 8 months ago

@support-agent Do we have similiar issues already?

grafana-support-agent[bot] commented 8 months ago

There are several issues and feature requests that have been made to the Grafana repository that may be related to your problem. For example, there are requests for dynamic variable filtering, using variables in different components of Grafana, and enhancing data source queries. Although none of these issues or feature requests seem to address your exact problem, they do indicate that users have experienced challenges with dynamic behavior and variable filtering in Grafana. To resolve your specific issue, you may need to review how the variable ${fund} is being used in your query and ensure that it is properly filtering the data for the selected funds. It might also be helpful to check Grafana's documentation or forums for more information on variable usage and dynamic filtering.

moxious commented 8 months ago

Triage summary: Issue describes an expected dynamic adjustment of ymax in repeated rows based on selected funds in the ${fund} variable within a Grafana SQL query, but currently, ymax is static and not changing as expected when different selections are made.

Recommended labels:

area/templating/repeating area/dashboard/templating type/feature-request area/backend/db/sql

moxious commented 8 months ago

Hi @tonypowa! It seems that your issue might be related to the Grafana Metrics project, considering that you're discussing SQL queries and dynamic panel settings, typically associated with metric queries and visualizations within Grafana. If this is not purely about a Grafana visualization but rather the dynamic interaction with a specific datasource or the data being visualized, you may instead need to consider one among the DataViz project, Grafana BI project, or AWS Datasources project if yours is an AWS-related datasource.

If I've misunderstood and this issue pertains to plugins or extending Grafana's functionality in managing the datasource, please consider the Plugins Platform project.

Could you please confirm if this involves a specific datasource or provide more context on the environment and how you are expecting the ymax adjustment to be handled within Grafana?

moxious commented 8 months ago

Elaboration:

Request for Additional Information

Hello @tonypowa,

Thank you for providing details about the issue at hand. It looks like you're encountering problems with dynamic ymax calculation based on selected funds in your SQL query. To better understand and address your issue, we need a bit more information:

  1. Could you specify the exact versions of the Grafana, the Operating System, and the Browser you're using? This information is crucial since some features might work differently across versions.

  2. It would be helpful to know if this issue is related to a specific Grafana panel, plugin, or a feature. Could you clarify if this is observed in a particular type of dashboard panel or if it's an issue with Grafana's variable substitution in queries?

  3. Can you describe the steps to reproduce the issue? While you mention that providing steps to reproduce is not applicable, it could be useful to have a step-by-step guide, even if it seems straightforward, to ensure we can replicate the issue exactly as you're experiencing it.

  4. Is there any error message displayed, or does it silently fail to dynamically adjust the ymax? If there are error messages, screenshots or exact text could be very insightful.

  5. Are you able to provide a stripped-down version of your dashboard or the configuration that demonstrates the problem (without any sensitive data), that we could analyze?

  6. Lastly, has anything changed in your environment between when it worked correctly and when you first noticed the issue?

The more details you can provide, the easier it will be for the community to help you solve the problem. If possible, please update the issue with the requested information.

We appreciate your contribution to the community and look forward to resolving this issue together!

Best regards, The [Your Project Name] Team