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
ConstructorsModifierConstructorDescriptionprivateDefaultConfigProperties(DefaultConfigProperties previousProperties, Map<String, String> overrides) privateDefaultConfigProperties(Map<?, ?> systemProperties, Map<String, String> environmentVariables, Map<String, String> defaultProperties) -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultConfigPropertiesCreates aDefaultConfigPropertiesby merging system properties, environment variables, and thedefaultProperties.static DefaultConfigPropertiescreateFromMap(Map<String, String> properties) Create aDefaultConfigPropertiesfrom 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, ornullif it cannot be found or it has a wrong type.private static TimeUnitgetDurationUnit(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 aSetafter validating there are no duplicate entries.Returns a string-valued configuration property.private static StringgetUnitString(String rawValue) Fragments the 'units' portion of a config value from the 'value' portion.private static ConfigurationExceptionnewInvalidPropertyException(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, waitMethods 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 aDefaultConfigPropertiesby merging system properties, environment variables, and thedefaultProperties.Environment variables take priority over
defaultProperties. System properties take priority over environment variables. -
createFromMap
Create aDefaultConfigPropertiesfrom theproperties, ignoring system properties and environment variables. -
getString
Description copied from interface:ConfigPropertiesReturns a string-valued configuration property.- Specified by:
getStringin interfaceConfigProperties- Returns:
- null if the property has not been configured.
-
getBoolean
Description copied from interface:ConfigPropertiesReturns a boolean-valued configuration property. Implementations should use the same rules asBoolean.parseBoolean(String)for handling the values.- Specified by:
getBooleanin interfaceConfigProperties- Returns:
- null if the property has not been configured.
-
getInt
Description copied from interface:ConfigPropertiesReturns an Integer-valued configuration property.- Specified by:
getIntin interfaceConfigProperties- Returns:
- null if the property has not been configured.
-
getLong
Description copied from interface:ConfigPropertiesReturns a Long-valued configuration property.- Specified by:
getLongin interfaceConfigProperties- Returns:
- null if the property has not been configured.
-
getDouble
Description copied from interface:ConfigPropertiesReturns a double-valued configuration property.- Specified by:
getDoublein interfaceConfigProperties- Returns:
- null if the property has not been configured.
-
getDuration
Description copied from interface:ConfigPropertiesReturns a duration property from the map, ornullif 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:
getDurationin interfaceConfigProperties- Parameters:
name- The property name- Returns:
- the
Durationvalue of the property,nullif the property cannot be found.
-
getList
Description copied from interface:ConfigPropertiesReturns a list-valued configuration property. The format of the original value must be comma-separated. Empty values will be removed.- Specified by:
getListin interfaceConfigProperties- Returns:
- an empty list if the property has not been configured.
-
getSet
ReturnsConfigProperties.getList(String)as aSetafter validating there are no duplicate entries.- Throws:
ConfigurationException- ifnamecontains duplicate entries
-
getMap
Description copied from interface:ConfigPropertiesReturns 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:
getMapin 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".
-