Esempio n. 1
0
        public void Configure()
        {
            var config = ConfigurationManager.GetSection("ReadStatsd") as ReadStatsdPluginConfig;

            if (config == null)
            {
                throw new Exception("Cannot get configuration section : ReadStatsd");
            }

            _port = config.Port;

            _delCounters = config.DeleteCache.Counters;
            _delTimers   = config.DeleteCache.Timers;
            _delGauges   = config.DeleteCache.Gauges;
            _delSets     = config.DeleteCache.Sets;

            _timerLower  = config.Timer.Lower;
            _timerUpper  = config.Timer.Upper;
            _timerSum    = config.Timer.Sum;
            _timerCount  = config.Timer.Count;
            _percentiles =
                (from ReadStatsdPluginConfig.PercentileConfig percentileConfig in
                 config.Timer.Percentiles
                 select percentileConfig.Value).ToArray();

            _statsdAggregator = new StatsdAggregator(_delCounters, _delTimers, _delGauges, _delSets, _timerLower,
                                                     _timerUpper,
                                                     _timerSum, _timerCount, _percentiles);
            Logger.Info("ReadStatsd plugin configured");
        }
Esempio n. 2
0
        public void Configure()
        {
            var config = ConfigurationManager.GetSection("Statsd") as StatsdPluginConfig;
            if (config == null)
            {
                throw new Exception("Cannot get configuration section : Statsd");
            }

            _port = config.Server.Port;

            _delCounters = config.DeleteCache.Counters;
            _delTimers = config.DeleteCache.Timers;
            _delGauges = config.DeleteCache.Gauges;
            _delSets = config.DeleteCache.Sets;

            _timerLower = config.Timer.Lower;
            _timerUpper = config.Timer.Upper;
            _timerSum = config.Timer.Sum;
            _timerCount = config.Timer.Count;
            _percentiles =
                (from StatsdPluginConfig.PercentileConfig percentileConfig in
                    config.Timer.Percentiles
                    select percentileConfig.Value).ToArray();

            _statsdAggregator = new StatsdAggregator(_delCounters, _delTimers, _delGauges, _delSets, _timerLower,
                _timerUpper,
                _timerSum, _timerCount, _percentiles);
            Logger.Info("Statsd plugin configured");
        }