Java Configuration

Configuring the application name

If present, the application name is automatically picked up from the .jar file that launches, otherwise the command line is used in the same way Java tools display JVMs.

Within the .jar file the two standard attributes in META-INF/Manifest.MF are:

Implementation-Title=Demo App

Using build tools, both attributes can be set when building the application. For more information, see the Oracle documentation.

If no name is obtained using the procedure above, it's then determined by inspecting various system properties, for example -Dcatalina.home for Tomcat containers.

To explicitly set the application name, when starting the JVM specify the"My Custom Name" attribute.

To have the agent use an already existing custom system property, specify a list of properties in the agent configuration.yaml. First existing property will name the JVM:
    - ''

Custom JMX metrics

To configure which JMX metrics to monitor, edit the agent configuration.yaml file.
    # JMX is NOT hot-reloaded and needs to be set before a JVM is discovered.
    # Supported attribute types are Number and Boolean
    # delta calculation is only supported for Number
    - object_name: 'java.lang:type=Compilation'
        - attributes: 'TotalCompilationTime'
          type: 'delta' # delta will report the change to the previous second
    - object_name: 'java.lang:type=ClassLoading'
        - attributes: 'LoadedClassCount'
          type: 'absolute' # absolute will report the value as-is

Two types of metrics are specified in the example above:

  • delta is used for values that increase over time, such as counters, where the relative change is considered interesting.
  • absolute is used to show the actual value each time the metric is accessed.

The attribute specified must either be a Number (or one of its subclasses like Integer or Double) or a String representing a number.

On the JVM dashboard, the JMX metrics are displayed under Custom JMX metrics.

The object_name may contain wildcard patterns as specified in Java's ObjectName API documentation. Here's an example of a configuration with wildcard patterns:
    - object_name: 'kafka.*:type=*-metrics,client-id=*,*'
        - attributes: 'incoming-byte-rate'
          type: 'absolute'
        - attributes: 'incoming-byte-total'
          type: 'absolute'
        - attributes: 'outgoing-byte-rate'
          type: 'absolute'
        - attributes: 'outgoing-byte-total'
          type: 'absolute'

Disabling Automatic instrumentation

This Instana package includes automatic instrumentation that is initialized on package load. This instrumentation provides distributed tracing information to your Instana dashboard.

To disable automatic instrumentation (tracing), edit the agent configuration.yaml file.

    # Lightweight Bytecode Instrumentation, enabled by default
    # Disabling currently requires an agent restart
    enabled: true