Class ConfigProperties
- java.lang.Object
-
- io.opentelemetry.sdk.autoconfigure.ConfigProperties
-
public final class ConfigProperties extends Object
Properties to be used for auto-configuration of the OpenTelemetry SDK components. These properties will be a combination of system properties and environment variables. The properties for both of these will be normalized to be all lower case, and underscores will be replaced with periods.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBoolean(String name)Returns a boolean-valued configuration property.Map<String,String>getCommaSeparatedMap(String name)Returns a map-valued configuration property.List<String>getCommaSeparatedValues(String name)Returns a list-valued configuration property.DoublegetDouble(String name)Returns a double-valued configuration property.DurationgetDuration(String name)Returns a duration property from the map, ornullif it cannot be found or it has a wrong type.IntegergetInt(String name)Returns a integer-valued configuration property.LonggetLong(String name)Returns a long-valued configuration property.StringgetString(String name)Returns a string-valued configuration property.
-
-
-
Method Detail
-
getString
@Nullable public String getString(String name)
Returns a string-valued configuration property.- Returns:
- null if the property has not been configured.
-
getInt
@Nullable public Integer getInt(String name)
Returns a integer-valued configuration property.- Returns:
- null if the property has not been configured.
- Throws:
NumberFormatException- if the property is not a valid integer.
-
getLong
@Nullable public Long getLong(String name)
Returns a long-valued configuration property.- Returns:
- null if the property has not been configured.
- Throws:
NumberFormatException- if the property is not a valid long.
-
getDouble
@Nullable public Double getDouble(String name)
Returns a double-valued configuration property.- Returns:
- null if the property has not been configured.
- Throws:
NumberFormatException- if the property is not a valid double.
-
getCommaSeparatedValues
public List<String> getCommaSeparatedValues(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.
-
getDuration
@Nullable public Duration getDuration(String name)
Returns 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.
- Parameters:
name- The property name- Returns:
- the
Durationvalue of the property,nullif the property cannot be found. - Throws:
ConfigurationException- for malformed duration strings.
-
getCommaSeparatedMap
public Map<String,String> getCommaSeparatedMap(String name)
Returns a map-valued 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=localhostEmpty values will be removed.- Returns:
- an empty list if the property has not been configured.
-
getBoolean
public boolean getBoolean(String name)
Returns a boolean-valued configuration property. Uses the same rules asBoolean.parseBoolean(String)for handling the values.- Returns:
- false if the property has not been configured.
-
-