private const int OneMinuteMilliseconds = 60000; //One minute is the minimum time between StackDriver metrics.
#endif

        public PerfMonReporter(IList<CounterConfig> counters, string instanceId, string stackDriverApiKey,
            ICounterConfigReader configReader)
            : this(counters, instanceId, stackDriverApiKey, true)
        {
            ConfigReader = configReader;
            if (ConfigReader != null)
            {
                ConfigReader.ConfigUpdated += OnConfigurationUpdated;
                ConfigReader.TriggerUpdate();
            }

            GetMetrics();
        }
Beispiel #2
0
        private const int OneMinuteMilliseconds = 60000; //One minute is the minimum time between StackDriver metrics.
#endif

        public PerfMonReporter(IList <CounterConfig> counters, string instanceId, string stackDriverApiKey,
                               ICounterConfigReader configReader)
            : this(counters, instanceId, stackDriverApiKey, true)
        {
            ConfigReader = configReader;
            if (ConfigReader != null)
            {
                ConfigReader.ConfigUpdated += OnConfigurationUpdated;
                ConfigReader.TriggerUpdate();
            }

            GetMetrics();
        }
        /// <summary>
        /// Given the name of a config reader, news up an instance of the appropriate type.
        /// </summary>
        /// <param name="configReaderType">The name of the config reader to instantiate.</param>
        /// <returns>ICounterConfigReader object of the appropriate type,.  Null if no match is found.</returns>
        public static ICounterConfigReader CreateConfigReader(string configReaderType)
        {
            ICounterConfigReader reader = null;

            switch (configReaderType.ToLower())
            {
            case "perfmon":
                reader = new PerfmonCounterConfigReader();
                break;

            case "mbean":
                reader = new MBeanCounterConfigReader();
                break;

            default:
                Log.Error(String.Format("Invalid counter type '{0}' encountered in configuration.", configReaderType));
                break;
            }

            return(reader);
        }