mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 17:18:21 -05:00
✨ Minor improvements on loki reporter.
This commit is contained in:
parent
4e0289b341
commit
1b495ebad1
1 changed files with 13 additions and 7 deletions
|
@ -31,7 +31,7 @@
|
||||||
[_ {:keys [receiver uri] :as cfg}]
|
[_ {:keys [receiver uri] :as cfg}]
|
||||||
(when uri
|
(when uri
|
||||||
(l/info :msg "intializing loki reporter" :uri uri)
|
(l/info :msg "intializing loki reporter" :uri uri)
|
||||||
(let [input (a/chan (a/sliding-buffer 1024))]
|
(let [input (a/chan (a/dropping-buffer 512))]
|
||||||
(receiver :sub input)
|
(receiver :sub input)
|
||||||
(a/go-loop []
|
(a/go-loop []
|
||||||
(let [msg (a/<! input)]
|
(let [msg (a/<! input)]
|
||||||
|
@ -69,17 +69,23 @@
|
||||||
:method :post
|
:method :post
|
||||||
:headers {"content-type" "application/json"}
|
:headers {"content-type" "application/json"}
|
||||||
:body (json/encode payload)})]
|
:body (json/encode payload)})]
|
||||||
(if (= (:status response) 204)
|
(cond
|
||||||
|
(= (:status response) 204)
|
||||||
true
|
true
|
||||||
|
|
||||||
|
(= (:status response) 400)
|
||||||
(do
|
(do
|
||||||
(l/error :hint "error on sending log to loki"
|
(l/error :hint "error on sending log to loki (no retry)"
|
||||||
:try i
|
:rsp (pr-str response))
|
||||||
|
true)
|
||||||
|
|
||||||
|
:else
|
||||||
|
(do
|
||||||
|
(l/error :hint "error on sending log to loki" :try i
|
||||||
:rsp (pr-str response))
|
:rsp (pr-str response))
|
||||||
false)))
|
false)))
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
(l/error :hint "error on sending message to loki"
|
(l/error :hint "error on sending message to loki" :cause e :try i)
|
||||||
:cause e
|
|
||||||
:try i)
|
|
||||||
false)))
|
false)))
|
||||||
|
|
||||||
(defn- handle-event
|
(defn- handle-event
|
||||||
|
|
Loading…
Add table
Reference in a new issue