Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't log full exception stack for expected NPE in noticeTracer #2143

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading