Java Monitoring Quick Start Guide
Getting started with Instrumental and Java
Here's how to get up and running with Java application monitoring and Instrumental. Like all our agents, the Java agent is designed to prevent exceptions from impacting your application. It's also completely non-blocking.
Installation
Add the agent to your pom.xml:
<dependency> <groupId>com.instrumentalapp</groupId> <artifactId>instrumental_agent</artifactId> <version>1.0.0</version> </dependency>
Be sure to Maven install:
$ mvn install
Require the library and configure it with your project token.
import com.instrumentalapp.*; Agent agent = new Agent(new AgentOptions().setApiKey("PROJECT_TOKEN").setEnabled(isProduction));
Sending Metrics
Increments are simple counters. learn more
agent.increment("signups");
Gauges represent a value at a point in time. learn more
agent.gauge("load", 1.23);
The time method measures code execution time.
agent.time("query_time", new Runnable() { public void run() { // Do something }});
Sending Notices
Notices are project specific events.
agent.notice("Deployed revision 038ade4 to production"); // instantaneous event agent.notice("event in the past with a duration", System.currentTimeMillis() / 1000 - 60 * 10, 60*10); // an event with a duration
Using StatsD or statsite? We’ve got you covered with our StatsD backend and statsite sink