Shopify / Shopify/app_profiler

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

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
Ruby
Stars
268
Forks
14
Avg merge
1h 9m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/app_profiler/middleware.rb at the linked action call and lib/app_profiler/profiler.rb where profiling results are retrieved. Trace how the samples value reaches the middleware, then verify that profiles with zero samples produce no middleware action or upload.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
performance
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.