فهرست منبع

enhance: add db schema versions to error capture

Tienson Qin 5 ماه پیش
والد
کامیت
693b2c166d
2فایلهای تغییر یافته به همراه9 افزوده شده و 5 حذف شده
  1. 5 1
      src/main/frontend/handler/events.cljs
  2. 4 4
      src/main/frontend/modules/instrumentation/sentry.cljs

+ 5 - 1
src/main/frontend/handler/events.cljs

@@ -50,6 +50,7 @@
             [frontend.util.persist-var :as persist-var]
             [goog.dom :as gdom]
             [lambdaisland.glogi :as log]
+            [logseq.db.frontend.schema :as db-schema]
             [promesa.core :as p]))
 
 ;; TODO: should we move all events here?
@@ -199,7 +200,10 @@
                        :user-id user-uuid
                        :graph-id graph-uuid
                        :tx-id tx-id
-                       :db-based (config/db-based-graph? (state/get-current-repo)))]
+                       :db-based (config/db-based-graph? (state/get-current-repo))
+                       :schema-version db-schema/version
+                       :db-schema-version (when-let [db (frontend.db/get-db)]
+                                            (:kv/value (frontend.db/entity db :logseq.kv/schema-version))))]
     (Sentry/captureException error
                              (bean/->js {:tags payload}))))
 

+ 4 - 4
src/main/frontend/modules/instrumentation/sentry.cljs

@@ -16,14 +16,14 @@
                          version)
    :environment (if config/dev? "development" "production")
    :initialScope {:tags
-                  (merge
-                   (when (not-empty config/revision)
-                     {:revision config/revision})
+                  (cond->
                    {:platform (cond
                                 (util/electron?) "electron"
                                 (mobile-util/native-platform?) "mobile"
                                 :else "web")
-                    :publishing config/publishing?})}
+                    :publishing config/publishing?}
+                    (not-empty config/revision)
+                    (assoc :revision config/revision))}
    ;; :integrations [(new posthog/SentryIntegration posthog "logseq" 5311485)
    ;;                (new BrowserTracing)]
    :debug config/dev?