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

Request cache stopped working? #132

Closed
amotl opened this issue Mar 31, 2024 · 4 comments
Closed

Request cache stopped working? #132

amotl opened this issue Mar 31, 2024 · 4 comments

Comments

@amotl
Copy link
Contributor

amotl commented Mar 31, 2024

Problem

It looks like the request cache stopped working? When invoking grafana-wtf on play.grafana.org, the program requests data over and over again. That is especially hard on such a huge Grafana installation, where it takes almost one and a half minutes to acquire all the metadata.

export GRAFANA_URL=https://play.grafana.org
grafana-wtf info --format=yaml

Fetching dashboards in parallel with 5 concurrent request/s]

  4%|█▏                   | 67/1537 [00:03<01:26, 16.99it/s]
grafana:
  version: 11.1.0-68793
  url: https://play.grafana.org
statistics: {}
summary:
  dashboard_panels: 9299
  dashboard_annotations: 1501
  dashboard_templating: 1349

Thoughts

Is it related to the switchover to Niquests, because it does not harmonize with requests-cache well, yet?

/cc @Ousret

@amotl
Copy link
Contributor Author

amotl commented Mar 31, 2024

Observations

On the previous version 0.18.0, everything works as expected.

git checkout 0.18.0
export GRAFANA_URL=https://play.grafana.org

Cold-cache situations are expensive, right.

time grafana-wtf info --format=yaml
1m20s

With a warm cache, on subsequent invocations, the program still needs time to load the data from the database into memory, but at least it doesn't have to go to the network again.

time grafana-wtf info --format=yaml
0m9.2s

Evaluation

This issue blocks the upcoming release, but it has no urgency.

@amotl
Copy link
Contributor Author

amotl commented Mar 31, 2024

Dear @Ousret,

thank you for sharing more insights about how to properly work with requests-cache at #130 (comment). Other than making it more beautiful, do you think it will help to make it work at all? We will be happy to try right away, thanks.

With kind regards,
Andreas.

@amotl
Copy link
Contributor Author

amotl commented Mar 31, 2024

After applying a few fixes, getting the chaos of session management right, we are back to more reasonable numbers when invoking grafana-wtf subsequently on play.grafana.org, which means the response cache works again. Thanks for your suggestions, @Ousret.

$ time grafana-wtf info --format=yaml
real	0m8.6s

@amotl
Copy link
Contributor Author

amotl commented Mar 31, 2024

That patch has a corresponding fix.

@amotl amotl closed this as completed Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant