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

Support `Transaction#set_measurement`

Open st0012 opened this issue 3 years ago • 7 comments

This PR adds the concept of custom measurement to Transaction and a new Transaction#set_measurement API. It should be the Ruby equivalent of https://github.com/getsentry/sentry-python/pull/1359.

Changes

  • Add Sentry::Configuration#experiments for containing experimental features' configs.
  • Add cofnig.experiments.custom_measurements for toggling custom measurement's activation (default: inactive).
  • Add Transaction#measurements and Transaction#set_measurement(name, value, unit = "").

st0012 avatar Jul 02 '22 14:07 st0012

Codecov Report

Base: 98.63% // Head: 98.62% // Decreases project coverage by -0.01% :warning:

Coverage data is based on head (7b5e21b) compared to base (193446b). Patch coverage: 100.00% of modified lines in pull request are covered.

:exclamation: Current head 7b5e21b differs from pull request most recent head bbce93f. Consider uploading reports for the commit bbce93f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1838      +/-   ##
==========================================
- Coverage   98.63%   98.62%   -0.01%     
==========================================
  Files         157      157              
  Lines       10009    10059      +50     
==========================================
+ Hits         9872     9921      +49     
- Misses        137      138       +1     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/configuration.rb 98.51% <100.00%> (+<0.01%) :arrow_up:
sentry-ruby/lib/sentry/event.rb 98.78% <100.00%> (+0.01%) :arrow_up:
sentry-ruby/lib/sentry/transaction.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transaction_event.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/configuration_spec.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/transaction_spec.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/breadcrumb.rb 96.29% <0.00%> (-3.71%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Jul 02 '22 14:07 codecov-commenter

@st0012 The UI is still WIP. So far only JS and python SDKs have this API, and ingest is partially ready. UI work will follow in the coming month.

sl0thentr0py avatar Jul 02 '22 15:07 sl0thentr0py

@sl0thentr0py I feel it'll be more useful to have something like

transaction.measure("metrics.foo", "millisecond") do
  # operation
end

# and also

Sentry.measure_with_transaction("metrics.foo", "millisecond", transaction: optional_transaction) do
  # operation
end

And then the measurement can be set without manually retrieving the transaction.

st0012 avatar Jul 10 '22 11:07 st0012

ping @sl0thentr0py

st0012 avatar Jul 12 '22 21:07 st0012

@st0012 I'll take a look at this tomorrow, but just wanted to say we shouldn't actually ship this till measurements are ready end-end in the product. We added the python/JS stuff to get started internally for development.

sl0thentr0py avatar Jul 12 '22 21:07 sl0thentr0py

Ah I see. In that case, no need to rush it then 👍

st0012 avatar Jul 12 '22 21:07 st0012

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Aug 04 '22 00:08 github-actions[bot]

@st0012 will review this shortly, but if we wanna include this now, I think we don't need this to be experimental anymore.

Re: the top-level API helpers like Sentry.measure_with_transaction, we have to decide internally on naming/behavior but we can ship those separately afterwards.

sl0thentr0py avatar Sep 30 '22 13:09 sl0thentr0py

If the name is still not settled, I'm fine with merging it later. I was justing seeing if things can be shipped together, not that I wanted to push this 🙂

st0012 avatar Sep 30 '22 17:09 st0012

alright, yea let's leave this for the next minor then, the UI is still WIP so it's fine to push this a bit later.

sl0thentr0py avatar Oct 03 '22 11:10 sl0thentr0py

ok UI landed now https://github.com/getsentry/sentry/pull/39543

sl0thentr0py avatar Oct 03 '22 19:10 sl0thentr0py

any updates on this? Our team would appreciate this functionality a lot

ymatusevich avatar Jan 23 '23 18:01 ymatusevich

@sl0thentr0py So once I rebased this PR, it'll be ok to merge it?

st0012 avatar Feb 01 '23 10:02 st0012

yes I was planning to merge this this week, go ahead!

sl0thentr0py avatar Feb 01 '23 10:02 sl0thentr0py