🎉 Add optional loki integration.

And refactor internal error reporting.
This commit is contained in:
Andrey Antukh 2021-02-15 13:14:05 +01:00 committed by Andrés Moya
parent 90d7efe3a9
commit c1476d0397
15 changed files with 331 additions and 98 deletions

View file

@ -11,7 +11,6 @@
"A errors handling for the http server."
(:require
[app.common.uuid :as uuid]
[app.config :as cfg]
[app.util.log4j :refer [update-thread-context!]]
[clojure.tools.logging :as log]
[cuerdas.core :as str]
@ -30,16 +29,10 @@
:path (:uri request)
:method (:request-method request)
:params (:params request)
:version (:full cfg/version)
:host (:public-uri cfg/config)
:class (.getCanonicalName ^java.lang.Class (class error))
:hint (ex-message error)
:data edata}
(let [headers (:headers request)]
{:user-agent (get headers "user-agent")
:frontend-version (get headers "x-frontend-version" "unknown")})
(when (and (map? edata) (:data edata))
{:explain (explain-error edata)}))))