Skip to content

Expand the usage of friendly durations#4887

Open
AhmedSoliman wants to merge 1 commit into
mainfrom
pr4887
Open

Expand the usage of friendly durations#4887
AhmedSoliman wants to merge 1 commit into
mainfrom
pr4887

Conversation

@AhmedSoliman
Copy link
Copy Markdown
Member

@AhmedSoliman AhmedSoliman commented Jun 4, 2026

Also limits the minimum units depending on the timespan used. This reduces verbosity as in pretty much all cases we don't care about nanos or micros in log messages.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Test Results

  8 files  ±0    8 suites  ±0   4m 46s ⏱️ +9s
 60 tests ±0   60 ✅ ±0  0 💤 ±0  0 ❌ ±0 
267 runs  ±0  267 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 8260794. ± Comparison against base commit 6b47208.

♻️ This comment has been updated with latest results.

@AhmedSoliman AhmedSoliman force-pushed the pr4887 branch 2 times, most recently from ae9323e to e31f103 Compare June 4, 2026 13:53
@AhmedSoliman AhmedSoliman marked this pull request as ready for review June 4, 2026 13:54
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e31f103479

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread util/time/src/duration.rs Outdated
.round(
SpanRound::new()
.largest(jiff::Unit::Second)
.largest(jiff::Unit::Microsecond)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use smallest() when capping seconds precision

This second call to largest() overwrites the earlier largest(Unit::Second) setting rather than setting the minimum precision, so to_seconds_span() rebalances durations into microseconds instead of seconds. The repo uses latency.friendly().to_seconds_span() for HTTP tracing in crates/admin/src/service.rs and crates/ingress-http/src/server.rs, so latencies over one second will be emitted as large microsecond values instead of the intended seconds-based span; use smallest(Unit::Microsecond) here if the goal is only to suppress nanoseconds.

Useful? React with 👍 / 👎.

Comment thread util/time/src/duration.rs
.round(
SpanRound::new()
.largest(jiff::Unit::Day)
.smallest(jiff::Unit::Millisecond)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid rounding serialized durations to zero

Rounding the default days span to milliseconds also affects the human-readable serde paths (SerializeAs and Serialize both collect source.friendly().to_days_span() in this file), not just log messages. Any configured nonzero duration below 500µs now serializes as a zero millisecond span, so a human-readable round-trip can lose the value or deserialize to zero for a NonZeroFriendlyDuration; keep the lossy millisecond rounding out of the default/serde display path or make it opt-in for logs only.

Useful? React with 👍 / 👎.

Also limits the minimum units depending on the timespan used. This reduces verbosity as in pretty much all cases we don't care about nanos or micros in log messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant