private bool disposedValue = false; // To detect redundant calls

        private void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    MetricsWriter?.Dispose();
                }

                disposedValue = true;
            }
        }
 internal MetricsCollector(string prefix, MetricsWriter writer)
 {
     this.Prefix = prefix;
     this.Writer = writer;
 }