Last active
May 2, 2020 09:06
-
-
Save ivos/23a6cd5149bc4bc4dc86872e2f8cedbd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns backend.support.aspects | |
(:require ... | |
[backend.support.java-melody :as melody])) | |
(defn- monitoring-hook | |
[f & args] | |
(let [ns-name (->ns-name f) | |
fn-name (->fn-name f) | |
melody-request-name (str ns-name "/" fn-name)] | |
(.bindContextIncludingCpu melody/ejb-counter melody-request-name) | |
(try | |
(let [result (apply f args)] | |
(.addRequestForCurrentContext melody/ejb-counter false) | |
result) | |
(catch Throwable t | |
(.addRequestForCurrentContext melody/ejb-counter true) | |
(throw t))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment