Ejemplo n.º 1
0
        public GrainProfilerFilter(IGrainProfiler profiler, ILogger <GrainProfilerFilter> logger, GrainMethodFormatterDelegate formatMethodName,
                                   Func <IIncomingGrainCallContext, string> oldFormatMethodName)
        {
            this.profiler = profiler;
            this.logger   = logger;

            if (oldFormatMethodName != NoopOldGrainMethodFormatter)
            {
                this.formatMethodName = new GrainMethodFormatterDelegate(oldFormatMethodName);
            }
            else
            {
                this.formatMethodName = formatMethodName ?? DefaultGrainMethodFormatter;
            }
        }
        public static async Task TrackAsync <T>(this IGrainProfiler profiler, Func <Task> handler, [CallerMemberName] string methodName = null)
        {
            var stopwatch = Stopwatch.StartNew();

            try
            {
                await handler();

                stopwatch.Stop();

                profiler.Track(stopwatch.Elapsed.TotalMilliseconds, typeof(T), methodName);
            }
            catch (Exception)
            {
                stopwatch.Stop();

                profiler.Track(stopwatch.Elapsed.TotalMilliseconds, typeof(T), methodName, true);
                throw;
            }
        }
Ejemplo n.º 3
0
 public GenericGrain(IGrainProfiler profiler)
 {
     this.profiler = profiler;
 }
Ejemplo n.º 4
0
 public GrainProfilerFilter(IGrainProfiler profiler, ILogger <GrainProfilerFilter> logger, GrainMethodFormatterDelegate formatMethodName)
 {
     this.profiler         = profiler;
     this.logger           = logger;
     this.formatMethodName = formatMethodName ?? DefaultGrainMethodFormatter;
 }
 public static void Track <T>(this IGrainProfiler profiler, double elapsedMs, [CallerMemberName] string methodName = null, bool failed = false)
 {
     profiler.Track(elapsedMs, typeof(T), methodName, failed);
 }