public MetricsStatsDStringOutputFormatter(
     MetricsStatsDOptions options,
     MetricFields metricFields)
 {
     _options     = options ?? throw new ArgumentNullException(nameof(options));
     MetricFields = metricFields ?? new MetricFields();
     _samplers    = new StatsDPointSampler(_options);
     _nullWriter  = new MetricSnapshotStatsDStringWriter(null, _samplers, _options);
     _serializer  = new MetricSnapshotSerializer();
 }
        /// <inheritdoc />
        public async Task WriteAsync(
            Stream output,
            MetricsDataValueSource metricsData,
            CancellationToken cancellationToken = default)
        {
            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            await using var writer = new MetricSnapshotStatsDStringWriter(output, _samplers, _options);
            _serializer.Serialize(writer, metricsData, MetricFields);
        }