jojochuang commented on a change in pull request #1202: HBASE-23756. 
[OpenTracing] Add OpenTracing dependency and helper methods.
URL: https://github.com/apache/hbase/pull/1202#discussion_r384263191
 
 

 ##########
 File path: 
hbase-common/src/main/java/org/apache/hadoop/hbase/trace/TraceUtil.java
 ##########
 @@ -34,17 +51,24 @@
   private static HTraceConfiguration conf;
   private static Tracer tracer;
 
+  private static io.opentracing.Tracer otTracer;
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(TraceUtil.class.getName());
+
+
   private TraceUtil() {
   }
 
-  public static void initTracer(Configuration c) {
-    if (c != null) {
-      conf = new HBaseHTraceConfiguration(c);
-    }
+  public static void initTracer(Configuration c, String serviceName) {
+    if (!GlobalTracer.isRegistered()) {
+      io.jaegertracing.Configuration conf = 
io.jaegertracing.Configuration.fromEnv(serviceName);
+      io.opentracing.Tracer tracer = conf.getTracerBuilder().build();
 
-    if (tracer == null && conf != null) {
-      tracer = new Tracer.Builder("Tracer").conf(conf).build();
+      GlobalTracer.register(tracer);
 
 Review comment:
   I'd suggest you to browse the Jaeger's sampling doc: 
https://www.jaegertracing.io/docs/1.14/sampling/#collector-sampling-configuration
   You can use env variable to control the sampling strategy. Or 
programmatically (at init). Finally, you can also define the sampling strategy 
at the central trace collector.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to