#Java

Anake

Ananke is a Java library that allows Java applications to communicate with and send information to a StatsD listener. You can use Ananke to send metrics from your Java applications to a StatsD server, which will then send the metrics to Metricly. Configuration Setup the Metricly StatsD integration or the Etsy StatsD integration if you haven’t already. We recommend setting up the Metricly StatsD integration if you don’t have a StatsD server already; if you have a StatsD server setup, we recommend setting up the Etsy StatsD integration.

Collected Metrics

Collected Fully Qualified Name (FQN) Description Statistic Units Min Max Sparse Data Strategy (SDS) BASE CORR UTIL *.calls The number of calls made to the method. sum count 0 none none yes no no *.errors The number of method calls that resulted in errors. sum count 0 none none yes no no *.time The amount of time spent executing the method totaled across all calls.

Computed Metrics

Computed Fully Qualified Name (FQN) Description Statistic Units Min Max BASE CORR UTIL netuitive.jvm.heap.utilizationpercent Percentage of the allocated heap memory that is currently in use.Computation:(Heap Used / Heap Committed) * 100 average percent 0 100 yes yes yes netuitive.jvm.non-heap.utilizationpercent Percentage of the allocated non-heap memory that is currently in use.Computation:(Metaspace or PermGen Used + CodeCache Used / Metaspace or PermGen Committed + CodeCache Committed) * 100 average percent 0 100 yes yes yes netuitive.

Custom MBeans

The Java agent can collect metrics from custom mbeans. We have provided a sample spring boot application that creates 2 custom mbeans with test attributes here. Multiple Custom MBean Diagram For a Single Custom MBean Navigate to the zorka.properties file in your Java agent directory. Near the bottom of the file, set the attribute netuitive.api.custom.stats.mbean to the custom mbean you defined in your application #custom mbean to collect metrics from netuitive.

Enable Proxy

Enable a Proxy Navigate to the zorka.properties file. Find the proxy section: netuitive.api.proxy = no netuitive.api.proxy.address = http://<proxy host>:<proxy port> 3. Change the netuitive.api.proxy line to yes. 4. Add the correct proxy host and port to the netuitive.api.proxy.address line.

Iris

Iris is a Java library that allows your Java applications to communicate with Metricly’s REST API. You can use Iris to send metrics from your applications to Metricly, create dashboards, tags, elements, and much more. Configuration Include the proper dependency from Maven for the appropriate build manager. Invoke the REST API client interface in a central location that your various Java classes can access while ensuring you replace username and password with the appropriate values.

Java Agent

Metricly’s Java agent is a java monitoring agent with a programmable bytecode instrumentation engine that’s enabled by adding a JVM integration in Metricly. The Metricly Java integration allows Metricly to collect JVM runtime system metrics like CPU, Memory, GC, Threads and Classes Count, and application components method performance statistics, such as number of calls and execution time. Prerequisites Must have Java 6 Or greater. Configuration 1. Copy API key From the top navigation menu, select Integrations.

Java Metrics

Instrumenting Metric Values First, set up the Java Agent. In the zorka/scripts/ directory, create a .bsh file for the application you want to monitor. Call zorka.require to load any extension scripts your application depends on. Define the function(s) you want Zorka to monitor using the template below. The template will establish namespace by creating a function that returns a reference to its own instance and then defines a variable that holds an instance of the function.

Java Policies

Policy name Duration Conditions Category Description Elevated JVM CPU Activity 15 min cpu.used.percent has an upper baseline deviation + an upper contextual deviation + a static threshold > 50% WARNING This policy will generate a WARNING event when the JVM’s CPU activity is higher than expected. Additionally, the CPU usage is above 50%. Elevated JVM Heap Usage 15 min metricly.jvm.heap.utilizationpercent has an upper baseline deviation + an upper contextual deviation WARNING This policy will generate a WARNING event when the JVM’s heap usage is higher than expected.

Send Tags Via Zorka

Send Element Tags via Zorka Agent Navigate to the zorka.properties file in your Java agent directory. Near the bottom of the file, uncomment the #netuitive.api.tags list and add tags following the below format: netuitive.api.tags = name:value, second:value 3. Save the file.