Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declarative config: clarify null vs empty #4269

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ release.

### SDK Configuration

- Clarify declarative configuration parse requirements for null vs empty.
([#4269](https://github.com/open-telemetry/opentelemetry-specification/pull/4269))

### Common

### Supplementary Guidelines
Expand Down
2 changes: 1 addition & 1 deletion specification/configuration/data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ results are allowed) and an error describing the parse failure to the user.

Node types MUST be interpreted after environment variable substitution takes
place. This ensures the environment string representation of boolean, integer,
or floating point fields can be properly converted to expected types.
or floating point properties can be properly converted to expected types.

It MUST NOT be possible to inject YAML structures by environment variables. For
example, see references to `INVALID_MAP_VALUE` environment variable below.
Expand Down
34 changes: 26 additions & 8 deletions specification/configuration/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,24 @@ Parse and validate a [configuration file](./data-model.md#file-based-configurati

Parse MUST perform [environment variable substitution](./data-model.md#environment-variable-substitution).

Parse MUST interpret null as equivalent to unset.
Parse MUST differentiate between properties that are missing and properties that
are present but null. For example, consider the following snippet,
noting `.meter_provider.views[0].stream.drop` is present but null:

```yaml
meter_provider:
views:
- selector:
name: some.metric.name
stream:
aggregation:
drop:
```

As a result, the view stream should be configured with the `drop` aggregation.
Note that some aggregations have additional arguments, but `drop` does not. The
user MUST not be required to specify an empty object (i.e. `drop: {}`) in these
cases.
pellared marked this conversation as resolved.
Show resolved Hide resolved
jack-berg marked this conversation as resolved.
Show resolved Hide resolved

When encountering a reference to
a [SDK extension component](#sdk-extension-components) which is not built in to
Expand Down Expand Up @@ -212,14 +229,15 @@ Interpret configuration model and return SDK components.
The multiple responses MAY be returned using a tuple, or some other data
structure encapsulating the components.

If a field is null or unset and a default value is defined, Create MUST ensure
the SDK component is configured with the default value. If a field is null or
unset and no default value is defined, Create SHOULD return an error. For
example, if configuring
If a property has a default value defined (i.e. is _not_ required) and is
missing or present but null, Create MUST ensure the SDK component is configured
with the default value. If a property is required and is missing or present but
null, Create SHOULD return an error. For example, if configuring
the [span batching processor](../trace/sdk.md#batching-processor) and
the `scheduleDelayMillis` field is null or unset, the component is configured
with the default value of `5000`. However, if the `exporter` field is null or
unset, Create fails fast since there is no default value for `exporter`.
the `scheduleDelayMillis` property is missing or present but null, the component
is configured with the default value of `5000`. However, if the `exporter`
property is missing or present but null, Create fails fast since there is no
default value for `exporter`.

When encountering a reference to
a [SDK extension component](#sdk-extension-components) which is not built in to
Expand Down
Loading