app_profiler icon indicating copy to clipboard operation
app_profiler copied to clipboard

Middleware's action should not be called if there are no samples in the profile

Open imjching-shopify opened this issue 5 years ago • 0 comments

We should avoid calling the middleware's action (e.g. UploadAction) if there are no samples in the profile.

https://github.com/Shopify/app_profiler/blob/80df44c69c8bd7dedb1c250c1ecec422ffa4f838/lib/app_profiler/middleware.rb#L41-L45

When a request returns quickly during a profiling session, there is a possibility in which the profiler could not sample anything in time. There won't be any samples for those profiles, and speedscope won't recognize them either. We should drop such profiles.

One way to do so would be to return nil if the value for samples is 0 whenever profiling results are retrieved: https://github.com/Shopify/app_profiler/blob/80df44c69c8bd7dedb1c250c1ecec422ffa4f838/lib/app_profiler/profiler.rb#L30

imjching-shopify avatar Mar 25 '20 23:03 imjching-shopify