Skip to content

Commit

Permalink
feat: metric migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
pjenvey committed Feb 20, 2024
1 parent 4c299ae commit 2f8d06b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions autopush-common/src/db/dual/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ impl DualClientImpl {
let target: (Box<&'a dyn DbClient>, bool) = if let Some(median) = self.median {
if uaid.as_bytes()[0] <= median {
debug!("⚖ Routing user to Bigtable");
// These are migrations so the metrics should appear as
// `auto[endpoint|connect].migrate`.
(Box::new(&self.primary), true)
} else {
(Box::new(&self.secondary), false)
Expand Down Expand Up @@ -192,6 +190,7 @@ impl DbClient for DualClientImpl {
debug_assert!(user.version.is_none());
user.version = Some(Uuid::new_v4());
self.primary.add_user(&user).await?;
self.metrics.incr_with_tags("database.migrate").send();
let channels = self.secondary.get_channels(uaid).await?;
// NOTE: add_channels doesn't write a new version:
// user.version is still valid
Expand Down

0 comments on commit 2f8d06b

Please sign in to comment.