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; } }
public GenericGrain(IGrainProfiler profiler) { this.profiler = profiler; }
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); }