Interface ConfigProperties
-
- All Known Implementing Classes:
DefaultConfigProperties
public interface ConfigProperties
Properties used for auto-configuration of the OpenTelemetry SDK components.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.Boolean
getBoolean(java.lang.String name)
Returns a boolean-valued configuration property.default boolean
getBoolean(java.lang.String name, boolean defaultValue)
Returns a boolean-valued configuration property.java.lang.Double
getDouble(java.lang.String name)
Returns a double-valued configuration property.default double
getDouble(java.lang.String name, double defaultValue)
Returns a double-valued configuration property.java.time.Duration
getDuration(java.lang.String name)
Returns a duration property from the map, ornull
if it cannot be found or it has a wrong type.default java.time.Duration
getDuration(java.lang.String name, java.time.Duration defaultValue)
Returns a Duration value configuration property.java.lang.Integer
getInt(java.lang.String name)
Returns an Integer-valued configuration property.default int
getInt(java.lang.String name, int defaultValue)
Returns an Integer-valued configuration property.java.util.List<java.lang.String>
getList(java.lang.String name)
Returns a list-valued configuration property.default java.util.List<java.lang.String>
getList(java.lang.String name, java.util.List<java.lang.String> defaultValue)
Returns a List value configuration property.java.lang.Long
getLong(java.lang.String name)
Returns a Long-valued configuration property.default long
getLong(java.lang.String name, long defaultValue)
Returns a Long-valued configuration property.java.util.Map<java.lang.String,java.lang.String>
getMap(java.lang.String name)
Returns a Map configuration property.default java.util.Map<java.lang.String,java.lang.String>
getMap(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> defaultValue)
Returns a Map value configuration property.java.lang.String
getString(java.lang.String name)
Returns a string-valued configuration property.default java.lang.String
getString(java.lang.String name, java.lang.String defaultValue)
Returns a string-valued configuration property.
-
-
-
Method Detail
-
getString
@Nullable java.lang.String getString(java.lang.String name)
Returns a string-valued configuration property.- Returns:
- null if the property has not been configured.
- Throws:
ConfigurationException
- if the property is not a valid string.
-
getString
default java.lang.String getString(java.lang.String name, java.lang.String defaultValue)
Returns a string-valued configuration property.- Returns:
- a string-valued configuration property or
defaultValue
if a property withname
has not been configured. - Throws:
ConfigurationException
- if the property is not a valid string.- Since:
- 1.15.0
-
getBoolean
@Nullable java.lang.Boolean getBoolean(java.lang.String name)
Returns a boolean-valued configuration property. Implementations should use the same rules asBoolean.parseBoolean(String)
for handling the values.- Returns:
- null if the property has not been configured.
- Throws:
ConfigurationException
- if the property is not a valid boolean.
-
getBoolean
default boolean getBoolean(java.lang.String name, boolean defaultValue)
Returns a boolean-valued configuration property.- Returns:
- a Boolean-valued configuration property or
defaultValue
if a property withname
has not been configured. - Throws:
ConfigurationException
- if the property is not a valid string.- Since:
- 1.15.0
-
getInt
@Nullable java.lang.Integer getInt(java.lang.String name)
Returns an Integer-valued configuration property.- Returns:
- null if the property has not been configured.
- Throws:
ConfigurationException
- if the property is not a valid integer.
-
getInt
default int getInt(java.lang.String name, int defaultValue)
Returns an Integer-valued configuration property.- Returns:
- an Integer-valued configuration property or
defaultValue
if a property withname
has not been configured. - Throws:
ConfigurationException
- if the property is not a valid string.- Since:
- 1.15.0
-
getLong
@Nullable java.lang.Long getLong(java.lang.String name)
Returns a Long-valued configuration property.- Returns:
- null if the property has not been configured.
- Throws:
ConfigurationException
- if the property is not a valid long.
-
getLong
default long getLong(java.lang.String name, long defaultValue)
Returns a Long-valued configuration property.- Returns:
- a Long-valued configuration property or
defaultValue
if a property withname
has not been configured. - Throws:
ConfigurationException
- if the property is not a valid string.- Since:
- 1.15.0
-
getDouble
@Nullable java.lang.Double getDouble(java.lang.String name)
Returns a double-valued configuration property.- Returns:
- null if the property has not been configured.
- Throws:
ConfigurationException
- if the property is not a valid double.
-
getDouble
default double getDouble(java.lang.String name, double defaultValue)
Returns a double-valued configuration property.- Returns:
- a Double-valued configuration property or
defaultValue
if a property withname
has not been configured. - Throws:
ConfigurationException
- if the property is not a valid string.- Since:
- 1.15.0
-
getDuration
@Nullable java.time.Duration getDuration(java.lang.String name)
Returns a duration property from the map, ornull
if it cannot be found or it has a wrong type.Durations can be of the form "{number}{unit}", where unit is one of:
- ms
- s
- m
- h
- d
If no unit is specified, milliseconds is the assumed duration unit.
- Parameters:
name
- The property name- Returns:
- the
Duration
value of the property,null
if the property cannot be found. - Throws:
ConfigurationException
- for malformed duration strings.
-
getDuration
default java.time.Duration getDuration(java.lang.String name, java.time.Duration defaultValue)
Returns a Duration value configuration property.- Returns:
- a Double-valued configuration property or
defaultValue
if a property with namename
has not been configured. - Throws:
ConfigurationException
- if the property is not a valid string.- Since:
- 1.15.0
- See Also:
getDuration(String name)
-
getList
java.util.List<java.lang.String> getList(java.lang.String name)
Returns a list-valued configuration property. The format of the original value must be comma-separated. Empty values will be removed.- Returns:
- an empty list if the property has not been configured.
- Throws:
ConfigurationException
- if the property is not a valid comma-separated list.
-
getList
default java.util.List<java.lang.String> getList(java.lang.String name, java.util.List<java.lang.String> defaultValue)
Returns a List value configuration property.- Returns:
- a List configuration property or
defaultValue
if a property withname
has not been configured. - Throws:
ConfigurationException
- if the property is not a valid string.- Since:
- 1.15.0
- See Also:
getList(String name)
-
getMap
java.util.Map<java.lang.String,java.lang.String> getMap(java.lang.String name)
Returns a Map configuration property. The format of the original value must be comma-separated for each key, with an '=' separating the key and value. For instance,service.name=Greatest Service,host.name=localhost
. Empty values will be removed.- Returns:
- an empty map if the property has not been configured.
- Throws:
ConfigurationException
- for malformed map strings.
-
getMap
default java.util.Map<java.lang.String,java.lang.String> getMap(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> defaultValue)
Returns a Map value configuration property.- Returns:
- a Double-valued configuration property or
defaultValue
if a property withname
has not been configured. - Throws:
ConfigurationException
- if the property is not a valid string.- Since:
- 1.15.0
- See Also:
getMap(String name)
-
-