What are some good ways of handling metric gathering (or, more generally,
AOP) in Clojure?
Suppose we have an application in which there is a transformation function,
foo->bar. Every time a foo is input to foo->bar, we'd like to increment the
foo-counter. Every time a bar is produced, we'd like to increment the
bar-counter.
To keep foo->bar pure, we can wrap foo->bar in another function like:
(fn [& args]
(counter/inc! foo-counter)
(let [result (apply f args)]
(counter/inc! bar-counter)
result))
But the side effect of incrementing counters makes it difficult to write a
unit test.
I have a vague idea of what I'd *like* to see, which is the function
returning:
- The result
- Some operation to be carried out, OR some data allowing the receiver
to carry out some operation?
I'm sure this is not a new problem for Clojure applications; what are some
strategies for handling it?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.