Fork me on GitHub

Is anyone aware of a fairly uninvasive way to, given pedestal routes, an interceptor name (e.g. ::json-response), and an event name (e.g. :leave), of recording the timing of every such event?


Is the :leave event the interceptor chain event :leave? as in :enter, :leave, :error?


(I don’t have an answer, just want to understand the question)


Yea. There are a few interceptor events I’m interested in getting performance metrics on and I’d like to do it declaratively. Pedestal’s architecture facilitates this, but I’m almost a little surprised it doesn’t already have such a feature.


My current impl thought is to walk the results of io.pedestal.http.route/expand-routes and wrap the target interceptors in each route individually


Hi @donaldball, Pedestal’s interceptor chain execution is managed by the io.pedestal.interceptor.chain ns. The current implementation does not support that level of instrumentation. While there’s an option to get more information regarding interceptor chain execution by using a more verbose logging level (i.e., DEBUG, TRACE), it doesn’t sound like that’s what you are looking for. Your best bet is to either instrument the interceptors yourself or, if you’d like to get metrics for a production service, leverage an instrumentation library (i.e., New Relic) which is compatible with pedestal.log’s metric implementation. If you do the later, you likely need to add write an interceptor to identify requests (i.e., name transactions in New Relic). The benefit of using an instrumentation lib is that you’ll be able to collect information for all your apis and filter them as you see fit.


Although I’ve no experience with this, it may be useful: