init global tracer in premain

This commit is contained in:
Andrew Kent 2017-12-08 16:56:43 -08:00
parent ae2b85ea51
commit b231306f57
2 changed files with 4 additions and 3 deletions

View File

@ -24,6 +24,7 @@ public class AgentRulesManager {
public AgentRulesManager(final TracingAgentConfig config) { public AgentRulesManager(final TracingAgentConfig config) {
agentTracerConfig = config; agentTracerConfig = config;
instrumentationRulesManager = new InstrumentationRulesManager(config, this); instrumentationRulesManager = new InstrumentationRulesManager(config, this);
instrumentationRulesManager.initTracer();
} }
/** This method initializes the manager. */ /** This method initializes the manager. */

View File

@ -120,11 +120,9 @@ public class InstrumentationRulesManager {
log.info("Initializing on classloader {}", classLoader); log.info("Initializing on classloader {}", classLoader);
injector.inject(classLoader); injector.inject(classLoader);
initTracer();
} }
private void initTracer() { void initTracer() {
synchronized (SYNC) { synchronized (SYNC) {
if (!GlobalTracer.isRegistered()) { if (!GlobalTracer.isRegistered()) {
// Try to obtain a tracer using the TracerResolver // Try to obtain a tracer using the TracerResolver
@ -135,6 +133,8 @@ public class InstrumentationRulesManager {
} catch (final RuntimeException re) { } catch (final RuntimeException re) {
log.warn("Failed to register tracer '" + resolved + "'", re); log.warn("Failed to register tracer '" + resolved + "'", re);
} }
} else {
log.warn("Failed to resolve dd tracer");
} }
} }
} }