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
    Implementation-Version=1.0.0

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 environment variables, for example -Dcatalina.home for Tomcat containers.

To explicitly set the application name, when starting the JVM specify the -Dcom.instana.agent.jvm.name="My Custom Name" attribute.

Custom JMX instrumentation

To configure which JXM to monitor, edit the agent configuration.yaml file.

com.instana.plugin.java:
  jmx:
    # 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'
      metrics:
        - attributes: 'TotalCompilationTime'
          type: 'delta' # delta will report the change to the previous second
    - object_name: 'java.lang:type=ClassLoading'
      metrics:
        - 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.

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

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.

com.instana.plugin.javatrace:
  instrumentation:
    # Lightweight Bytecode Instrumentation, enabled by default
    # Disabling currently requires an agent restart
    enabled: true