public void Run(IConfigurationRoot configuration)
        {
            var sink = ChooseSink();

            var metricsWriterSettings    = configuration.GetSection("MetricsWriter").Get <MetricsWriterSettings>();
            var metricsCollectorSettings = configuration.GetSection("MetricsCollector").Get <MetricsCollectorSettings>();

            if (sink is IDatabasePlugin databasePlugin)
            {
                var databaseConnectionSettings = configuration.GetSection("Database:Connection").Get <DatabaseConnectionSettings>();
                var databaseTablesSettings     = configuration.GetSection("Database:Tables").Get <DatabaseTablesSettings>();
                databasePlugin.Initialize(databaseConnectionSettings, databaseTablesSettings, metricsWriterSettings);
            }

            using (var metrics = new MetricsCollector(sink, metricsCollectorSettings))
            {
                Console.WriteLine("Press some keys; enter to exit");

                metrics.RegisterThresholds("latency", new int[] { 0, 50, 75, 100, 1000, 2000, 10000 });
                var stopwatch = new Stopwatch();

                char key;
                do
                {
                    stopwatch.Start();
                    key = Console.ReadKey(true).KeyChar;
                    stopwatch.Stop();

                    metrics.IncrementCounter(key.ToString());
                    metrics.IncrementBucket("latency", stopwatch.ElapsedMilliseconds);
                    metrics.Event(key.ToString());

                    // letters a-z: lowercase is start of interval, uppercase is end.
                    if (key >= 'a' && key <= 'z')
                    {
                        metrics.StartInterval("session", key.ToString());
                    }
                    else if (key >= 'A' && key <= 'Z')
                    {
                        metrics.EndInterval("session", key.ToString().ToLower());
                    }

                    stopwatch.Reset();
                } while (key != '\r' && key != '\n');
            }

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }