openzipkin-contrib / brave-opentracing

Bridge between OpenTracing and Brave
http://opentracing.io
Apache License 2.0
64 stars 39 forks source link

Defensive check against abnormal BraveScope.close() #78

Closed tutufool closed 6 years ago

tutufool commented 6 years ago

Enhancement on abnormal scope close.

[edit by devinsba] Fixes https://github.com/openzipkin-contrib/brave-opentracing/issues/76

devinsba commented 6 years ago

@tutufool in the future can you please title your PRs with what they are accomplishing, then reference the related issue in the body of the pull request

Some of us follow this repo at a distance so a url for an issue title doesn't mean much in your email inbox

tutufool commented 6 years ago

@devinsba Sorry about that, the actuall title should be something like: defensive check against abnormal BraveScope.close()

This PR is trageting for scenarios that user does not follow try-with-resource pattern when using scope.

For example:

  1. scope opened in threadA and closed into threadB

  2. Parent scope closed before child scope, like:

BraveScope scopeA = ...

BraveScope scopeB = ...

scopeA.close()

scopeB.close()

codefromthecrypt commented 6 years ago

PS there are some things shifting around in the OT java repo which might make some of this less necessary. Also, there's a chance we can externalize the scoping guards a little with ScopeDecorator which is recently in brave.

tutufool commented 6 years ago

Sounds great! Then I'll close this PR.