Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix direct record methods on instrument to call unbind. #836

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ private DoubleCounterSdk(

@Override
public void add(double delta, LabelSet labelSet) {
bind(labelSet).add(delta);
BoundDoubleCounter boundDoubleCounter = bind(labelSet);
boundDoubleCounter.add(delta);
boundDoubleCounter.unbind();
Copy link
Contributor

Choose a reason for hiding this comment

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

Just thinking out loud...what would you think about having add return this so you could just write:

bind(labelSet).add(delta).unbind();

in one fluent call?

Copy link
Member Author

@bogdandrutu bogdandrutu Feb 7, 2020

Choose a reason for hiding this comment

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

I thought about this, but it is not that useful for users using bounds, but probably doesn't hurt. Happy to accept a followup PR to see how would look like:)

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I agree. The bytecode probably ends up looking identical.

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ private DoubleMeasureSdk(

@Override
public void record(double value, LabelSet labelSet) {
bind(labelSet).record(value);
BoundDoubleMeasure boundDoubleMeasure = bind(labelSet);
boundDoubleMeasure.record(value);
boundDoubleMeasure.unbind();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ private LongCounterSdk(

@Override
public void add(long delta, LabelSet labelSet) {
bind(labelSet).add(delta);
BoundLongCounter boundLongCounter = bind(labelSet);
boundLongCounter.add(delta);
boundLongCounter.unbind();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ private LongMeasureSdk(

@Override
public void record(long value, LabelSet labelSet) {
bind(labelSet).record(value);
BoundLongMeasure boundLongMeasure = bind(labelSet);
boundLongMeasure.record(value);
boundLongMeasure.unbind();
}

@Override
Expand Down