clj-commons/metrics-clojure

def<metric> macros prevent uberjar creation

ewollesen opened this issue · 4 comments

One or more of the def<metric> macros prevent lein uberjar from compiling successfully.

I've created a gist with a minimal project that exhibits the behavior. You can see it at: https://gist.github.com/ewollesen/33d6b6585bb8a7267be4

My setup:

$ uname -a
Darwin quill 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64 i386 MacBookPro10,1 Darwin
$ lein version
Leiningen 2.5.1 on Java 1.8.0_31 Java HotSpot(TM) 64-Bit Server VM

My clojure version is 1.6

As a workaround, I was able to use the non-macro functions to create the metrics I needed with no problems.

I debugged the issue with a few of my more knowledgeable co-workers, and one of them suggested that in the macro definitions, the default-registry object is being escaped, and this escaping is what is causing the problems with uberjar creation.

It is a known thing about macros: they also can't start threads that never terminate naturally (e.g. start a Jetty instance). We'll see what we can do.

Cool. I regret that my clojure isn't strong enough to have submitted a patch to go with this, but I'm glad to help with testing or information gathering.

@ewollesen no worries, having an app that reproduces the problem is plenty.

Sorry about the double references above. I broke my git history. The second fix is the correct one, and is the one in the pull request.