From b308300deb0dbcf0cbdd29a8a0aacae7ced04b7a Mon Sep 17 00:00:00 2001 From: caumond Date: Tue, 24 Oct 2023 22:23:56 +0200 Subject: [PATCH] ready for review --- .github/workflows/commit_validation.yml | 4 +- bb.edn | 2 +- deps.edn | 10 +- docs/code/alias.edn | 2 +- docs/code/deps.png | 4 +- docs/code/namespace.edn | 2 +- env/development/config.edn | 2 +- env/development/resources/version.edn | 4 +- package-lock.json | 124 +----------------- package.json | 3 +- src/cljc/automaton_core/log.cljc | 2 +- src/cljc/automaton_core/utils/map.cljc | 3 +- src/cljs/automaton_core/log/fe_log.cljc | 11 +- .../log/tracking/fe_error_tracking.cljs | 7 +- .../log/tracking/fe_sentry.cljs | 21 +-- test/cljs/automaton_core/log/fe_log_test.cljs | 2 +- version.edn | 4 +- 17 files changed, 33 insertions(+), 174 deletions(-) diff --git a/.github/workflows/commit_validation.yml b/.github/workflows/commit_validation.yml index 5f7732f5..662f5ffd 100644 --- a/.github/workflows/commit_validation.yml +++ b/.github/workflows/commit_validation.yml @@ -6,10 +6,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set ownership run: | # this is to fix GIT not liking owner of the checkout dir, See https://github.com/actions/runner/issues/2033 chown -R $(id -u):$(id -g) $PWD - name: Base image - uses: docker://hephaistox/gha_runner:latest + uses: docker://hephaistox/gha-automaton-core:latest diff --git a/bb.edn b/bb.edn index 1e10fefc..5849dba7 100644 --- a/bb.edn +++ b/bb.edn @@ -51,7 +51,7 @@ 'automaton-build-app.tasks.code-helpers/lconnect)}, ltest {:doc "Local test", :task (execute-task 'automaton-build-app.tasks.test/ltest)}, - publish + publish-gha-container {:doc "Publish the container, useful to push the github container itself", :task (execute-task diff --git a/deps.edn b/deps.edn index d9a9e6cd..d1388ff1 100644 --- a/deps.edn +++ b/deps.edn @@ -2,13 +2,13 @@ babashka/process #:mvn{:version "0.5.21"}, danlentz/clj-uuid #:mvn{:version "0.1.9"}, metosin/malli #:mvn{:version "0.13.0"}, - lambdaisland/uri {:mvn/version "1.15.125"} + lambdaisland/uri {:mvn/version "1.16.134"} mount/mount #:mvn{:version "0.1.17"}, com.clojure-goes-fast/clj-memory-meter #:mvn{:version "0.3.0"}, org.apache.logging.log4j/log4j-api #:mvn{:version "2.20.0"}, org.apache.logging.log4j/log4j-core #:mvn{:version "2.20.0"}, org.apache.logging.log4j/log4j-slf4j2-impl #:mvn{:version "2.20.0"}, - io.sentry/sentry {:mvn/version "6.29.0"}, + io.sentry/sentry {:mvn/version "6.32.0"}, io.sentry/sentry-clj #:mvn{:version "6.28.200"}, com.taoensso/tempura #:mvn{:version "1.5.3"}, com.taoensso/encore #:mvn{:version "3.62.1"} @@ -29,8 +29,8 @@ :jvm-opts ["-Dheph-conf=env/test/config.edn" "-Dheph-common-conf=env/common_config.edn"]} - :build {:extra-deps {hephaistox/automaton-build-app {:git/url "git@github.com:hephaistox/automaton-build-app.git" - :sha "33c8941cb6df63006bafaaf1d5e7f0383b10468a"}}} + :build {:extra-deps {hephaistox/automaton-build-app {:git/url "https://github.com/hephaistox/automaton-core.git" + :sha "9729eb2e4698bad758b24d24d236064e436342c5"}}} :env-development-repl {:extra-paths ["env/development/resources" "env/development/src/clj" @@ -50,7 +50,7 @@ "-d" "test/cljc"]} :cljs-deps {:extra-paths ["src/cljs" "src/cljc" "resources" "test/cljs" "test/cljc"] - :extra-deps {thheller/shadow-cljs {:mvn/version "2.25.8"} + :extra-deps {thheller/shadow-cljs {:mvn/version "2.25.9"} cider/cider-nrepl {:mvn/version "0.21.1"} binaryage/devtools {:mvn/version "1.0.7"}}} diff --git a/docs/code/alias.edn b/docs/code/alias.edn index 5dc06bae..7067b2fb 100644 --- a/docs/code/alias.edn +++ b/docs/code/alias.edn @@ -1,2 +1,2 @@ -;; List of aliases referencing many namespaces Tue Oct 24 19:33:10 CEST 2023 +;; List of aliases referencing many namespaces Tue Oct 24 22:21:19 CEST 2023 {} \ No newline at end of file diff --git a/docs/code/deps.png b/docs/code/deps.png index fe2528da..dca08df7 100644 --- a/docs/code/deps.png +++ b/docs/code/deps.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf94152c0c813e1cc7810ffb2b13b1a77ee2670e380fb82ce4b09f0bee8bc344 -size 230515 +oid sha256:3f881ca84076373e145249f64df462bca175c03f895616f450f323793625ba06 +size 230741 diff --git a/docs/code/namespace.edn b/docs/code/namespace.edn index 2e4990c9..7067b2fb 100644 --- a/docs/code/namespace.edn +++ b/docs/code/namespace.edn @@ -1,2 +1,2 @@ -;; List of aliases referencing many namespaces Tue Oct 24 19:33:11 CEST 2023 +;; List of aliases referencing many namespaces Tue Oct 24 22:21:19 CEST 2023 {} \ No newline at end of file diff --git a/env/development/config.edn b/env/development/config.edn index 65cda696..0af55b8d 100644 --- a/env/development/config.edn +++ b/env/development/config.edn @@ -1,2 +1,2 @@ {:env :development - :dev {:clj-nrepl-port 8010}} + :dev {:clj-nrepl-port 8012}} diff --git a/env/development/resources/version.edn b/env/development/resources/version.edn index 38f8f339..0554a5ae 100644 --- a/env/development/resources/version.edn +++ b/env/development/resources/version.edn @@ -1,3 +1,3 @@ ;; Last generated version, note a failed push consume a number Tue Oct 24 -;; 19:32:54 CEST 2023 -{:major-version "1.2.%s", :minor-version 3, :version "1.2.3"} \ No newline at end of file +;; 22:20:52 CEST 2023 +{:major-version "1.2.%s", :minor-version 5, :version "1.2.5"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index af01c67f..28826902 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,7 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@sentry/react": "^7.69.0", - "react-router-dom": "^6.16.0" + "@sentry/browser": "^7.73.0" }, "devDependencies": { "karma": "^6.4.2", @@ -28,14 +27,6 @@ "node": ">=0.1.90" } }, - "node_modules/@remix-run/router": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.9.0.tgz", - "integrity": "sha512-bV63itrKBC0zdT27qYm6SDZHlkXwFL1xMBuhkn+X7l0+IIhNaH5wuuvZKp6eKhCD4KFhujhfhCT1YxXW6esUIA==", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/@sentry-internal/tracing": { "version": "7.73.0", "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.73.0.tgz", @@ -79,24 +70,6 @@ "node": ">=8" } }, - "node_modules/@sentry/react": { - "version": "7.73.0", - "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.73.0.tgz", - "integrity": "sha512-RCGlxW0Xp5vsC38LGxUO0Xf11LBzfg75VN+KS3D2FS5GXl0R0JwgUyPNVlod7YMCfwytsKGhfP+YpQvHGQAVwg==", - "dependencies": { - "@sentry/browser": "7.73.0", - "@sentry/types": "7.73.0", - "@sentry/utils": "7.73.0", - "hoist-non-react-statics": "^3.3.2", - "tslib": "^2.4.1 || ^1.9.3" - }, - "engines": { - "node": ">=8" - }, - "peerDependencies": { - "react": "15.x || 16.x || 17.x || 18.x" - } - }, "node_modules/@sentry/replay": { "version": "7.73.0", "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.73.0.tgz", @@ -1258,14 +1231,6 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "node_modules/hoist-non-react-statics": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", - "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", - "dependencies": { - "react-is": "^16.7.0" - } - }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -1434,12 +1399,6 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "peer": true - }, "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -1547,18 +1506,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "peer": true, - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -1991,66 +1938,6 @@ "node": ">= 0.8" } }, - "node_modules/react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - }, - "peerDependencies": { - "react": "^18.2.0" - } - }, - "node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - }, - "node_modules/react-router": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.16.0.tgz", - "integrity": "sha512-VT4Mmc4jj5YyjpOi5jOf0I+TYzGpvzERy4ckNSvSh2RArv8LLoCxlsZ2D+tc7zgjxcY34oTz2hZaeX5RVprKqA==", - "dependencies": { - "@remix-run/router": "1.9.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "react": ">=16.8" - } - }, - "node_modules/react-router-dom": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.16.0.tgz", - "integrity": "sha512-aTfBLv3mk/gaKLxgRDUPbPw+s4Y/O+ma3rEN1u8EgEpLpPe6gNjIsWt9rxushMHHMb7mSwxRGdGlGdvmFsyPIg==", - "dependencies": { - "@remix-run/router": "1.9.0", - "react-router": "6.16.0" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "react": ">=16.8", - "react-dom": ">=16.8" - } - }, "node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", @@ -2174,15 +2061,6 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "node_modules/scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0" - } - }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", diff --git a/package.json b/package.json index 59ba6262..9c243388 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,7 @@ "version": "1.0.0", "author": "Hephaistox ", "dependencies": { - "react-router-dom": "^6.16.0", - "@sentry/react": "^7.69.0" + "@sentry/browser": "^7.73.0" }, "workspaces": [], "devDependencies": { diff --git a/src/cljc/automaton_core/log.cljc b/src/cljc/automaton_core/log.cljc index cf9284c0..b85a7792 100644 --- a/src/cljc/automaton_core/log.cljc +++ b/src/cljc/automaton_core/log.cljc @@ -1,5 +1,5 @@ (ns automaton-core.log - "Main entrypoint to logging, defines basic levels that we use to log. + "Main entrypoint to automaton core logging, defines basic levels that we use to log. Logical order of logs is: trace -> debug -> info -> warn -> error -> fatal" diff --git a/src/cljc/automaton_core/utils/map.cljc b/src/cljc/automaton_core/utils/map.cljc index 30c714ae..bc81576c 100644 --- a/src/cljc/automaton_core/utils/map.cljc +++ b/src/cljc/automaton_core/utils/map.cljc @@ -79,8 +79,7 @@ [m] (when (map? m) (->> (walk/postwalk prefixify-children m) - (map (fn [[k v]] - {k (if (sequential? v) (flatten v) v)})) + (map (fn [[k v]] {k (if (sequential? v) (flatten v) v)})) (into {})))) (defn add-ids diff --git a/src/cljs/automaton_core/log/fe_log.cljc b/src/cljs/automaton_core/log/fe_log.cljc index ce51809a..b2ae69c8 100644 --- a/src/cljs/automaton_core/log/fe_log.cljc +++ b/src/cljs/automaton_core/log/fe_log.cljc @@ -2,12 +2,9 @@ "Factory generating log function" (:require [automaton-core.log.strategy] [automaton-core.log.fe-registry] - [automaton-core.log.strategy.static-ns-level] - #?(:cljs [automaton-core.log.tracking.fe-error-tracking :as exs])) + [automaton-core.log.strategy.static-ns-level]) #?(:cljs (:require-macros [automaton-core.log.fe-log]))) -#?(:cljs (defn log-init! [params] (exs/init-error-tracking! params))) - (defn logger-ids-to-logger-fns [logger-ids] (reduce (fn [acc logger-id] @@ -24,7 +21,7 @@ (let [ns (str *ns*) log-fns `(automaton-core.log.fe-log/logger-ids-to-logger-fns ~logger-id)] - `((apply juxt ~log-fns) ~ns (str ~level) ~@message))) + `((apply juxt ~log-fns) ~ns ~level ~@message))) (defmacro log-exception [logger-id level exception & additional-message] @@ -32,7 +29,7 @@ (let [ns (str *ns*) log-fns `(automaton-core.log.fe-log/logger-ids-to-logger-fns ~logger-id)] - `((apply juxt ~log-fns) ~ns (str ~level) ~exception))) + `((apply juxt ~log-fns) ~ns ~level ~exception))) (defmacro log-data [logger-id level data & additional-message] @@ -40,7 +37,7 @@ (let [ns (str *ns*) log-fns `(automaton-core.log.fe-log/logger-ids-to-logger-fns ~logger-id)] - `((apply juxt ~log-fns) ~ns (str ~level) ~data))) + `((apply juxt ~log-fns) ~ns ~level ~data))) (defmacro log-format [logger-id level fmt & data] diff --git a/src/cljs/automaton_core/log/tracking/fe_error_tracking.cljs b/src/cljs/automaton_core/log/tracking/fe_error_tracking.cljs index b317ae96..ec8d2382 100644 --- a/src/cljs/automaton_core/log/tracking/fe_error_tracking.cljs +++ b/src/cljs/automaton_core/log/tracking/fe_error_tracking.cljs @@ -2,15 +2,12 @@ "Automaton web monitoring live exceptions for remote enviroments (e.g. production, local acceptance, global acceptance)." (:require [automaton-core.log.tracking.fe-sentry :as sentry])) -(defn init-error-tracking! - [{:keys [dsn env traced-website]}] - (sentry/init-sentry! {:dsn dsn, :traced-website traced-website, :env env})) - (defn log-fn [ns level & message] (let [context (if (map? (first message)) (merge (first message) {:ns ns}) {:ns ns}) - message (if (map? (first message)) (rest message) message)] + message (apply str (if (map? (first message)) (rest message) message)) + level (if (= :trace level) :debug level)] (if (or (= level :error) (= level :fatal)) (sentry/send-event! {:message message, :level level, :context context}) (sentry/send-breadcrumb! diff --git a/src/cljs/automaton_core/log/tracking/fe_sentry.cljs b/src/cljs/automaton_core/log/tracking/fe_sentry.cljs index 6aa9dc67..2981748b 100644 --- a/src/cljs/automaton_core/log/tracking/fe_sentry.cljs +++ b/src/cljs/automaton_core/log/tracking/fe_sentry.cljs @@ -1,11 +1,7 @@ (ns automaton-core.log.tracking.fe-sentry "Sentry frontend logging." - (:require - [react :as react] - ["@sentry/react" :as Sentry] - ["react-router-dom" :refer - (useLocation useNavigationType createRoutesFromChildren matchRoutes)] - [automaton-core.log.tracking.sentry :as asentry])) + (:require ["@sentry/browser" :as Sentry] + [automaton-core.log.tracking.sentry :as asentry])) (defn send-breadcrumb! "Sends breadcrumb, which will not be shown in sentry untill event is sent. @@ -27,16 +23,9 @@ (.init Sentry #js {:dsn dsn, :environment env, - :integrations #js [(new (.-BrowserTracing Sentry) - #js {:routingInstrumentation - (.reactRouterV6Instrumentation - Sentry - react/useEffect - useLocation - useNavigationType - createRoutesFromChildren - matchRoutes)}) - (new (.-Replay Sentry))], + :integrations #js [(new (.-BrowserTracing Sentry))], + :replaysSessionSampleRate 0, + :replaysOnErrorSampleRate 0, :tracesSampleRate 1.0, :tracePropagationTargets #js ["localhost" traced-website], :beforeSend (fn [event] diff --git a/test/cljs/automaton_core/log/fe_log_test.cljs b/test/cljs/automaton_core/log/fe_log_test.cljs index 48394cdb..2c3a6c3b 100644 --- a/test/cljs/automaton_core/log/fe_log_test.cljs +++ b/test/cljs/automaton_core/log/fe_log_test.cljs @@ -18,7 +18,7 @@ (automaton-core.log.fe-log/logger-ids-to-logger-fns [:automaton-core.log.registry/print])) "automaton-core.log.fe-log-test" - (clojure.core/str :fatal) + :fatal "foo" "bar") (macroexpand '(sut/log diff --git a/version.edn b/version.edn index e55b51e0..c323680f 100644 --- a/version.edn +++ b/version.edn @@ -1,3 +1,3 @@ ;; Last generated version, note a failed push consume a number Tue Oct 24 -;; 19:35:07 CEST 2023 -{:major-version "1.2.%s", :minor-version 0, :version "1.2.0"} \ No newline at end of file +;; 22:23:55 CEST 2023 +{:major-version "1.2.%s", :minor-version 1, :version "1.2.1"} \ No newline at end of file