moxious / triage

testing triage actions for issues
0 stars 1 forks source link

Long Execution Time of Flux Queries in Grafana with InfluxDB 2 #355

Open tonypowa opened 1 month ago

tonypowa commented 1 month ago

What happened?

When running Flux queries from Grafana to fetch data from InfluxDB 2, the query execution time exceeds 5 minutes. Even after optimizing the queries by removing regex parts from variable definitions and adding the duration parameter to the aggregateWindow function, the execution time remains high, with the best time achieved being 2 minutes.

What did you expect to happen?

I expected the Flux queries to execute within a reasonable time frame, ideally under 1 minute, considering the size and complexity of the data being queried.

Did this work before?

No, the queries have consistently taken a long time to execute, even before attempting the optimizations mentioned above.

How do we reproduce it?

1Use Grafana to run Flux queries against an InfluxDB 2 database.

Construct queries that involve fetching data over a significant time range or from large datasets.

Observe that the queries take longer than expected to execute, often exceeding 5 minutes.

Attempt optimizations such as removing regex parts from variable definitions and adding the duration parameter to the aggregateWindow function, but notice minimal improvements in query execution time.

Is the bug inside a dashboard panel?

Yes.

Environment (with versions)?

Grafana: 9.3.6

OS: windows

Browser: Chrome

Grafana platform?

Kubernetes

Datasource(s)?

InfluxDB2

tonypowa commented 1 month ago

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

moxious commented 1 month ago

Elaboration:

Request for additional information

Hi @tonypowa, thank you for reaching out with the issue you're experiencing. We want to ensure your concerns are addressed and investigations can proceed effectively. To help us better understand and replicate the issue you're facing, could you please provide the following additional information:

Please attach any relevant screenshots, logs, and query examples as they will help in diagnosing the problem. Remember to redact any sensitive information from the details you share.

Your cooperation is greatly appreciated, and we look forward to resolving this issue together!

moxious commented 1 month ago

Hello @tonypowa, thanks for the detailed report. It seems like the issue might be related to the interaction with the InfluxDB datasource within Grafarka. Based on the details provided, this issue would best fit the Plugins Platform project, as Flux queries are part of the InfluxDB plugin. The team there might be able to help with optimizing queries or addressing potential plugin performance issues.

Could you provide the exact version of the InfluxDB plugin you are using? Also, if you could share a sanitized example of a query that exhibits the long execution times, it would assist the team in identifying the problem.

moxious commented 1 month ago

Summary: The issue is an OPEN problem where Flux queries in Grafana fetching data from InfluxDB 2 take excessively long to execute, over 5 minutes, and optimizations have not reduced times to below 2 minutes. The author expected the queries to run under 1 minute and has not had success in the past with quicker executions. Reproduction involves running Flux queries in Grafana against InfluxDB 2, particularly with large datasets or over sizable time ranges.