public static SyntheticCountersReporter createDefaultReporter(Logger _log, ICounterSamplingConfiguration counterSamplingConfig)
        {
            string signalFxCategory = "SignalFX";

            try
            {
                System.Diagnostics.CounterCreationDataCollection CounterDatas =
                   new System.Diagnostics.CounterCreationDataCollection();

                createCounterIfNotExist(signalFxCategory, "UsedMemory", "Total used memory", System.Diagnostics.PerformanceCounterType.NumberOfItems64, CounterDatas);

                if (CounterDatas.Count != 0)
                {
                    System.Diagnostics.PerformanceCounterCategory.Create(
                        signalFxCategory, "SignalFx synthetic counters.",
                        System.Diagnostics.PerformanceCounterCategoryType.SingleInstance, CounterDatas);
                }
            }
            catch (Exception e)
            {
                _log.Info(e.ToString());
                return null;
            }

            SyntheticCountersReporter reporter = new SyntheticCountersReporter(counterSamplingConfig);
            reporter._sfxCountersUpdateMethods.Add("UsedMemory", updateUsedMemoryCounter);
            return reporter;
        }
        public static SyntheticCountersReporter createDefaultReporter(Logger _log, ICounterSamplingConfiguration counterSamplingConfig)
        {
            string signalFxCategory = "SignalFX";

            try
            {
                System.Diagnostics.CounterCreationDataCollection CounterDatas =
                    new System.Diagnostics.CounterCreationDataCollection();

                createCounterIfNotExist(signalFxCategory, "UsedMemory", "Total used memory", System.Diagnostics.PerformanceCounterType.NumberOfItems64, CounterDatas);

                if (CounterDatas.Count != 0)
                {
                    System.Diagnostics.PerformanceCounterCategory.Create(
                        signalFxCategory, "SignalFx synthetic counters.",
                        System.Diagnostics.PerformanceCounterCategoryType.SingleInstance, CounterDatas);
                }
            }
            catch (Exception e)
            {
                _log.Info(e.ToString());
                return(null);
            }

            SyntheticCountersReporter reporter = new SyntheticCountersReporter(counterSamplingConfig);

            reporter._sfxCountersUpdateMethods.Add("UsedMemory", updateUsedMemoryCounter);
            return(reporter);
        }
        protected override void OnStart(string[] args)
        {
            _log.Info("Reading signalFx reporter config");
            Tuple <MetricsReport, TimeSpan> reporter = SignalFxReporterBuilder.FromAppConfig();
            SyntheticCountersReporter       synCR    = SyntheticCountersReporter.createDefaultReporter(_log, CounterSamplingConfiguration.FromConfig());

            _pcr = new PerfCounterReporter(reporter.Item1, reporter.Item2, CounterSamplingConfiguration.FromConfig());
            if (synCR != null)
            {
                _pcr._couunterReporters.Add(synCR);
            }

            _log.Info("Done reading config");
        }