Skip to content

Commit c6fc098

Browse files
committed
feat: improved node statistics
1 parent 2661358 commit c6fc098

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

core/dtn7/src/core/processing.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ pub async fn delete(mut bp: BundlePack, reason: StatusReportReason) -> Result<()
518518
if bndl.is_none() {
519519
bail!("bundle not found");
520520
}
521+
(*STATS.lock()).node.error_info.discarded_bundle_count += 1;
521522
let bndl = bndl.unwrap();
522523
if bndl
523524
.primary

core/dtn7/src/dtnd/daemon.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::cla::ConvergenceLayerAgent;
66
use crate::core::application_agent::SimpleApplicationAgent;
77
use crate::dtnconfig::DtnConfig;
88
use crate::ipnd::neighbour_discovery;
9-
use crate::{cla_add, peers_add};
9+
use crate::{cla_add, peers_add, STATS};
1010
use crate::{CLAS, CONFIG, DTNCORE, STORE};
1111
use bp7::EndpointID;
1212
use log::{error, info, warn};
@@ -67,6 +67,12 @@ pub async fn start_dtnd(cfg: DtnConfig) -> anyhow::Result<()> {
6767
{
6868
(*CONFIG.lock()).set(cfg);
6969
}
70+
71+
STATS.lock().node.node_state.last_up_time = std::time::SystemTime::now()
72+
.duration_since(std::time::UNIX_EPOCH)
73+
.unwrap_or_default()
74+
.as_secs();
75+
7076
info!("Local Node ID: {}", CONFIG.lock().host_eid);
7177

7278
info!("Work Dir: {:?}", CONFIG.lock().workdir);

0 commit comments

Comments
 (0)