Skip to content
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

StateTimeline: Improve display when state changes are missing (outside time window) in query result #36417

Open
khoek opened this issue Jul 4, 2021 · 7 comments

Comments

@khoek
Copy link

khoek commented Jul 4, 2021

What happened:
My state timeline panel misses out the "first logical" point, and so leaves an unsightly blank space instead:

Screenshot from 2021-07-05 01-46-28

Here I'm querying an influxdb instance and "up" and "down" strings are being returned. Because of the irregular nature of when the up and down messages are recorded, an unsightly blank space is left at the start of the first row (as opposed to the second), because the "up" data point which should logically mean that this blank space is coloured green and is labelled "Up" is outside of the time window of values to be displayed.

Of course, this gets much worse when there are no changes in the current time window for a given row, in which case that row will entirely disappear, or if there are no rows display the entire panel will show "no data".

What you expected to happen:

The blank space in the first row appears green and is labelled "Up" because of the "up" data point present in the database at a short time before the start of the time window currently being displayed.

How to reproduce it (as minimally and precisely as possible):

Simply create a data set consisting of two state changes and visualize with the state timeline visualization. Then move the time window so that only the second state change is contained within. Unituitively, the period before the second state change will appear blank, instead of being labelled with the first state change.

Anything else we need to know?:

If it helps, here is the query I'm using:

Screenshot from 2021-07-05 01-58-22

Environment:

  • Grafana version: v8.0.4
  • Data source type & version: InfluxDB 1.6
  • OS Grafana is installed on: Ubuntu 21.04
  • User OS & Browser: Firefox Ubuntu
  • Grafana plugins: None
@torkelo
Copy link
Member

torkelo commented Jul 5, 2021

Of course, this gets much worse when there are no changes in the current time window for a given row, in which case that row will entirely disappear, or if there are no rows display the entire panel will show "no data".

But that seems really hard for Grafana to solve. More of a query / data issue?

@torkelo
Copy link
Member

torkelo commented Jul 5, 2021

Unituitively, the period before the second state change will appear blank, instead of being labelled with the first state change.

But the query does not return any state for it, so Grafana does not know what state it has initially. So what more to do than render it blank?

@torkelo torkelo added the needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc label Jul 5, 2021
@torkelo torkelo changed the title State timeline panel unintuitvely omits intial state, leaving confusing gaps or entire blank panels StateTimeline: Improve display when state changes are missing in query result Jul 5, 2021
@torkelo torkelo changed the title StateTimeline: Improve display when state changes are missing in query result StateTimeline: Improve display when state changes are missing (outside time window) in query result Jul 5, 2021
@lux4rd0
Copy link

lux4rd0 commented Jul 19, 2021

I will follow this request as I just saw I had submitted a duplicate - #36922 - but how this is solved mainly by the discreet plugin is by changing the $timeFilter to something like (time >= ${__from}ms - 48h AND time <= ${__to}ms) - where "48h" is a variable in the plugin UI to extend $timeFilter variable. It works for some use cases, but there's no way of knowing "how far back" to run the time query to get a proper result. But "good enough" works pretty well rather than "perfect." :) For now, it means switching from the InfluxDB visual editor mode editor to the raw query mode. I just can't change back after an edit :)

@ivanahuckova ivanahuckova added area/panel/state-timeline needs investigation for unconfirmed bugs. use type/bug for confirmed bugs, even if they "need" more investigating and removed needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc labels Jul 20, 2021
@kaydelaney kaydelaney added this to To be prioritised in User essentials squad (deprecated) Jul 21, 2021
@lux4rd0
Copy link

lux4rd0 commented Jul 25, 2021

Not very elegant - but I updated my example with a variable and then created an interval pattern to let a user choose how much further back to look for a state change:

AND (time >= ${__from}ms - $variable AND time <= ${__to}ms) GROUP BY time($__interval)

Including something like 5m,1h,12h,1d,2d,3d,7d,14d,30d.

It's certainly heavy-handed. The only thing now is that if the previous state change is really a ways back, the label values (if centered or left rather than on right) might not be displayed. But it's workable for now. I don't really know how one would dynamically "ask" the data source for previous state changes.

@vdwpsmt
Copy link

vdwpsmt commented Aug 17, 2021

another workaround:
Creating a second (influxdb) query, something like this:

select last(value) from measurement where time < {$__from}

and using a transformation to merge the data.
this avoids having to use an arbitrary value for the extra time offset.
Seemed ok for most cases but probably not 100% failsafe and doesn’t feel right.

@ashharrison90
Copy link
Contributor

@grafana/grafana-bi-squad this was on our backlog but since it's state timeline related it should probably be with you 🤽‍♂️

@ashharrison90 ashharrison90 removed this from To be prioritised in User essentials squad (deprecated) Nov 15, 2021
@dprokop dprokop added type/feature-request and removed needs investigation for unconfirmed bugs. use type/bug for confirmed bugs, even if they "need" more investigating labels Nov 18, 2021
@dprokop dprokop added this to Backlog in [Deprecated] B I Squad Nov 18, 2021
Copy link
Contributor

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!

@github-actions github-actions bot added the stale Issue with no recent activity label Jan 28, 2024
@leeoniya leeoniya removed the stale Issue with no recent activity label Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

8 participants