diff --git a/src/clj/daisyproducer2/words/confirm.clj b/src/clj/daisyproducer2/words/confirm.clj index ad332e9..736b539 100644 --- a/src/clj/daisyproducer2/words/confirm.clj +++ b/src/clj/daisyproducer2/words/confirm.clj @@ -1,9 +1,11 @@ (ns daisyproducer2.words.confirm (:require [conman.core :as conman] [daisyproducer2.db.core :as db] + [daisyproducer2.metrics :as metrics] [daisyproducer2.words :as words] [daisyproducer2.words.global :as global] - [daisyproducer2.words.local :as local])) + [daisyproducer2.words.local :as local] + [iapetos.collector.fn :as prometheus])) (defn get-words [limit offset] (->> (db/get-confirmable-words-aggregated {:limit limit :offset offset}) @@ -40,3 +42,5 @@ ;; the number of additions. (global/put-word word)))))) +(prometheus/instrument! metrics/registry #'get-words) +(prometheus/instrument! metrics/registry #'put-word) diff --git a/src/clj/daisyproducer2/words/global.clj b/src/clj/daisyproducer2/words/global.clj index f9018c4..4a1092d 100644 --- a/src/clj/daisyproducer2/words/global.clj +++ b/src/clj/daisyproducer2/words/global.clj @@ -1,9 +1,10 @@ (ns daisyproducer2.words.global - (:require [clojure.string :as string] - [clojure.tools.logging :as log] + (:require [clojure.tools.logging :as log] [daisyproducer2.db.core :as db] + [daisyproducer2.metrics :as metrics] [daisyproducer2.whitelists.hyphenation :as hyphenations] - [daisyproducer2.words :as words])) + [daisyproducer2.words :as words] + [iapetos.collector.fn :as prometheus])) (defn get-words [{:keys [untranslated limit offset]}] (-> (db/find-global-words {:untranslated (db/search-to-sql untranslated) @@ -33,3 +34,7 @@ (words/to-db word words/hyphenation-keys words/hyphenation-mapping)) (hyphenations/export)) deletions)) + +(prometheus/instrument! metrics/registry #'get-words) +(prometheus/instrument! metrics/registry #'put-word) +(prometheus/instrument! metrics/registry #'delete-word) diff --git a/src/clj/daisyproducer2/words/local.clj b/src/clj/daisyproducer2/words/local.clj index 5228833..5f55364 100644 --- a/src/clj/daisyproducer2/words/local.clj +++ b/src/clj/daisyproducer2/words/local.clj @@ -2,9 +2,11 @@ (:require [clojure.string :as string] [clojure.tools.logging :as log] [daisyproducer2.db.core :as db] + [daisyproducer2.metrics :as metrics] [daisyproducer2.whitelists.async :as whitelists] [daisyproducer2.whitelists.hyphenation :as hyphenations] - [daisyproducer2.words :as words])) + [daisyproducer2.words :as words] + [iapetos.collector.fn :as prometheus])) (defn get-words "Retrieve all local words for given document-id `id`, `grade` and @@ -61,3 +63,7 @@ (hyphenations/export)) (whitelists/export-local-tables (:document-id word)) deletions)) + +(prometheus/instrument! metrics/registry #'get-words) +(prometheus/instrument! metrics/registry #'put-word) +(prometheus/instrument! metrics/registry #'delete-word) diff --git a/src/clj/daisyproducer2/words/unknown.clj b/src/clj/daisyproducer2/words/unknown.clj index 063e0fa..8d95e69 100644 --- a/src/clj/daisyproducer2/words/unknown.clj +++ b/src/clj/daisyproducer2/words/unknown.clj @@ -4,7 +4,9 @@ [clojure.string :as string] [clojure.tools.logging :as log] [daisyproducer2.db.core :as db] + [daisyproducer2.metrics :as metrics] [daisyproducer2.words :as words] + [iapetos.collector.fn :as prometheus] [sigel.xpath.core :as xpath] [sigel.xslt.core :as xslt])) @@ -140,3 +142,5 @@ (map words/complement-braille) (map words/complement-ellipsis-braille) (map words/complement-hyphenation))) + +(prometheus/instrument! metrics/registry #'get-words)