Class Internal
java.lang.Object
io.opentelemetry.instrumentation.runtimetelemetry.internal.Internal
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 Summary
Modifier and TypeMethodDescriptionstatic RuntimeTelemetryconfigure(io.opentelemetry.api.OpenTelemetry openTelemetry, boolean defaultEnabled) Configures and builds aRuntimeTelemetryinstance based on the provided configuration.static voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidsetCaptureGcCause(RuntimeTelemetryBuilder builder, boolean captureGcCause) Sets whether the GC cause attribute should be captured on GC duration metrics.static voidsetDisableAllJfrFeatures(RuntimeTelemetryBuilder builder, boolean disableAllJfr) Sets whether all JFR features should be disabled.static voidsetDisableJfrFeature(RuntimeTelemetryBuilder builder, String featureName) Disables a specific JFR feature by name.static voidsetDisableJmx(RuntimeTelemetryBuilder builder, boolean disable) Disables all JMX-based metrics.static voidsetEnableAllJfrFeatures(RuntimeTelemetryBuilder builder, boolean enableAllJfr) Sets whether all JFR features should be enabled.static voidsetEnableExperimentalJfrFeatures(RuntimeTelemetryBuilder builder, boolean enable) Sets whether experimental JFR features should be enabled.static voidsetEnableJfrFeature(RuntimeTelemetryBuilder builder, String featureName) Enables a specific JFR feature by name.static voidsetJfrInstrumentationName(RuntimeTelemetryBuilder builder, String name) Sets the instrumentation name to use for JFR metrics.static voidsetJmxInstrumentationName(RuntimeTelemetryBuilder builder, String name) Sets the instrumentation name to use for JMX metrics.static voidsetUseLegacyJfrCpuCountMetric(RuntimeTelemetryBuilder builder, boolean useLegacy) Sets whether to use the legacy metric namejvm.cpu.limitinstead of the standardjvm.cpu.countfor the JFR CPU count feature.
-
Method Details
-
setEnableAllJfrFeatures
Sets whether all JFR features should be enabled. This is used for backward compatibility with theruntime_telemetry_java17.enable_allconfiguration 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
Sets whether all JFR features should be disabled. This is used for backward compatibility when running on Java 17+ but only the baseruntime_telemetry.enabledoption is set (withoutruntime_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 theruntime_telemetry_java17.enabledconfiguration 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
Sets whether the GC cause attribute should be captured on GC duration metrics. The default istrue. This is configurable for backward compatibility with the previous behavior wherecapture_gc_causedefaulted tofalse.- Parameters:
builder- the runtime telemetry buildercaptureGcCause-trueto capture the GC cause attribute (default)
-
internalSetCaptureGcCause
-
setUseLegacyJfrCpuCountMetric
public static void setUseLegacyJfrCpuCountMetric(RuntimeTelemetryBuilder builder, boolean useLegacy) Sets whether to use the legacy metric namejvm.cpu.limitinstead of the standardjvm.cpu.countfor the JFR CPU count feature. This is for backward compatibility with the previous runtime-telemetry-java17 module.- Parameters:
builder- the runtime telemetry builderuseLegacy-trueto use the legacy metric name
-
internalSetUseLegacyJfrCpuCountMetric
public static void internalSetUseLegacyJfrCpuCountMetric(BiConsumer<RuntimeTelemetryBuilder, Boolean> callback) -
setJmxInstrumentationName
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 buildername- the instrumentation name for JMX metrics
-
internalSetJmxInstrumentationName
public static void internalSetJmxInstrumentationName(BiConsumer<RuntimeTelemetryBuilder, String> callback) -
setJfrInstrumentationName
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 buildername- the instrumentation name for JFR metrics
-
internalSetJfrInstrumentationName
public static void internalSetJfrInstrumentationName(BiConsumer<RuntimeTelemetryBuilder, String> callback) -
setEnableJfrFeature
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 builderfeatureName- the JFR feature name (e.g., "CPU_COUNT_METRICS")
-
internalSetEnableJfrFeature
-
setDisableJfrFeature
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 builderfeatureName- the JFR feature name (e.g., "CPU_COUNT_METRICS")
-
internalSetDisableJfrFeature
public static void internalSetDisableJfrFeature(BiConsumer<RuntimeTelemetryBuilder, String> callback) -
setDisableJmx
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 builderdisable-trueto disable JMX metrics
-
internalSetDisableJmx
-
configure
@Nullable public static RuntimeTelemetry configure(io.opentelemetry.api.OpenTelemetry openTelemetry, boolean defaultEnabled) Configures and builds aRuntimeTelemetryinstance based on the provided configuration.- Parameters:
openTelemetry- the OpenTelemetry instancedefaultEnabled- whether instrumentation is enabled by default- Returns:
- the configured RuntimeTelemetry, or null if runtime telemetry is disabled
-