flant/grafana-statusmap

Correctly render buckets for inconsistent timestamps and sparse results.

diafour opened this issue · 7 comments

Problem:
Prometheus returns good data for queries similar to that described in README. Data has timestamps for each interval and timestamps are equal.
Other sources or different Prometheus queries can contain holes or inconsistent timestamps. Plugin is not render this data correctly.

2019-03-01-175327-992x235

  • The solution is to render buckets using interval grid to calculate width and x coordinate. Interval is already adjusted to get one timestamp for minWidth if use $__interval in query.
  • Use minWidth for results from queries without $__interval
  • Aggregate results by timestamp to render vertically aligned buckets

Related problem: #33 (comment)

Targets with inconsistent timestamps are rendered correctly after #55:
Incorrect:
2019-03-05-153534-1262x219
Correct:
2019-03-05-154008-1262x234

TODO Support inconsistent timestamps between results for one target: aggregate by timestamp range and create multivalue buckets. Also calculate cardWidth not from number of buckets but from minimal distance between timestamps.

Investigate a way to precalculate cards' fields to speedup render. See related #68

Hello, is this issue fixed in #55? It's not entirely clear. I am on Grafana 6.3.5 and Statusmap 0.2.0. I am using the MySQL datasource to load time-series data that is very sparse with indeterminate gaps between values. When present, values are reported at 1 minute intervals.

The data is displayed; however, the cards are usually far too wide, and end up distorting the view.

Screen Shot 2020-02-20 at 3 36 02 PM

When providing data which included a null for every timestamp the plugin displayed as expected. However, I'm trying not to transmit nulls, as there is only data about 10% of the time.

@calebsmac no, #55 doesn't fix handling of sparsed data.

This problem also affects a tooltip #74 #70. I'm planning to fix this before the next release.

Cards calculation is reworked in PR #90. Buckets are now aligned with statusmap’s step. It is good for queries that use $__interval. But it is inappropriate for single or sparsed events (e.g. builds info from MySQL) when the user should see cards aligned to real timestamps. The plan is to make a new switch "Align to step" or "Show aligned" to address this last case in this issue (I hope).

Not aligned cards were shown earlier. The plugin does not use step and calculates coordinates from data:
2019-03-05-154008-1262x234

The same data is now spreaded over aligned buckets, because plugin uses step:
Снимок экрана 2020-07-15 в 13 14 02

The story continues. Buckets are doubling for some data:

Снимок экрана 2021-05-24 в 21 50 38