예제 #1
0
 public BufferedMetricsClientBase(SharedMetricsClientOptions options)
 {
     _options = options;
     _logger  = options.LoggerFactory?.CreateLogger(GetType()) ?? NullLogger.Instance;
     if (options.Buffered)
     {
         _flushTimer = new Timer(OnMetricsTimer, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2));
     }
 }
        public CacheBucketMetricsClientBase(ICacheClient cache, SharedMetricsClientOptions options) : base(options)
        {
            _cache  = cache;
            _prefix = !String.IsNullOrEmpty(options.Prefix) ? (!options.Prefix.EndsWith(":") ? options.Prefix + ":" : options.Prefix) : String.Empty;

            _timeBuckets.Clear();
            _timeBuckets.Add(new TimeBucket {
                Size = TimeSpan.FromMinutes(5), Ttl = TimeSpan.FromHours(1)
            });
            _timeBuckets.Add(new TimeBucket {
                Size = TimeSpan.FromHours(1), Ttl = TimeSpan.FromDays(7)
            });
        }