public void CollectTo(IMetricsWriter writer) { var wrapped = new MetricWriterWrapper(writer); foreach (var collector in _enumerableCollectors.Value) { wrapped.SetCurrentCollector(collector); collector.Collect(wrapped); } }
public async Task CollectToAsync(IMetricsWriter writer) { var wrapped = new MetricWriterWrapper(writer); foreach (var collector in _enumerableCollectors.Value) { wrapped.SetCurrentCollector(collector); collector.Collect(wrapped); await writer.FlushAsync().ConfigureAwait(false); } }