This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-05
Channels
- # aws-lambda (1)
- # beginners (294)
- # boot (35)
- # cider (19)
- # cljs-dev (39)
- # cljsrn (7)
- # clojars (48)
- # clojure (266)
- # clojure-android (1)
- # clojure-brasil (1)
- # clojure-france (2)
- # clojure-greece (5)
- # clojure-italy (7)
- # clojure-mexico (1)
- # clojure-russia (24)
- # clojure-spec (10)
- # clojure-uk (31)
- # clojurescript (134)
- # consulting (7)
- # cursive (69)
- # datomic (20)
- # emacs (57)
- # events (2)
- # figwheel (2)
- # hoplon (1)
- # jobs-discuss (19)
- # luminus (33)
- # lumo (18)
- # mount (1)
- # off-topic (32)
- # om (5)
- # onyx (27)
- # pedestal (15)
- # re-frame (12)
- # reagent (28)
- # rum (2)
- # schema (2)
- # spacemacs (9)
- # unrepl (2)
- # untangled (7)
- # vim (5)
- # yada (4)
@crimeminister I've started using pedestal interceptors for non-web stuff and I'd certainly find that useful
@hagmonk very curious what you are using it for?
@kirill.salykin basically I have a data processing pipeline, so I now set that up as a chain of interceptors
which allows me to specify the steps using data, and do other things like wrap the interceptors in metrics and logging
so I actually have each interceptor wrapped in another one that times step execution, adding that to the context map as we go. Very handy.
indeed, thanks!
I made a function that takes a symbol (which points to a function) and turns it into an interceptor:
(defn make-interceptor [sym]
(let [int-fn (deref sym)
int-nm (-> sym str (str/split #"/") last keyword)
int-id (uuid/v1)
ent-fn (fn [ctx]
(-> ctx
(assoc-in [:timings int-nm] (System/currentTimeMillis))
int-fn
(update-in [:timings int-nm] #(- (System/currentTimeMillis) %))))]
(interceptor {::chain/execution-id int-id
:name int-nm
:enter ent-fn})))
hagmonk: I will use this, thanks. Makes me want a nice way for evaluating pipeline performance more generally, e.g. an easy way to run criterium on every interceptor fn and on the pipeline as a whole.
Yeah! I think there's a ton of stuff you can do. For instance I'm trying to spec the context map as it goes, so this make-interceptor can be subjected to generative testing. Having a generative test that runs across my whole pipeline would be kind of mind blowing, and could be interesting for performance testing too.
@hagmonk I have been using Onyx with its onyx-local-rt
for setting up data processing pipelines, but I like the idea of the Pedestal interceptor chain becoming more of a first class citizen. It will be easier to embed, for one thing.
In Vase, why is it required to give a :name
to each interceptor in the service edn file? It seems that this often just adds noise that I don't directly care about.