Skip to content

Commit

Permalink
Special case time 0 display in trace times
Browse files Browse the repository at this point in the history
Fixes #4107
  • Loading branch information
davidebbo committed May 15, 2024
1 parent 756dfe6 commit 2ae78ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Aspire.Dashboard/Otlp/Model/DurationFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public static string FormatDuration(TimeSpan duration)
var ofPrevious = primaryUnit.Ticks / secondaryUnit.Ticks;
var ticks = (double)duration.Ticks;

// Special case time 0 to not display any unit, as "0μs" looks quirky
if (ticks == 0)
{
return "0";
}

if (primaryUnit.IsDecimal)
{
// If the unit is decimal based, display as a decimal
Expand Down

0 comments on commit 2ae78ce

Please sign in to comment.