sentry-ruby icon indicating copy to clipboard operation
sentry-ruby copied to clipboard

Support profiling for queues

Open sl0thentr0py opened this issue 1 year ago • 2 comments

Add and test support for profiling transactions from sidekiq/delayed_job/resque, some customers have already shown interest.

sl0thentr0py avatar May 17 '23 15:05 sl0thentr0py

I'm looking into the code for this. Aside from the threading issues (that I don't have enough depth for just yet), it looks like:

  • Transaction has a Profiler attached.
  • On Sentry.start_transaction, the hub will call transaction.start_profiler!, which will, with random luck, do exactly that, as long as this transaction is sampled, and profiling rate allows.
  • It looks like anything that already uses transactions will potentially be able to make profiles. Looking as sentry_context_middleware.rb for sidekiq, it seems like it should work?

I have not yet tried it out myself, but that's the next thing I'm looking at. I expect that if I set my profile rate high enough and spam background jobs in an example app, I should see messed up profiles, all dumped into the single thead_id: 0.

If that's the case, I guess we should focus on trying Vernier first?

natikgadzhi avatar Nov 24 '23 05:11 natikgadzhi

this is on hold for now, because the server will actually throw away profiles longer than 30s. Longer profiles need a bunch of server support for 'streaming profiles' because otherwise the payloads get too large and are not practical.

sl0thentr0py avatar Nov 24 '23 13:11 sl0thentr0py