java.lang.Object
io.opentelemetry.instrumentation.runtimetelemetry.internal.Internal

public final class Internal extends Object
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

This class provides configuration methods for use by the Java agent, including backward compatibility support for previous configuration options. The backward compatibility methods may be simplified or removed in a future major version (3.0).

  • Method Details

    • setEnableAllJfrFeatures

      public static void setEnableAllJfrFeatures(RuntimeTelemetryBuilder builder, boolean enableAllJfr)
      Sets whether all JFR features should be enabled. This is used for backward compatibility with the runtime_telemetry_java17.enable_all configuration option.

      On Java 17+, this enables all JFR features including those that overlap with JMX metrics.

    • internalSetEnableAllJfrFeatures

      public static void internalSetEnableAllJfrFeatures(BiConsumer<RuntimeTelemetryBuilder,Boolean> callback)
    • setDisableAllJfrFeatures

      public static void setDisableAllJfrFeatures(RuntimeTelemetryBuilder builder, boolean disableAllJfr)
      Sets whether all JFR features should be disabled. This is used for backward compatibility when running on Java 17+ but only the base runtime_telemetry.enabled option is set (without runtime_telemetry_java17.enabled).
    • internalSetDisableAllJfrFeatures

      public static void internalSetDisableAllJfrFeatures(BiConsumer<RuntimeTelemetryBuilder,Boolean> callback)
    • setEnableExperimentalJfrFeatures

      public static void setEnableExperimentalJfrFeatures(RuntimeTelemetryBuilder builder, boolean enable)
      Sets whether experimental JFR features should be enabled. This is used for backward compatibility with the runtime_telemetry_java17.enabled configuration option, which enabled experimental JFR features (context switches, locks, allocations, network I/O) but not experimental JMX features.
    • internalSetEnableExperimentalJfrFeatures

      public static void internalSetEnableExperimentalJfrFeatures(BiConsumer<RuntimeTelemetryBuilder,Boolean> callback)
    • setCaptureGcCause

      public static void setCaptureGcCause(RuntimeTelemetryBuilder builder, boolean captureGcCause)
      Sets whether the GC cause attribute should be captured on GC duration metrics. The default is true. This is configurable for backward compatibility with the previous behavior where capture_gc_cause defaulted to false.
      Parameters:
      builder - the runtime telemetry builder
      captureGcCause - true to capture the GC cause attribute (default)
    • internalSetCaptureGcCause

      public static void internalSetCaptureGcCause(BiConsumer<RuntimeTelemetryBuilder,Boolean> callback)
    • setUseLegacyJfrCpuCountMetric

      public static void setUseLegacyJfrCpuCountMetric(RuntimeTelemetryBuilder builder, boolean useLegacy)
      Sets whether to use the legacy metric name jvm.cpu.limit instead of the standard jvm.cpu.count for the JFR CPU count feature. This is for backward compatibility with the previous runtime-telemetry-java17 module.
      Parameters:
      builder - the runtime telemetry builder
      useLegacy - true to use the legacy metric name
    • internalSetUseLegacyJfrCpuCountMetric

      public static void internalSetUseLegacyJfrCpuCountMetric(BiConsumer<RuntimeTelemetryBuilder,Boolean> callback)
    • setJmxInstrumentationName

      public static void setJmxInstrumentationName(RuntimeTelemetryBuilder builder, String name)
      Sets the instrumentation name to use for JMX metrics. This is used for backward compatibility to preserve the original instrumentation names when using old configuration options.
      Parameters:
      builder - the runtime telemetry builder
      name - the instrumentation name for JMX metrics
    • internalSetJmxInstrumentationName

      public static void internalSetJmxInstrumentationName(BiConsumer<RuntimeTelemetryBuilder,String> callback)
    • setJfrInstrumentationName

      public static void setJfrInstrumentationName(RuntimeTelemetryBuilder builder, String name)
      Sets the instrumentation name to use for JFR metrics. This is used for backward compatibility to preserve the original instrumentation names when using old configuration options.
      Parameters:
      builder - the runtime telemetry builder
      name - the instrumentation name for JFR metrics
    • internalSetJfrInstrumentationName

      public static void internalSetJfrInstrumentationName(BiConsumer<RuntimeTelemetryBuilder,String> callback)
    • setEnableJfrFeature

      public static void setEnableJfrFeature(RuntimeTelemetryBuilder builder, String featureName)
      Enables a specific JFR feature by name. This is used for backward compatibility with the runtime-telemetry-java17 module's per-feature control.
      Parameters:
      builder - the runtime telemetry builder
      featureName - the JFR feature name (e.g., "CPU_COUNT_METRICS")
    • internalSetEnableJfrFeature

      public static void internalSetEnableJfrFeature(BiConsumer<RuntimeTelemetryBuilder,String> callback)
    • setDisableJfrFeature

      public static void setDisableJfrFeature(RuntimeTelemetryBuilder builder, String featureName)
      Disables a specific JFR feature by name. This is used for backward compatibility with the runtime-telemetry-java17 module's per-feature control.
      Parameters:
      builder - the runtime telemetry builder
      featureName - the JFR feature name (e.g., "CPU_COUNT_METRICS")
    • internalSetDisableJfrFeature

      public static void internalSetDisableJfrFeature(BiConsumer<RuntimeTelemetryBuilder,String> callback)
    • setDisableJmx

      public static void setDisableJmx(RuntimeTelemetryBuilder builder, boolean disable)
      Disables all JMX-based metrics. This is used for backward compatibility with the runtime-telemetry-java17 module's disableAllJmx() method.
      Parameters:
      builder - the runtime telemetry builder
      disable - true to disable JMX metrics
    • internalSetDisableJmx

      public static void internalSetDisableJmx(BiConsumer<RuntimeTelemetryBuilder,Boolean> callback)
    • configure

      @Nullable public static RuntimeTelemetry configure(io.opentelemetry.api.OpenTelemetry openTelemetry, boolean defaultEnabled)
      Configures and builds a RuntimeTelemetry instance based on the provided configuration.
      Parameters:
      openTelemetry - the OpenTelemetry instance
      defaultEnabled - whether instrumentation is enabled by default
      Returns:
      the configured RuntimeTelemetry, or null if runtime telemetry is disabled