Class DefaultConfigProperties
java.lang.Object
io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties
- All Implemented Interfaces:
ConfigProperties
Properties are normalized to The properties for both of these will be normalized to be all lower
case, dashses are replaces with periods, and environment variable underscores are replaces with
periods.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
DefaultConfigProperties
(DefaultConfigProperties previousProperties, Map<String, String> overrides) private
DefaultConfigProperties
(Map<?, ?> systemProperties, Map<String, String> environmentVariables, Map<String, String> defaultProperties) -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultConfigProperties
Creates aDefaultConfigProperties
by merging system properties, environment variables, and thedefaultProperties
.static DefaultConfigProperties
createFromMap
(Map<String, String> properties) Create aDefaultConfigProperties
from theproperties
, ignoring system properties and environment variables.filterBlanksAndNulls
(String[] values) getBoolean
(String name) Returns a boolean-valued configuration property.Returns a double-valued configuration property.getDuration
(String name) Returns a duration property from the map, ornull
if it cannot be found or it has a wrong type.private static TimeUnit
getDurationUnit
(String unitString) Returns the TimeUnit associated with a unit string.Returns an Integer-valued configuration property.Returns a list-valued configuration property.Returns a Long-valued configuration property.Returns a Map configuration property.getSet
(ConfigProperties config, String name) ReturnsConfigProperties.getList(String)
as aSet
after validating there are no duplicate entries.Returns a string-valued configuration property.private static String
getUnitString
(String rawValue) Fragments the 'units' portion of a config value from the 'value' portion.private static ConfigurationException
newInvalidPropertyException
(String name, String value, String type) withOverrides
(Map<String, String> overrides) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties
getBoolean, getDouble, getDuration, getInt, getList, getLong, getMap, getString
-
Field Details
-
config
-
-
Constructor Details
-
DefaultConfigProperties
-
DefaultConfigProperties
private DefaultConfigProperties(DefaultConfigProperties previousProperties, Map<String, String> overrides)
-
-
Method Details
-
create
Creates aDefaultConfigProperties
by merging system properties, environment variables, and thedefaultProperties
.Environment variables take priority over
defaultProperties
. System properties take priority over environment variables. -
createFromMap
Create aDefaultConfigProperties
from theproperties
, ignoring system properties and environment variables. -
getString
Description copied from interface:ConfigProperties
Returns a string-valued configuration property.- Specified by:
getString
in interfaceConfigProperties
- Returns:
- null if the property has not been configured.
-
getBoolean
Description copied from interface:ConfigProperties
Returns a boolean-valued configuration property. Implementations should use the same rules asBoolean.parseBoolean(String)
for handling the values.- Specified by:
getBoolean
in interfaceConfigProperties
- Returns:
- null if the property has not been configured.
-
getInt
Description copied from interface:ConfigProperties
Returns an Integer-valued configuration property.- Specified by:
getInt
in interfaceConfigProperties
- Returns:
- null if the property has not been configured.
-
getLong
Description copied from interface:ConfigProperties
Returns a Long-valued configuration property.- Specified by:
getLong
in interfaceConfigProperties
- Returns:
- null if the property has not been configured.
-
getDouble
Description copied from interface:ConfigProperties
Returns a double-valued configuration property.- Specified by:
getDouble
in interfaceConfigProperties
- Returns:
- null if the property has not been configured.
-
getDuration
Description copied from interface:ConfigProperties
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.
- Specified by:
getDuration
in interfaceConfigProperties
- Parameters:
name
- The property name- Returns:
- the
Duration
value of the property,null
if the property cannot be found.
-
getList
Description copied from interface:ConfigProperties
Returns a list-valued configuration property. The format of the original value must be comma-separated. Empty values will be removed.- Specified by:
getList
in interfaceConfigProperties
- Returns:
- an empty list if the property has not been configured.
-
getSet
ReturnsConfigProperties.getList(String)
as aSet
after validating there are no duplicate entries.- Throws:
ConfigurationException
- ifname
contains duplicate entries
-
getMap
Description copied from interface:ConfigProperties
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.- Specified by:
getMap
in interfaceConfigProperties
- Returns:
- an empty map if the property has not been configured.
-
withOverrides
-
newInvalidPropertyException
private static ConfigurationException newInvalidPropertyException(String name, String value, String type) -
filterBlanksAndNulls
-
getDurationUnit
Returns the TimeUnit associated with a unit string. Defaults to milliseconds. -
getUnitString
Fragments the 'units' portion of a config value from the 'value' portion.E.g. "1ms" would return the string "ms".
-