public RedisProfilingSession(string session, IRedisProfilingMetrics metrics, IRedisProfiler redisProfiler)
        {
            if (string.IsNullOrWhiteSpace(session))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(session));
            }

            _session       = session;
            _metrics       = metrics ?? throw new ArgumentNullException(nameof(metrics));
            _redisProfiler = redisProfiler ?? throw new ArgumentNullException(nameof(redisProfiler));

            try
            {
                _profilingSession = redisProfiler.StartSession();
            }
            catch (Exception e)
            {
                // todo: to log exception
                _profilingSession = null;
            }
        }
예제 #2
0
 public AsyncLocalRedisProfiler(IRedisProfilingMetrics metrics)
 {
     _metrics = metrics ?? throw new ArgumentNullException(nameof(metrics));
 }