Closed liurui-1 closed 5 years ago
You're right. Original version wasn't using try-with-resouce. Would you like to create a PR to fix this?
@yurishkuro In my app, I just do not need to close the tracer object because the dropwizard server is always running. If we want to close tracer object gracefully, we have to add a lot of lifecycle code for dropwizard server and add trace close code in the hook of server close which has nothing to do with this tutorial. I do not know this if this is the right way.
In this tutorial the servers are also long-running, so there's no strong need to close the tracer. Also, I think Jaeger tracer already registers itself with JVM shutdown hooks, so on app exit it should flush automatically anyway.
Thanks @yurishkuro . I just submited a PR as following: https://github.com/yurishkuro/opentracing-tutorial/pull/54
There is a defect in lession03 Publisher.java and Formatter.java in “solution” folder. The following code makes tracer object to be closed soon in the beginning. And the server-side tracing does not work.