grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
64.16k stars 12.01k forks source link

dashboard: interval and interval_ms has different values, when min-interval is involved #54024

Open gabor opened 2 years ago

gabor commented 2 years ago

in a dashboard, let's say you set the min-interval to 70s, and choose a time-range of 30 minutes:

in other words, $__interval is rounded to a "nice" number, but $__interval_ms is kept at the "exact" value.

the problem is in this code: https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/datetime/rangeutil.ts#L288-L291 , as you see intervalMs is taken as-is, but the interval value goes through some "rounding".

please note, this problem only happens when min-interval is involved, because if there is no min-interval, the intervalMs calculated at https://github.com/grafana/grafana/blob/main/packages/grafana-data/src/datetime/rangeutil.ts#L284 is also rounded, so in a way, when there is no min-interval:

the documentation for $__interval_ms says: "This variable is the $interval variable in milliseconds" ( https://grafana.com/docs/grafana/latest/variables/variable-types/global-variables/#interval_ms ). that is not correct currently.

NOTE: there is also the additional problem, that, we specified a min-interval of 70s, and the interval becomes 1m, which is lower than the requested min-interval.

gabor commented 2 years ago

i found some additional info that i added to the issue (the fact that this happens only when min-interval is involved)

github-actions[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

gabor commented 8 months ago

(seems this never got assigned to a squad, i assigned it to plugins-platform, as they own rangeUtil.ts, feel free to assign it to a better owner, thanks!)