Skip to content
Merged
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
17 changes: 17 additions & 0 deletions src/Wolverine/Tracking/TrackedSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ public void AssertNotTimedOut()
}
}

/// <summary>
/// Cap the diagnostic envelope-record grid at this many rows when reporting a timeout.
/// A noisy test (e.g. a chaos-monkey'd integration scenario emitting thousands of
/// alert / heartbeat / DLQ envelopes during the tracked window) can otherwise OOM
/// the StringBuilder.ToString() inside Grid.Write before the timeout message is
/// ever surfaced to the test — the OOM masks the real timeout cause.
/// Truncate to the last <see cref="ActivityGridRowLimit"/> records (most recent
/// = most useful for diagnosing where things hung), and surface the omitted count.
/// </summary>
internal const int ActivityGridRowLimit = 500;

internal string BuildActivityMessage(string description)
{
var writer = new StringWriter();
Expand All @@ -318,6 +329,12 @@ internal string BuildActivityMessage(string description)
}
else
{
if (records.Length > ActivityGridRowLimit)
{
var skipped = records.Length - ActivityGridRowLimit;
writer.WriteLine($"(showing last {ActivityGridRowLimit} of {records.Length} envelope records — earlier {skipped} omitted for readability)");
records = records[^ActivityGridRowLimit..];
}
writeGrid(grid, records, writer);
}

Expand Down
Loading