getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
935 stars 494 forks source link

Sort endpoints by allocations #1831

Open vitobotta opened 2 years ago

vitobotta commented 2 years ago

Describe the idea

I would like to be able to sort traces for web requests by allocations.

Why do you think it's beneficial to most of the users

It can help investigate issues with memory usage.

Context: I am trying to find out the cause of some memory issues (not sure if bloat or proper leak yet), and It would be useful to see information about allocations and memory usage in general.

Thanks!

st0012 commented 2 years ago

I think this feature has 2 parts:

sl0thentr0py commented 2 years ago

hi @vitobotta @st0012 this is actually on our roadmap and we're building 'Custom Measurements/Metrics' support into Sentry. Once this is ready, you'll be able to add arbitrary measurements onto a transaction and then use them in Discover/Performance dashboards. (Don't have an ETA though for when all sides of the product will be ready, sorry!)

We will also build common use cases such as this one into the SDK. We've had trouble identifying good use cases for server side SDKs so this is a great suggestion, thank you!

Some more info for @st0012 , from the SDK side, there will be a new transaction.set_measurement(name, unit, value) API (python reference implementation).

vitobotta commented 2 years ago

Hi! Thanks for letting me know Glad it's on the roadmap! Looking forward to it.

st0012 commented 2 years ago

@sl0thentr0py From the SDK doc I can see that there are also standard measurements like:

"fp",
"fcp",
"lcp",
"fid",
"cls",
"ttfb",
"ttfb.requesttime",

Which I think we haven't supported yet? Should we also do that?

Update: nvm, I think they're only for web vitals

frederikspang commented 2 months ago

@sl0thentr0py Went back to ensure I didn't do a duplicated issue regarding tracking allocations.

However, the "easy" way of introducing this, is with activesupport::Notifications for controller notifications. But the current implementation (non-deprecated) is using the around_action approach. In which case, we could just pull the measurements ourselves - Using the same implementation as https://github.com/rails/rails/pull/33449.

I can prepare a PR for this, if wanted, and use the transaction#set_measurement method

sl0thentr0py commented 2 months ago

hey @frederikspang we're actually doing a bit of a product side overhaul of our metrics/measurements stuff so I'd wait a bit on this before adding it. We will likely be changing our span based measurement APIs again.

frederikspang commented 2 months ago

hey @frederikspang we're actually doing a bit of a product side overhaul of our metrics/measurements stuff so I'd wait a bit on this before adding it. We will likely be changing our span based measurement APIs again.

No problem! We'll do a patch internally, and I can adjust for upstream when the new API's are available!