# HG changeset patch # User Oleksandr Gavenko # Date 1487507901 -7200 # Node ID a25f209ebf15bf471513bd122b4da3729f1b1b4e # Parent d74af7d75f19fdb25a0b46220a36f4544190980c Library to access Spring Actuator endpoints. diff -r d74af7d75f19 -r a25f209ebf15 spring-actuator.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spring-actuator.el Sun Feb 19 14:38:21 2017 +0200 @@ -0,0 +1,23 @@ + +(defvar my/spring-actuator-server-history nil) +(defvar my/spring-actuator-last-server "http://localhost:8080") +(defvar my/spring-actuator-path-history nil) +(defvar my/spring-actuator-path-completion + '("actuator" "auditevents" "autoconfig" "beans" "configprops" "dump" "env" "flyway" "health" "heapdump" + "info" "jolokia" "liquibase" "logfile" "loggers" "mappings" "metrics" "shutdown" "trace"))) + +(defun my/spring-actuator (server path) + (interactive (list (read-string "Server: " my/spring-actuator-last-server 'my/spring-actuator-server-history) + (completing-read "Path: " my/spring-actuator-path-completion nil nil "" 'my/spring-actuator-path-history))) + (setq my/spring-actuator-last-server server) + (let ( (bufname (format "actuator: %s" path)) ) + (when (get-buffer bufname) + (kill-buffer bufname)) + (switch-to-buffer (url-retrieve-synchronously (format "%s/%s" server path))) + (rename-buffer bufname) + (goto-char (point-min)) + (re-search-forward "^$" nil 'move) + (forward-char) + (delete-region (point-min) (point)) + (json-pretty-print-buffer) + (json-mode) ))