• /
  • EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

Java agent API: Instrumenting example app for external datastore calls and distributed tracing

This document demonstrates using the New Relic Java agent API to instrument a simple client and server application. The instrumentation has these goals:

  • To record external HTTP and datastore transactions.
  • To link external transactions between two applications running New Relic agents (known as distributed tracing or DT).

See the Java agent API Javadoc for full descriptions of the available API classes and methods.

重要

For best results when using the API, ensure that you have the latest Java agent release. Several APIs used in the examples require Java agent 3.36.0 or higher.

Client-side example

Here is an example of the client-side code for a simple client-server application:

Here is the same client app code divided into sections that describe how the API is used:

Server-side example

Here is the server-side code for this example application:

Here is the same example server code broken into sections that describe how the API is used:

Copyright © 2024 New Relic株式会社。

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