Wrap instrumentation installation with a try/catch

This commit is contained in:
Laplie Anderson 2019-08-28 17:33:11 -04:00
parent 3f29e72317
commit 08de0b02fd
1 changed files with 7 additions and 2 deletions

View File

@ -138,8 +138,13 @@ public class AgentInstaller {
int numInstrumenters = 0;
for (final Instrumenter instrumenter : ServiceLoader.load(Instrumenter.class)) {
log.debug("Loading instrumentation {}", instrumenter.getClass().getName());
agentBuilder = instrumenter.instrument(agentBuilder);
numInstrumenters++;
try {
agentBuilder = instrumenter.instrument(agentBuilder);
numInstrumenters++;
} catch (final Throwable e) {
log.error("Unable to load instrumentation {}", instrumenter.getClass().getName(), e);
}
}
log.debug("Installed {} instrumenter(s)", numInstrumenters);