Merge pull request #966 from DataDog/landerson/wrap-instrumentation-install

Wrap instrumentation installation with a try/catch
This commit is contained in:
Laplie Anderson 2019-08-30 14:02:13 -04:00 committed by GitHub
commit d03d583e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

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