Skip to content

Commit

Permalink
refactor: Emit metric for spanner DbPool::get time taken
Browse files Browse the repository at this point in the history
Closes: #952
  • Loading branch information
Ethan Donowitz committed Apr 12, 2021
1 parent 0dccb00 commit 9bff040
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/db/spanner/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ impl SpannerDbPool {
#[async_trait(?Send)]
impl DbPool for SpannerDbPool {
async fn get<'a>(&'a self) -> ApiResult<Box<dyn Db<'a>>> {
let mut metrics = self.metrics.clone();
metrics.start_timer("storage.spanner.get_pool", None);

self.get_async()
.await
.map(|db| Box::new(db) as Box<dyn Db<'a>>)
Expand Down

0 comments on commit 9bff040

Please sign in to comment.