From c2360259af6582164a8d33bf6509deb8d3d2e532 Mon Sep 17 00:00:00 2001 From: Chris F Ravenscroft Date: Mon, 4 Oct 2021 23:31:13 -0700 Subject: [PATCH] Internal Stats -- performance view (#221) --- assets/glauth.js | 22 ++++++++++++++++++++-- assets/index.html | 13 +++++++++---- glauth.go | 11 +++++++++++ go.mod | 1 + go.sum | 4 ++++ pkg/config/config.go | 1 + sample-simple.cfg | 1 + 7 files changed, 47 insertions(+), 6 deletions(-) diff --git a/assets/glauth.js b/assets/glauth.js index c8c1d0d..864e381 100644 --- a/assets/glauth.js +++ b/assets/glauth.js @@ -1,14 +1,32 @@ var interval = 2000; +var internalsEnabled = false; + $(function() { - updateMetrics(); - //updateTail(); + $.get("/internals", function() { + internalsEnabled = true; + }) + .always(function() { + updateMetrics(); + //updateTail(); + }) }); var tailId = 0; function updateMetrics() { var metrics = $.getJSON( "/debug/vars", function(d) { + var template = Handlebars.compile( $("#header-messages-template").html() ); + var messages = []; + if(internalsEnabled) { + messages.push({"message": "Also available: Internals: heap, cache, objects, etc."}); + } + var html = template({ + "header": { + "messages": messages + } + }); + $("#headerpanel").html(html); var template = Handlebars.compile( $("#statspanel-template").html() ); var html = template(d); $("#statspanel").html(html); diff --git a/assets/index.html b/assets/index.html index f46006c..31957e6 100644 --- a/assets/index.html +++ b/assets/index.html @@ -29,19 +29,18 @@

GLAuth

-

This tool is in development - not quite ready for production!

- +
-

stats

+

frontend stats

-

backend servers

+

backend (LDAP) servers

@@ -49,6 +48,12 @@
+ +