public async Task StartListening() { if (_isRunning) { return; } _isRunning = true; while (!_hostApplicationLifetime.ApplicationStopping.IsCancellationRequested) { if (DumpKeyPressed()) { IEnumerable <StatisticFeedDefinition> feeds = _statisticFeedsCollector.GetRegisteredFeedsDefinitions(); Console.Clear(); foreach (var feed in feeds) { var feedResult = _statisticFeedsCollector.GetFeedDump(feed.FeedId, true); if (feedResult is TabularStatisticFeedResult tabularResult) { Console.WriteLine(tabularResult.Content); } } } await Task.Delay(500, _hostApplicationLifetime.ApplicationStopping).ConfigureAwait(false); } }
public IActionResult GetFeedStats(string feedId, bool humanReadable) { try { return(_statisticFeedsCollector.GetFeedDump(feedId, humanReadable) switch { RawStatisticFeedResult result => Ok(result), TabularStatisticFeedResult result => Content(result.Content, "text/plain"), IStatisticFeedResult result => Ok(result), _ => NotFound() }); }