Class SystemProperty

java.lang.Object
io.opentelemetry.instrumentation.api.internal.SystemProperty

public final class SystemProperty extends Object
Reads OpenTelemetry configuration from JVM system properties, falling back to the corresponding environment variables.

For library instrumentation, prefer programmatic configuration. Direct property lookup is needed only when a programmatic configuration surface cannot be exposed. Once declarative instrumentation configuration is stable, use it instead. Current examples include library instrumentation entry points loaded through an SPI, driver, or similar mechanism.

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

  • Method Summary

    Modifier and Type
    Method
    Description
    static Boolean
    getBoolean(String propertyName)
    Returns the boolean value of the given property name from system properties and environment variables.
    static boolean
    getBoolean(String propertyName, boolean defaultValue)
    Returns the boolean value of the given property name from system properties and environment variables.
    static int
    getInt(String propertyName, int defaultValue)
    Returns the int value of the given property name from system properties and environment variables.
    static List<String>
    getList(String propertyName)
    Returns the list of strings value of the given property name from system properties and environment variables, or null if not found.
    static List<String>
    getList(String propertyName, List<String> defaultValue)
    Returns the list of strings value of the given property name from system properties and environment variables, or the default value if not found.
    static String
    getString(String propertyName)
    Returns the string value of the given property name from system properties and environment variables.
    static String
    getString(String propertyName, String defaultValue)
    Returns the string value of the given property name from system properties and environment variables, or the default value if not found.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getBoolean

      public static boolean getBoolean(String propertyName, boolean defaultValue)
      Returns the boolean value of the given property name from system properties and environment variables.

      It's recommended to use ConfigProvider instead to support Declarative Config.

    • getBoolean

      @Nullable public static Boolean getBoolean(String propertyName)
      Returns the boolean value of the given property name from system properties and environment variables.

      It's recommended to use ConfigProvider instead to support Declarative Config.

    • getInt

      public static int getInt(String propertyName, int defaultValue)
      Returns the int value of the given property name from system properties and environment variables.

      It's recommended to use ConfigProvider instead to support Declarative Config.

    • getString

      @Nullable public static String getString(String propertyName)
      Returns the string value of the given property name from system properties and environment variables.

      It's recommended to use ConfigProvider instead to support Declarative Config.

    • getString

      public static String getString(String propertyName, String defaultValue)
      Returns the string value of the given property name from system properties and environment variables, or the default value if not found.

      It's recommended to use ConfigProvider instead to support Declarative Config.

    • getList

      public static List<String> getList(String propertyName, List<String> defaultValue)
      Returns the list of strings value of the given property name from system properties and environment variables, or the default value if not found. The property value is expected to be a comma-separated list.

      It's recommended to use ConfigProvider instead to support Declarative Config.

    • getList

      @Nullable public static List<String> getList(String propertyName)
      Returns the list of strings value of the given property name from system properties and environment variables, or null if not found. The property value is expected to be a comma-separated list.

      It's recommended to use ConfigProvider instead to support Declarative Config.