Example #1
0
        public static void ReportSingle <TKey>(TKey count, RedisDiagnosticActivityType activityType)
        {
            var payload = new
            {
                count
            };

            if (_source.IsEnabled(activityType.GetActivity(), payload))
            {
                _source.Write(activityType.GetActivity(), payload);
            }
        }
Example #2
0
        public static void StopSingle(
            Activity activity,
            RedisDiagnosticActivityType activityType)
        {
            if (activity != null)
            {
                var payload = new
                {
                    activity
                };

                if (_source.IsEnabled(activityType.GetActivity(), payload))
                {
                    _source.StopActivity(activity, payload);
                }
            }
        }
Example #3
0
        public static Activity StartSingle(int key, RedisDiagnosticActivityType activityType)
        {
            var payload = new
            {
                count = key
            };

            if (_source.IsEnabled(activityType.GetActivity(), payload))
            {
                var activity = new Activity(activityType.GetActivity());


                _source.StartActivity(activity, payload);

                return(activity);
            }

            return(null);
        }
Example #4
0
        public static Activity StartSingle(string key, RedisDiagnosticActivityType activityType)
        {
            var payload = new
            {
                key,
                count = 1
            };

            if (_source.IsEnabled(activityType.GetActivity(), payload))
            {
                var activity = new Activity(activityType.GetActivity());

                activity.AddTag("redisKey", key);

                _source.StartActivity(activity, payload);

                return(activity);
            }

            return(null);
        }
Example #5
0
        private static string GetActivity(this RedisDiagnosticActivityType type)
        {
            switch (type)
            {
            case RedisDiagnosticActivityType.Get:
                return(_get);

            case RedisDiagnosticActivityType.Set:
                return(_set);

            case RedisDiagnosticActivityType.Delete:
                return(_delete);

            case RedisDiagnosticActivityType.Hits:
                return(_hits);

            case RedisDiagnosticActivityType.Misses:
                return(_misses);

            default:
                return(_get);
            }
        }