Skip to content

Commit

Permalink
Ensure we can get latest timestamp (#226)
Browse files Browse the repository at this point in the history
* ensure we can get latest timestamp

* ensure latest traversel added

* fmt

* Update notification-server/CHANGELOG.md

Co-authored-by: Søren Bruus Zeppelin <[email protected]>

---------

Co-authored-by: Søren Bruus Zeppelin <[email protected]>
  • Loading branch information
lassemand and soerenbf authored Sep 18, 2024
1 parent 9f443d9 commit 84263e0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion notification-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## 0.3.3
- Add timestamp for when a block was last processed to tracked metrics

## 0.3.2
- Initiate prepared statements from within each function call
-

## 0.3.1
- No longer use aspn specific information

Expand Down
2 changes: 1 addition & 1 deletion notification-server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion notification-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Concordium AG [email protected]"]
edition = "2021"
name = "notification-server"
version = "0.3.2"
version = "0.3.3"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
8 changes: 6 additions & 2 deletions notification-server/src/bin/service.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::{anyhow, Context};
use axum_prometheus::{
metrics::{counter, histogram},
metrics::{counter, gauge, histogram},
metrics_exporter_prometheus::PrometheusBuilder,
};
use backoff::{future::retry, ExponentialBackoff};
Expand All @@ -20,7 +20,7 @@ use notification_server::{
};
use std::{
path::PathBuf,
time::{Duration, Instant},
time::{Duration, Instant, SystemTime, UNIX_EPOCH},
};
use tonic::{codegen::http, transport::ClientTlsConfig};
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
Expand Down Expand Up @@ -329,6 +329,10 @@ async fn traverse_chain(
processed_height = block_height;
let delta = start.elapsed();
histogram!("block.process_successful_duration").record(delta);
if let Ok(duration_since_epoch) = SystemTime::now().duration_since(UNIX_EPOCH) {
let current_timestamp = duration_since_epoch.as_secs() as f64;
gauge!("block.process_successful_last_unix").set(current_timestamp);
}
}
Err(err) => {
error!("Error occurred while processing block: {:?}", err);
Expand Down

0 comments on commit 84263e0

Please sign in to comment.