Background
Support for substituting environment variables as attribute values is needed.
See: configuration/data-model/#environment-variable-substitution).
The common example is to set service.name from OTEL_SERVICE_NAME as below.
resource:
attributes:
- name: service.name
value: ${OTEL_SERVICE_NAME}
detection/development:
detectors:
- my_detector:
The AttributeNameValue nullBehavior is to ignore unset/null values. This means if OTEL_SERVICE_NAME is not set then the parser must ignore the service.name attribute in resource.attributes.
For example: In this configuration if my_detector sets service.name and OTEL_SERVICE_NAME is also set then the attribute value from the detector is overridden with the value from OTEL_SERVICE_NAME. If the env var is not set then the attribute from the detector must be used.
Scope:
- Add environment variable substitution support for all attribute value types to the YAML parser along with support for null value detection.
- Update the ConfigurationParser and SdkBuilder to only set attrbutes that have non-null values.
- Add unit tests for parsing all attribute value types and a programmatic test for the above use case
Background
Support for substituting environment variables as attribute values is needed.
See: configuration/data-model/#environment-variable-substitution).
The common example is to set
service.namefromOTEL_SERVICE_NAMEas below.The AttributeNameValue nullBehavior is to ignore unset/null values. This means if
OTEL_SERVICE_NAMEis not set then the parser must ignore theservice.nameattribute inresource.attributes.For example: In this configuration if
my_detectorsetsservice.nameandOTEL_SERVICE_NAMEis also set then the attribute value from the detector is overridden with the value fromOTEL_SERVICE_NAME. If the env var is not set then the attribute from the detector must be used.Scope: