public async Task WriteAllCommandsJsonToOutputStream(HttpResponseBase response) { var commands = commandFactory.GetAllHystrixCommands(); foreach (var commandMetric in commands) { // write command metrics string comandJsonString = await GetCommandJson(commandMetric).ConfigureAwait(false); string wrappedCommandJsonString = string.IsNullOrEmpty(comandJsonString) ? "ping: \n" : "data:" + comandJsonString + "\n\n"; await WriteStringToOutputStream(response, wrappedCommandJsonString).ConfigureAwait(false); // write thread pool metrics //string threadPoolJsonString = await GetThreadPoolJson(commandMetric).ConfigureAwait(false); //string wrappedThreadPoolJsonString = string.IsNullOrEmpty(threadPoolJsonString) ? "ping: \n" : "data:" + threadPoolJsonString + "\n\n"; //await WriteStringToOutputStream(response, wrappedThreadPoolJsonString).ConfigureAwait(false); } if (!commands.Any()) { await WriteStringToOutputStream(response, "ping: \n").ConfigureAwait(false); } }
public async Task WriteAllCommandsJsonToOutputStream(Stream outputStream, CancellationToken cancellationToken) { var commands = commandFactory.GetAllHystrixCommands(); foreach (var commandMetric in commands) { await WriteStringToOutputStream(outputStream, "data:", cancellationToken); WriteCommandJson(commandMetric, outputStream); await WriteStringToOutputStream(outputStream, "\n\n", cancellationToken); } if (!commands.Any()) { await WriteStringToOutputStream(outputStream, "ping: \n", cancellationToken).ConfigureAwait(false); } }