Description
Background and Motivation
Further to issues #1716, and #1767, dotnet-counters monitor
has no protection against a large number of counters. Fixing #1716, and implementing #1767, will mitigate two of the bigger issues, but there are numerous scenarios where the number of counters being monitored is excessive and could cause serious issues. There is no limit to how many counters might end up being subscribed to on a call.
Proposed Feature
Add a maxcounters
property to dotnet-counters monitor
that will truncate the displayed counters when a maximum is reached, instead, showing a message on the bottom line similar to x counters not shown as maxcounters has been exceeded.
By default maxcounters
would be set to a figure determined by the height of the current console (minus any information lines, etc.), where it can be determined, or a value such as 100
otherwise. A value of 0
would indicate no limit (current behaviour).
Usage Examples
In most use cases the default value would provide the desired behaviour of only showing the counters that can logically fit on the current console. The most common explicit case would be to restore current behaviour, and remove the limit, e.g.:
dotnet-counters monitor -n MyApp --maxcounters 0 --providers System.Runtime LargeCounterNamespace