Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/network-monitor/src/deploy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ pub async fn create_genesis_aware_rpc_client(
err,
target: COMPONENT,
"RPC genesis discovery failed; retrying after backoff",
retry.delay_ms = sleep.as_millis() as u64
retry.delay_ms = sleep
);
})
.await
Expand Down
2 changes: 1 addition & 1 deletion bin/network-monitor/src/monitor/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ async fn run_ntx(
err,
target: LOG_TARGET,
"NTX bootstrap failed; retrying after backoff",
retry.delay_ms = sleep.as_millis() as u64
retry.delay_ms = sleep
);
let msg = format!("deploying monitor accounts failed: {err:#}");
increment_tx.send_replace(ServiceStatus::unhealthy(
Expand Down
2 changes: 1 addition & 1 deletion bin/ntx-builder/src/actor/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fn log_transient_retry<E: std::error::Error>(operation: &'static str, err: &E, s
target: COMPONENT,
"ntx transient request failure; retrying after backoff",
operation.name = operation,
retry.delay_ms = sleep.as_millis() as u64
retry.delay_ms = sleep
);
}

Expand Down
2 changes: 1 addition & 1 deletion bin/ntx-builder/src/clients/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl RpcClient {
err,
target: COMPONENT,
"RPC connection failed while opening block subscription, retrying",
retry.delay_ms = dur.as_millis() as u64
retry.delay_ms = dur
);
})
.await
Expand Down
4 changes: 2 additions & 2 deletions crates/block-producer/src/rpc_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl BlockSync {
err,
target: LOG_TARGET,
"Block sync failed, retrying",
retry.delay_ms = RECONNECT_DELAY.as_millis() as u64
retry.delay_ms = RECONNECT_DELAY
);
});

Expand Down Expand Up @@ -284,7 +284,7 @@ impl ProofSync {
err,
target: LOG_TARGET,
"Proof sync failed, retrying",
retry.delay_ms = RECONNECT_DELAY.as_millis() as u64
retry.delay_ms = RECONNECT_DELAY
);
});

Expand Down
4 changes: 2 additions & 2 deletions crates/proto/src/clients/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ impl Builder<WantsConnection> {
"Configured service connection timed out",
dependency.name = dependency_name,
dependency.endpoint = endpoint.as_str(),
timeout.ms = CONNECT_TIMEOUT.as_millis() as u64
timeout.ms = CONNECT_TIMEOUT
);
},
Ok(Err(err)) => {
Expand All @@ -606,7 +606,7 @@ impl Builder<WantsConnection> {
"Configured service connection still timing out",
dependency.name = dependency_name,
dependency.endpoint = endpoint.as_str(),
timeout.ms = CONNECT_TIMEOUT.as_millis() as u64
timeout.ms = CONNECT_TIMEOUT
);
},
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/src/server/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl RpcService {
err,
target: LOG_TARGET,
"connection failed while fetching genesis header, retrying",
retry.delay_ms = backoff.as_millis() as u64
retry.delay_ms = backoff
);
})
.await?;
Expand Down
8 changes: 4 additions & 4 deletions crates/store/src/state/writer/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ impl WriteWorker {
let snapshot_lag = generations
.oldest_pinned
.map_or(0, |oldest| block_num.as_u32() - oldest.as_u32());
let oldest_superseded_for_ms = generations
.oldest_superseded_for
.map_or(0, |superseded| u64::try_from(superseded.as_millis()).unwrap_or(u64::MAX));
// `unwrap_or_default` keeps the field present with a zero value when the oldest pinned
// generation is not superseded; a `None` value would omit the field from the span.
miden_span_record!(
snapshots.lag_blocks = snapshot_lag,
snapshots.oldest_superseded_for_ms = oldest_superseded_for_ms
snapshots.oldest_superseded_for_ms =
generations.oldest_superseded_for.unwrap_or_default()
);
let prune_tip = generations.prune_tip;
let resolved_note_ids = self
Expand Down
21 changes: 17 additions & 4 deletions crates/tracing/src/attribute.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::fmt::{self, Display, Formatter};
use std::path::{Path, PathBuf};
use std::time::Duration;

use miden_protocol::Word;
use miden_protocol::account::{AccountId, AccountIdPrefix, StorageMapKey, StorageSlotName};
Expand Down Expand Up @@ -73,18 +74,14 @@ const NUMBER_FIELD_NAMES: &[&str] = &[
"prover.proof_type.raw",
"reference_block.number",
"retry.attempt",
"retry.delay_ms",
"shutdown.grace_period_ms",
"snapshot.block_num",
"snapshots.lag_blocks",
"snapshots.live",
"snapshots.oldest_superseded_for_ms",
"subscription.idle_ms",
"subscription.stall_timeout_ms",
"sync.block_gap",
"sync.ready_threshold",
"sync.upstream_block",
"timeout.ms",
"tip.number",
"tip.stale_duration_secs",
"transaction.expiration_delta",
Expand Down Expand Up @@ -260,6 +257,22 @@ impl_scalar_attribute!(
);
impl_scalar_attribute!(NUMBER_FIELD_NAMES; u32);

/// Durations are recorded as whole milliseconds in a `u64`, saturating at `u64::MAX`.
///
/// Every allowed field name ends with `ms` so the recorded unit is visible on the query side.
impl RecordAttribute for Duration {
const FIELD_NAMES: &'static [&'static str] = &[
"retry.delay_ms",
"shutdown.grace_period_ms",
"snapshots.oldest_superseded_for_ms",
"timeout.ms",
];

fn record_attribute(&self) -> impl Value + '_ {
u64::try_from(self.as_millis()).unwrap_or(u64::MAX)
}
}

impl RecordAttribute for str {
const FIELD_NAMES: &'static [&'static str] = STRING_FIELD_NAMES;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ help: the trait `RecordAttribute` is not implemented for `UnapprovedAttribute`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: the following other types implement trait `RecordAttribute`:
&T
Duration
Option<T>
Path
PathBuf
String
Vec<T>
[T; N]
[T]
and $N others
note: required by a bound in `main::__miden_assert_field_name`
--> tests/ui/tracing_macros/invalid_event_attribute.rs:6:5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ help: the trait `RecordAttribute` is not implemented for `UnapprovedAttribute`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: the following other types implement trait `RecordAttribute`:
&T
Duration
Option<T>
Path
PathBuf
String
Vec<T>
[T; N]
[T]
and $N others
note: required by a bound in `records_unapproved_attribute::__miden_assert_field_name`
--> tests/ui/tracing_macros/invalid_instrument_attribute.rs:5:1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ help: the trait `RecordAttribute` is not implemented for `UnapprovedAttribute`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: the following other types implement trait `RecordAttribute`:
&T
Duration
Option<T>
Path
PathBuf
String
Vec<T>
[T; N]
[T]
and $N others
note: required by a bound in `miden_node_tracing::record_attribute`
--> src/attribute.rs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ help: the trait `RecordAttribute` is not implemented for `UnapprovedAttribute`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: the following other types implement trait `RecordAttribute`:
&T
Duration
Option<T>
Path
PathBuf
String
Vec<T>
[T; N]
[T]
and $N others
note: required by a bound in `__miden_assert_field_name`
--> tests/ui/tracing_macros/invalid_record_attribute.rs:7:5
Expand Down
2 changes: 1 addition & 1 deletion crates/utils/src/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//! warn!(
//! err,
//! "retrying",
//! retry.delay_ms = dur.as_millis() as u64
//! retry.delay_ms = dur
//! );
//! })
//! .await?;
Expand Down
2 changes: 1 addition & 1 deletion crates/utils/src/shutdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ where
anyhow::anyhow!("graceful shutdown timed out"),
"Graceful shutdown timed out; exiting process",
service.name = service_name,
shutdown.grace_period_ms = GRACE_PERIOD.as_millis() as u64
shutdown.grace_period_ms = GRACE_PERIOD
);
std::process::exit(1);
};
Expand Down
Loading