Java Installation

Integrate Hud Java Agent for enhanced observability in your application in a few simple steps

1. Create environment variables

Create the following environment variables:

  1. HUD_KEY - Hud API key, use the key for the relevant environment from here
  2. HUD_SERVICE - your service name

2. Download the Hud's Jar

Use curl to download Hud's Jar.

curl -L -o hud-sdk.jar https://github.com/code-hud/java-sdk-releases/releases/latest/download/hud-sdk.jar
How to pin a fixed version?

Browse available versions at github.com/code-hud/java-sdk-releases/releases, then replace latest with the version tag:

curl -L -o hud-sdk.jar https://github.com/code-hud/java-sdk-releases/releases/download/v0.3.x/hud-sdk.jar

3. Add Hud to your service start command

java -javaagent:./hud-sdk.jar -Dio.hud.includeDomains=[package_name1];[package_name2];... -jar [app.jar]

Where:

  • [package_name1];... are the packages to monitor, and could be just their start, e.g. companyname
  • [app.jar] is your application jar
📘

Tag your deployment (recommended)

Pass a deployment ID so Hud attributes data to a specific code version. You can then filter every page in the web app (and MCP) by version using the Filters menu in the top-right corner.

Add the io.hud.deploymentId system property to the start command:

java -javaagent:./hud-sdk.jar -Dio.hud.deploymentId=v2.4.1 -Dio.hud.includeDomains=[package_name1];... -jar [app.jar]

Requires Java SDK v0.3.5 or later.

Use the commit SHA of the code you deploy, or a semantic version tag (e.g. v2.4.1) that is also a tag on that commit in GitHub. This lets Deployment monitoring link each deployment to its PRs.


4. Run your service and trigger it!

Start your service and trigger the functions you want to measure - metrics collection will begin automatically.

Then, head over to the web app to explore your data live.



Did this page help you?