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

Debug logging #196

Open
bleetube opened this issue Aug 13, 2024 · 1 comment
Open

Debug logging #196

bleetube opened this issue Aug 13, 2024 · 1 comment

Comments

@bleetube
Copy link

Sorry for the stupid question, but how do I enable debug logging? I'm curious to know how often my widgets are making http requests. I tried running glance with LOG_LEVEL=debug but didn't see anything after that. I searched the repo for phrases like "log" or "logging" and checked the configuration documentation. I'm not a go dev but I did see that "log/slog" is used so I imagine there is already some way to turn it on?

I'm using glance 5.1 via systemd and looking for logs in systemd journal. This is abolut all I ever see:

Aug 12 20:08:48 litten systemd[1]: Started glance.service.
Aug 12 20:08:48 litten glance[160400]: 2024/08/12 20:08:48 INFO Serving assets path=/var/lib/glance/assets
Aug 12 20:08:48 litten glance[160400]: 2024/08/12 20:08:48 INFO Starting server host=127.0.0.1 port=8032
@svilenmarkov
Copy link
Member

Hey, not a stupid question at all, you couldn't find any debug logging because uh, there isn't actually any. The only logging available is info like the one you've been seeing and errors when requests fail. I have thought about adding debug info for each widget in the UI but never got to it since it's rarely felt needed and nobody's requested it so far.

I can go in a bit more depth about how widgets update (and should probably document it too). For starters, nothing updates in the background, I wanted to avoid making unnecessary requests. Widgets only update when you visit the dashboard and if their cache has expired. You can usually tell if something was updated if you see the loading spinner, otherwise if the page shows up immediately it was likely all served from cache.

Speaking of cache, I should document how long things get cached for as well, it's different for every widget, but for the time being you can easily look it up here. You can change the cache duration with the cache property (at least that's documented!).

The entire page waits for all widgets on that page to finish updating before showing anything, which does mean that a single slow request can stall you seeing anything, however to alleviate this requests have a timeout of 5s (3s for the monitor widget). If a request does timeout it will be retried again in a minute and each subsequent fail increses the retry period. You can tell if a widget failed updating in the UI by the red circle next to its title. You can also hover over that circle and it'll give you an error message.

I hope that clears most things up, feel free to ask if you have any more questions.

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

2 participants