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

Add bool to manage whether a tracer has been registered in GlobalTracer #114

Merged
merged 2 commits into from
Dec 10, 2018

Conversation

MikeGoldsmith
Copy link
Member

  • add s_isRegistered bool

  • set s_isregistered when Registering a tracer

  • add unit test to verify registering a NoopTracer set the s_isRegistered bool

  • move ResetTracer logic to GlobalTracer as internal function instead of test utility for easier reusability

Addresses #113

- add s_isRegistered bool
- set s_isregistered when Registering a tracer
- add unit test to verify registering a NoopTracer set the s_isRegistered bool

- move ResetTracer logic to GlobalTracer as internal function instead of test utility for easier reusability
@@ -82,12 +98,16 @@ public static void Register(ITracer tracer)
lock (s_lock)
{
if (tracer == s_instance._tracer)
{
_isRegistered = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why this is required? The s_instance._tracer & _isRegistered assignation below works atomically, no?

Copy link
Member Author

@MikeGoldsmith MikeGoldsmith Nov 28, 2018

Choose a reason for hiding this comment

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

We need this because the default tracer is a NoopTracer, so if you intentionally register a NoopTracer we need to set the s_isRegistered bool to true too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, right. Had forgotten this detail ;)

@carlosalberto
Copy link
Contributor

carlosalberto commented Nov 28, 2018

Overall nice, I like (with the only doubt mentioned in the code ;) )

My personal advice would be to not merge it till we have it working/approved in Java as well. @MikeGoldsmith if you are low on cycles, I can cook the PR for Java - else, feel free to cook it as well :)

Copy link
Member

@austinlparker austinlparker left a comment

Choose a reason for hiding this comment

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

lgtm

@MikeGoldsmith
Copy link
Member Author

Thanks @carlosalberto and @austinlparker - I agree Java should be approved before merging to ensure we're consistent.

So we also plan changes in the other implementations to track when a tracer has been registered and prevent subsequent calls? ie you said Python doesn't do that check and I don't think Go does either

@carlosalberto
Copy link
Contributor

@MikeGoldsmith So IIRC it was discussed that languages that may likely have a collision initializing the global tracer (from different threads at startup time) should have this check. Java and C# fall into this category - and for Python this is not often the case, so it was decided we wouldn't do this until truly required (the same applies to Javascript?).

I think Java + C# is a good start for now, in any case ;)

@MikeGoldsmith
Copy link
Member Author

After seeing the case of keeping the Tracer reset logic in the GlobalTracerTestUtil in Java, I've re-added it back here too.

@MikeGoldsmith
Copy link
Member Author

@austinlparker @carlosalberto - not sure why AppVeyor is failing with unit tests. They all successfully pass for me locally.

@austinlparker
Copy link
Member

From looking at the test code, it seems like there could be a race condition since there's a bunch of async stuff going on. I'm not sure if it's a great test the way it's written.

@austinlparker
Copy link
Member

I think I need different repo permissions to be able to re-run the appveyor job, lemme look into it.

@MikeGoldsmith
Copy link
Member Author

@austinlparker had any luck with getting AppVeyor permissions to re-run the CI?

@austinlparker
Copy link
Member

Ah, sorry, completely slipped my mind. Let me check today or I'll bring it up tomorrow at the OTSC call.

@MikeGoldsmith MikeGoldsmith merged commit 11531f2 into opentracing:master Dec 10, 2018
@MikeGoldsmith MikeGoldsmith deleted the global-tracer-bool branch December 10, 2018 15:28
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.

3 participants