Skip to content

Commit

Permalink
Merge pull request #2143 from newrelic/notice-tracer-logging
Browse files Browse the repository at this point in the history
Don't log full exception stack for expected NPE in noticeTracer
  • Loading branch information
jasonjkeller authored Nov 14, 2024
2 parents c78987c + aa52824 commit c195631
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public InstrumentationImpl(com.newrelic.api.agent.Logger logger, ClassTransforme

static double getAutoAsyncLinkRateLimitInSeconds(ClassTransformerConfig classTransformerConfig) {
long rateLimitInMillis = classTransformerConfig.getAutoAsyncLinkRateLimit();
return (double)rateLimitInMillis / (double) TimeUnit.SECONDS.toMillis(1);
return (double) rateLimitInMillis / (double) TimeUnit.SECONDS.toMillis(1);
}

/**
Expand Down Expand Up @@ -360,12 +360,12 @@ public ExitTracer createSqlTracer(Object invocationTarget, int signatureId, Stri
}
}

@Override
public ExitTracer createScalaTxnTracer() {
return createTracer(null, SCALA_API_TXN_CLASS_SIGNATURE_ID, null, SCALA_API_TRACER_FLAGS);
}
@Override
public ExitTracer createScalaTxnTracer() {
return createTracer(null, SCALA_API_TXN_CLASS_SIGNATURE_ID, null, SCALA_API_TRACER_FLAGS);
}

private boolean overSegmentLimit(TransactionActivity transactionActivity) {
private boolean overSegmentLimit(TransactionActivity transactionActivity) {
Transaction transaction;
if (transactionActivity == null) {
transaction = Transaction.getTransaction(false);
Expand All @@ -384,7 +384,7 @@ private ExitTracer noticeTracer(int signatureId, int tracerFlags, Tracer result)
transactionProfileSession.noticeTracerStart(signatureId, tracerFlags, result);
}
} catch (Throwable t) {
logger.log(Level.FINEST, t, "exception in noticeTracer: {0}. This may affect thread profile v2.", result);
logger.log(Level.FINEST, "Exception in noticeTracer. This may affect thread profile v2. Tracer: {0}. Error message: {1}", result, t.getMessage());
}
return result;
}
Expand Down Expand Up @@ -583,7 +583,7 @@ public void instrument() {
NewRelic.recordMetric("Supportability/InstrumentationImpl/instrument", instrumented ? 1f : 0f);
}
} else {
NewRelic.recordMetric("Supportability/InstrumentationImpl/instrument",0f);
NewRelic.recordMetric("Supportability/InstrumentationImpl/instrument", 0f);
}
}

Expand All @@ -610,7 +610,8 @@ private boolean instrument(StackTraceElement stackTraceElement, TraceDetails tra
if (shouldRetransform) {
logger.log(Level.FINE, "Retransforming {0}.{1} for instrumentation.", stackTraceElement.getClassName(), stackTraceElement.getMethodName());
try {
PeriodicRetransformer.INSTANCE.queueRetransform(ImmutableSet.of(ClassLoader.getSystemClassLoader().loadClass(stackTraceElement.getClassName())));
PeriodicRetransformer.INSTANCE.queueRetransform(
ImmutableSet.of(ClassLoader.getSystemClassLoader().loadClass(stackTraceElement.getClassName())));
logger.log(Level.FINE, "Retransformed {0}", stackTraceElement.getClassName());
} catch (ClassNotFoundException e) {
// the system classloader may not be able to see the class - try to find the class in loaded classes
Expand Down

0 comments on commit c195631

Please sign in to comment.