This repository was archived by the owner on Oct 23, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ the same backing database have access to the same data."
1212 [cfpb.qu.util :refer :all ]
1313 [cfpb.qu.data.result :refer [->DataResult]]
1414 [cfpb.qu.data.aggregation :as agg]
15+ [cfpb.qu.metrics :as metrics]
1516 [clojure.string :as str]
1617 [clojure.core.cache :as cache :refer [defcache ]]
1718 [clj-time.core :refer [now]]
@@ -92,9 +93,11 @@ the same backing database have access to the same data."
9293 ([database query not-found]
9394 (with-db database
9495 (let [collection (query-to-key query)]
95- (if (coll/exists? collection)
96- (extract-result collection query)
97- not-found)))))
96+ (if (coll/exists? collection)
97+ (do (metrics/increment " cache.hit" )
98+ (extract-result collection query))
99+ (do (metrics/increment " cache.wait" )
100+ not-found))))))
98101
99102(defn add-to-cache
100103 " Add the specified aggregation to the cache by running it through
@@ -255,6 +258,7 @@ one of `query_cache` will be used."
255258 [cache aggmap]
256259 (with-db (:database cache)
257260 (try
261+ (metrics/increment " cache.queue" )
258262 (coll/insert-and-return *work-collection* {:_id (:to aggmap)
259263 :status " unprocessed"
260264 :created (now )
You can’t perform that action at this time.
0 commit comments