envoyproxy/envoy

stats: Add some modest UX to admin /stats page

Open

#8,308 opened on Sep 20, 2019

View on GitHub
 (7 comments) (0 reactions) (0 assignees)C++ (5,373 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (27,997 stars)
PR merge metrics
 (Avg merge 8d) (378 merged PRs in 30d)

Description

The Envoy stats system is designed to be connected to a rich statistics visualization system via a stats-sink.

However it might be nice when looking on a single admin site, without having hooked up other visualization systems, to get a richer view of those stats. It's a balance of course because anything really rich should be handled by a dedicated system. But I just wanted to get a taste-test for the possibility of making the in-server stats endpoint potentially a little richer.

The PageSpeed stats system's default display of just raw counters might be cheap/simple enough to consider including by default:

Capture

One benefit of this over the raw text display is that you can click a button to toggle between sorting alphabetically and sorting between how many times that stat has changed on the server since the page was brought up -- it just keeps its state local in the browser in JS so it's pretty simple. That way you can monitor for stats getting bumped even if you have many thousands of them.

The main technical challenge bringing this into Envoy is maintaining the JS that does this and serving it statically. In PageSpeed that's done by "compiling" the JS into C strings which are linked into the server binary. Other than that, the data is already there and available via JSON so the JS has what it needs.

You can see this in action here: https://www.modpagespeed.com/pagespeed_admin/statistics -- just turn on auto-refresh and the checkbox next to "Number of changes". The UI isn't great but it works. You can make the server do something interesting while the stats page is up by (say) visiting rewrite_images in another tab and refreshing a few times.

I'd been thinking about doing this as a plane-project or something sometime, but figured I'd better see if folks think this would be worthwhile or not.

Contributor guide