• Log in

Java agent API: Custom instrumentation with annotation of an example app

The New Relic Java agent API lets you set up custom instrumentation for your Java application. This document shows an example of using custom instrumentation with annotation in an imaginary application.

Important

For best results when using the API, ensure you have the latest Java agent release.

Complete example app using API

Below is an example of an imaginary store app's servlet using the Java agent API.

Tip

If you copy and paste example code, be sure to use appropriate spacing on your command lines.

How the example uses the API

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

Copyright © 2022 New Relic Inc.

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