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

Periodic/time-delayed Template reloads #8888

Closed
RichiH opened this issue Jul 19, 2017 · 7 comments
Closed

Periodic/time-delayed Template reloads #8888

RichiH opened this issue Jul 19, 2017 · 7 comments

Comments

@RichiH
Copy link
Member

RichiH commented Jul 19, 2017

Currently, I can refresh templates:

  • Never
  • On dashboard load
  • On timerange change

We're having thousands of values which change at least daily in some templates, so the latter two are too often, but the first one is also a no-go.

Having periodic updates, either by a cronjob or time-delayed by "refresh if template older than X time" would fix this issue.

@RichiH RichiH changed the title Periodich Template reloads Periodic/time-delayed Template reloads Jul 19, 2017
@RichiH
Copy link
Member Author

RichiH commented Jul 19, 2017

A more generic solution might be a HTTP endpoint the user could access to trigger reloads. That way, those reloads should be invisible for most front-end users.

@torkelo
Copy link
Member

torkelo commented Jul 19, 2017

since the template system is all in the frontend, the template variable query is executed & values fetched an inserted into dashboard json by the frontend, it's tricky to do this via api / cronjob etc.

"refresh if template older than X time"

This would work but have one big flaw in in order to save the new values (so subsequent dashboard loads also do not trigger refresh) the dashboard needs to be saved, and doing that automatically is not a good idea.

@RichiH
Copy link
Member Author

RichiH commented Jul 24, 2017

I can see how saving things automatically is risky with the current setup. On the other hand, there will be some state that needs to be handled distinct from the UI in the longer term, anyway.

@alin-amana
Copy link
Contributor

I would slot the periodic reloads somewhere between "On dashboard load" and "On timerange change", meaning the values would be loaded first on dashboard load, then periodically. This means the dashboard wouldn't need to be saved when values change.

I know this doesn't answer RichiH's problem, but dashboard load generally involves a lot of querying and I don't see how adding one more query is that much overhead.

@RichiH
Copy link
Member Author

RichiH commented Sep 11, 2017

It depends on how expensive the different queries are.

Personally, I don't see much benefit in #8888 (comment) but I don't see harm in it, either. Unless people keep tabs open which then generate load without value.

@RichiH
Copy link
Member Author

RichiH commented Mar 26, 2018

How about this:

  1. Allow threshold for value re-creation to be stored in dashboard, e.g. 24h
  2. Template values are stored in the dashboard, along with template update time
  3. When dashboard is loaded, template update time is loaded
  4. If (template_update_time - now()) is below the threshold load & display template values
  5. If they are not, create new template values from data source

Note that step 3 would ideally happen on the server before even loading & transmitting potentially stale data

This would even integrate nicely with service discovery, where I could potentially pre-seed my dashboard files on disk with up-to-date template values.

@grafanabot
Copy link
Contributor

This feature request has been open for a long time with few received upvotes or comments, so we are closing it. We're trying to limit open GitHub issues in order to better track planned work and features.

This doesn't mean that we'll never ever implement it or that we will never accept a PR for it. A closed issue can still attract upvotes and act as a ticket to track feature demand/interest.

Thank You to you for taking the time to create this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants