Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

Commit 8738a54

Browse files
author
Jorin Vogel
committed
metrics: Only count successful syncs
1 parent c2dd09a commit 8738a54

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject googlesheets-sql-sync "0.2.0"
1+
(defproject googlesheets-sql-sync "0.3.0"
22
:description "Keep your SQL database in sync with Google Sheets"
33
:url "https://github.com/jorinvo/googlesheets-sql-sync"
44
:license {:name "MIT"

src/googlesheets_sql_sync/metrics.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"Convert metrics to readable string"
1616
[{:keys [::sync-counter]}]
1717
(str
18-
"# HELP googlesheets_sql_sync_count The total number of syncs completed.\n"
18+
"# HELP googlesheets_sql_sync_count The total number of syncs successfully completed.\n"
1919
"# TYPE googlesheets_sql_sync_count counter\n"
2020
(format "googlesheets_sql_sync_count %d\n" @sync-counter)))
2121

src/googlesheets_sql_sync/worker.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
(->> (:sheets cfg)
3131
(map #(sheets/get-rows % token throttler))
3232
(run! #(db/update-table cfg %)))
33-
(log/info "Sync done"))
33+
(log/info "Sync done")
34+
(metrics/count-sync ctx))
3435
(if no-server
3536
(do
3637
(log/error "Cannot authenticate when server is disabled")
@@ -39,7 +40,6 @@
3940
(catch Exception e (log/error (.getMessage e) "\nSync failed")))
4041
(log/info "Next sync in" (interval/->string (:interval cfg)))
4142
(async/put! timeout> (:interval cfg)))
42-
(metrics/count-sync ctx)
4343
(catch Exception e (do (log/error "Failed reading config file" (.getMessage e))
4444
:not-ok))))
4545

0 commit comments

Comments
 (0)