• EnglishEspañol日本語한국어Português
  • Log inStart now

Troubleshoot Java asynchronous instrumentation

If you are having problems using the Java agent API for async tokens and segments, use these techniques to help you find answers and solve problems.

Verify your instrumentation

The API has a number of built-in safety mechanisms to prevent issues caused by incorrect API usage, but you can use these techniques to verify that your application’s instrumentation is correct:

  • After instrumenting your code, verify that the logs show that an equal number of tokens have been created and expired. For more information on which log messages to look for, see Use logs to troubleshoot.
  • Check the garbage collection statistics under APM's JVMs page to determine whether or not your changes have significantly altered garbage collection patterns.
  • Check if any segments or tokens are timing out by reviewing your transaction traces for a timed_out attribute. If so, you can change the limit with token_timeout and segment_timeout.

Use logs to troubleshoot

To customize your Java agent logging, see Generating logs. Then, you can examine your logs for these common messages:

  • To view created tokens, check logs at FINEST for:

    Transaction com.newrelic.agent.Transaction@5a7cc8e: created active token com.newrelic.agent.TokenImpl@7db8d0e8
  • To view expired tokens and the time that they expired, check logs at FINEST for:

    Transaction com.newrelic.agent.Transaction@5a7cc8e: expired token com.newrelic.agent.TokenImpl@7db8d0e8
  • To view created segments, check logs at FINEST for:

    Transaction com.newrelic.agent.Transaction@486b7f04: startSegment(): com.newrelic.agent.Segment@2b7fdad3 created and started with tracer com.newrelic.agent.tracers.OtherRootTracer@4df4a953
  • To view ended segments and the time that they ended, check logs at FINEST for:

    com.newrelic.agent.Transaction@486b7f04--finish segment(): com.newrelic.agent.Segment@2b7fdad3 async finish with tracer com.newrelic.agent.tracers.OtherRootTracer@4df4a953

Problem: Transaction times are too long

Make sure to expire tokens and end or ignore segments; otherwise transactions may take longer to report to New Relic. The Java agent has a timeout mechanism for tokens and segments that are not ended correctly. For more information, see token_timeout and segment_timeout.

Problem: No transaction trace data

Inspect transaction traces to make sure expected asynchronous work is reported. If you do not see any transaction traces, make sure your transaction duration exceeds the transaction trace threshold set in transaction_threshold.

Problem: Too few async calls

If too few calls are being reported:

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.