Merge remote-tracking branch 'origin/main' into develop

This commit is contained in:
Andrey Antukh 2021-06-03 12:41:06 +02:00
commit ba33de815f
2 changed files with 14 additions and 8 deletions

View file

@ -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

View file

@ -254,7 +254,7 @@
:app.tasks.file-xlog-gc/handler :app.tasks.file-xlog-gc/handler
{:pool (ig/ref :app.db/pool) {:pool (ig/ref :app.db/pool)
:metrics (ig/ref :app.metrics/metrics) :metrics (ig/ref :app.metrics/metrics)
:max-age cf/deletion-delay} :max-age (dt/duration {:hours 48})}
:app.tasks.telemetry/handler :app.tasks.telemetry/handler
{:pool (ig/ref :app.db/pool) {:pool (ig/ref :app.db/pool)