/// <summary>
 /// Factory (create instance).
 /// The factory is here for backward compatibility, newer component should use IoC (Dependency Injection)
 /// </summary>
 /// <param name="activationFactory">The activation factory.</param>
 /// <param name="simpleConfig">The simple configuration.</param>
 /// <param name="tagContext">The tag context.</param>
 /// <returns></returns>
 private static IMetricsReporterBuilder Create(
     ITelemetryActivationFactory activationFactory,
     ISimpleConfig simpleConfig,
     ITelemetryTagContext tagContext)
 {
     return(new MetricsReporterBuilder(activationFactory, simpleConfig, tagContext));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MetricsReporterBuilder"/> class.
        /// </summary>
        /// <param name="activationFactory">The activation factory.</param>
        /// <param name="simpleConfig">The simple configuration.</param>
        /// <param name="tagContext">The tag context.</param>
        public MetricsReporterBuilder(
            ITelemetryActivationFactory activationFactory,
            ISimpleConfig simpleConfig,
            ITelemetryTagContext tagContext)
        {
            // TODO: move it into Influx provider (InfluxMetricFactory)
            string url     = simpleConfig["influx-url"];
            string db      = simpleConfig["influx-database"];
            string version = simpleConfig["influx-report-version"];

            _activation          = activationFactory.Create();
            _influxConfiguration = new CollectorConfiguration()
                                   .Tag.With("version", version)
                                   .Tag.With("host", Environment.MachineName)
                                   .Tag.With("user", Environment.UserName)
                                   .Batch.AtInterval(TimeSpan.FromSeconds(5))
                                   .WriteTo.InfluxDB(url, database: db);
            _tagContext = tagContext;
        }