From 81bf68c67ce02c4c52caa051f283e8b21e8e8faa Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 9 Feb 2021 14:24:46 +0100 Subject: [PATCH] :sparkles: Minor improvement on telemetry server error reporting. --- backend/src/app/config.clj | 1 - backend/src/app/tasks/telemetry.clj | 3 ++- backend/src/app/telemetry.clj | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/src/app/config.clj b/backend/src/app/config.clj index 71de67169..3a313d4a9 100644 --- a/backend/src/app/config.clj +++ b/backend/src/app/config.clj @@ -57,7 +57,6 @@ :registration-domain-whitelist "" :telemetry-enabled false - :telemetry-with-taiga true :telemetry-uri "https://telemetry.penpot.app/" ;; LDAP auth disabled by default. Set ldap-auth-host to enable diff --git a/backend/src/app/tasks/telemetry.clj b/backend/src/app/tasks/telemetry.clj index bd5f5a3b4..64ca03c8e 100644 --- a/backend/src/app/tasks/telemetry.clj +++ b/backend/src/app/tasks/telemetry.clj @@ -63,6 +63,7 @@ :uri (:uri cfg) :headers {"content-type" "application/json"} :body (json/encode-str data)})] + (when (not= 200 (:status response)) (ex/raise :type :internal :code :invalid-response-from-google @@ -129,7 +130,7 @@ [{:keys [conn version]}] (merge {:version version - :with-taiga (:telemetry-with-taiga cfg/config) + :with-taiga (:telemetry-with-taiga cfg/config false) :total-teams (retrieve-num-teams conn) :total-projects (retrieve-num-projects conn) :total-files (retrieve-num-files conn)} diff --git a/backend/src/app/telemetry.clj b/backend/src/app/telemetry.clj index b97c79360..a8e5edae7 100644 --- a/backend/src/app/telemetry.clj +++ b/backend/src/app/telemetry.clj @@ -12,6 +12,7 @@ [app.common.spec :as us] [app.db :as db] [app.http.middleware :refer [wrap-parse-request-body]] + [clojure.pprint :refer [pprint]] [clojure.spec.alpha :as s] [clojure.tools.logging :as log] [integrant.core :as ig] @@ -87,7 +88,12 @@ (catch Exception e ;; We don't want notify user of a error, just log it for posible ;; future investigation. - (log/warnf e "Unexpected error on telemetry."))) + (log/warn e (str "Unexpected error on telemetry:\n" + (when-let [edata (ex-data e)] + (str "ex-data: \n" + (with-out-str (pprint edata)))) + (str "params: \n" + (with-out-str (pprint params))))))) {:status 200 :body "OK\n"})