spring-actuator.el
changeset 1483 a25f209ebf15
child 1484 8fe1eaf66e94
equal deleted inserted replaced
1482:d74af7d75f19 1483:a25f209ebf15
       
     1 
       
     2 (defvar my/spring-actuator-server-history nil)
       
     3 (defvar my/spring-actuator-last-server "http://localhost:8080")
       
     4 (defvar my/spring-actuator-path-history nil)
       
     5 (defvar my/spring-actuator-path-completion
       
     6   '("actuator" "auditevents" "autoconfig" "beans" "configprops" "dump" "env" "flyway" "health" "heapdump"
       
     7     "info" "jolokia" "liquibase" "logfile" "loggers" "mappings" "metrics" "shutdown" "trace")))
       
     8 
       
     9 (defun my/spring-actuator (server path)
       
    10   (interactive (list (read-string "Server: " my/spring-actuator-last-server 'my/spring-actuator-server-history)
       
    11                      (completing-read "Path: " my/spring-actuator-path-completion nil nil "" 'my/spring-actuator-path-history)))
       
    12   (setq my/spring-actuator-last-server server)
       
    13   (let ( (bufname (format "actuator: %s" path)) )
       
    14     (when (get-buffer bufname)
       
    15       (kill-buffer bufname))
       
    16     (switch-to-buffer (url-retrieve-synchronously (format "%s/%s" server path)))
       
    17     (rename-buffer bufname)
       
    18     (goto-char (point-min))
       
    19     (re-search-forward "^$" nil 'move)
       
    20     (forward-char)
       
    21     (delete-region (point-min) (point))
       
    22     (json-pretty-print-buffer)
       
    23     (json-mode) ))