Skip to content

Collect measure and distribution metrics even on return or exception#134

Merged
Bringer128 merged 1 commit intomasterfrom
always-track-duration
Jan 10, 2019
Merged

Collect measure and distribution metrics even on return or exception#134
Bringer128 merged 1 commit intomasterfrom
always-track-duration

Conversation

@Bringer128
Copy link
Contributor

Duplicate of #111 (except no conflicts) and fixes #133

This is a fix for when doing a return inside a StatsD.measure or StatsD.distribution call, where the metrics would not be collected.

Note that as discussed in #111 if exceptions happen you will likely get a different distribution of performance. At the very least we should consider documenting this behaviour.

Keen to get this merged as I lost a day to this problem (existing code using a return, and I added a block to measure performance).

@Bringer128 Bringer128 requested review from masom and pallan July 31, 2018 19:38
@pallan
Copy link

pallan commented Aug 7, 2018

cc @tjoyal @wvanbergen

Copy link
Member

@tjoyal tjoyal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am good with small steps as this feels like a good direction (not dropping events in the first place). Discussing how to possibly "flag" exit scenarios can be discussed elsewhere.

@Bringer128 Bringer128 force-pushed the always-track-duration branch from cc06939 to 00a399c Compare January 9, 2019 20:46
@Bringer128
Copy link
Contributor Author

I'll try get some time to look into those tests tomorrow

@Bringer128
Copy link
Contributor Author

If I can get a 👍 from @tjoyal I think we can merge this?

Copy link
Member

@tjoyal tjoyal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this and it fixes part of the problem. Since it can be ship in isolation I think it should.

My worry is that now "what was discarded will now be recorded" which is to some extent the desire. From then on the "exceptions" data will be folded into the current data and this could lead to some inconsistencies in dashes (eg.: tracking timing out http call exception could greatly increase the average call time for events).

I'm not saying to not ship this, but it need to be documented so when the gem get bumped people are aware (This could trip pagers).

On that note, I think we should rapidly come up with a way to distinguish "success vs failures" so that dashes can have a more rich representation?

We need to go though this harsh migration if we want to have a better future. Thanks for owning the gem!

@Bringer128
Copy link
Contributor Author

I'm not saying to not ship this, but it need to be documented so when the gem get bumped people are aware (This could trip pagers).

If this is a more significant change should we modify the minor or even major version? While it's not a breaking change at the code level (re: semver) it is potentially a breaking behaviour change that people should be aware of when they upgrade.

@tjoyal
Copy link
Member

tjoyal commented Jan 10, 2019

If this is a more significant change should we modify the minor or even major version?

I don't really have a strong opinion on this, I'm happy with a log entry and a version change.

I'm a big fan of simple, ship fast and iterate. This changeset might be a problem for some, but for others it might surface some unknown problem. I'd say let's keep the train going and simply ship & iterate.

In the end, you should always be reading at least the changelog when updating a gem. Weither it's a minor or major version number change, since we do not manage multiple version in parallel, you can only pick 2 choices: upgrade or not.

Change in the end always risk breaking someone experience, as long that we make it better for most I think we should keep going and rectify on feedback if there is any.

@Bringer128
Copy link
Contributor Author

👍 Can you review my changelog? I wanted to give a quick warning in there related to our discussions

@Bringer128 Bringer128 force-pushed the always-track-duration branch from 0277300 to c5ed201 Compare January 10, 2019 16:22
@Bringer128 Bringer128 merged commit f1a96b4 into master Jan 10, 2019
@wvanbergen wvanbergen temporarily deployed to rubygems September 6, 2019 10:51 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using return or raising exception causes metric collection to be skipped in distribution/measure

4 participants