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

Improve docs for upgrading the Java Agent and adding Java Agent APIs #16710

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ For all available New Relic APIs, see [Intro to APIs](/docs/apis/getting-started

## Use the API [#api]

To access the API class, add `newrelic-api.jar` to your application class path. The jar is in the New Relic Java agent's installation `zip` file. You can call the API when the Java agent is not running. The API methods are just stubs; the implementation is added when the Java agent loads the class.
To access the API, download it from maven central via a build tool.

obenkenobi marked this conversation as resolved.
Show resolved Hide resolved
For example with gradle:
obenkenobi marked this conversation as resolved.
Show resolved Hide resolved

```groovy
implementation 'com.newrelic.agent.java:newrelic-api:8.10.0'
```

You can call the API when the Java agent is not running. The API methods are just stubs; the implementation is added when the Java agent loads the class.
obenkenobi marked this conversation as resolved.
Show resolved Hide resolved

## Transactions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ Then, to update to the latest Java agent version:
1. Back up the <DoNotTranslate>**entire**</DoNotTranslate> [Java agent root directory](/docs/agents/manage-apm-agents/troubleshooting/find-agent-root-directory#java-agent) to another location. Rename that directory to `NewRelic_Agent#.#.#`, where `#.#.#` is the agent version number.
2. [Download the agent.](/docs/release-notes/agent-release-notes/java-release-notes)
3. Unzip the new agent download file, then copy `newrelic-api.jar` and `newrelic.jar` into the original [Java agent root directory](/docs/agents/manage-apm-agents/troubleshooting/find-agent-root-directory#java-agent).
4. Compare your old `newrelic.yml` with the newly downloaded `newrelic.yml` from the zip, and [update the file if needed](#diff).
5. Restart your Java dispatcher.
4. (Optional) If you are using the any of the agent APIs like our [Java Agent API](/docs/apm/agents/java-agent/api-guides/guide-using-java-agent-api/) or a [Scala API](/docs/apm/agents/java-agent/frameworks/scala-installation-java/#using-the-scala-api), it is recommended to upgrade your API dependencies as well to the latest version. Your newer version of the agent will still support the APIs but you may be missing new features plus upgrading is relatively easy. If you are using a build tool like maven, upgrade the API versions to latest. For example if you are using the Java Agent API with gradle where `${agent.version}` is a placeholder for the upgraded agent version:
obenkenobi marked this conversation as resolved.
Show resolved Hide resolved
```groovy
ally-sassman marked this conversation as resolved.
Show resolved Hide resolved
implementation 'com.newrelic.agent.java:newrelic-api:8.10.0'
obenkenobi marked this conversation as resolved.
Show resolved Hide resolved
```
5. Compare your old `newrelic.yml` with the newly downloaded `newrelic.yml` from the zip, and [update the file if needed](#diff).
6. Restart your Java process.

If you experience issues after the Java agent update, restore from the backed-up New Relic agent directory.

Expand Down
Loading