Skip to content

Split out defaultBehavior and nullBehavior from description in the meta schema#357

Closed
jack-berg wants to merge 6 commits intoopen-telemetry:mainfrom
jack-berg:meta-schema-default-behavior
Closed

Split out defaultBehavior and nullBehavior from description in the meta schema#357
jack-berg wants to merge 6 commits intoopen-telemetry:mainfrom
jack-berg:meta-schema-default-behavior

Conversation

@jack-berg
Copy link
Copy Markdown
Member

Currently, all the semantics of properties are bundled up in the [].properties[].description field of meta_schema_types.yaml. This includes a terse description, various details about allowable values and semantics, and default behavior.

We schema modeling guidance which states that the description MUST include details about the semantics when the property is omitted / null.

These details are an important part of the stability contract and for ensuring consistency across language implementations.

However, enforcement of this guidance is very difficult / error prone, and as we'll see in this PR, there are many instances where we have failed to provide those details.

This PR adds two new fields to the meta schema:

  • defaultBehavior describes the behavior when a property is omitted (and in some cases when it is null). Build tooling enforces that this field is present if a property is not required, and that the field is not present if a property is required.
  • nullBehavior describes the behavior when a property is null (if defaultBehavior is not defined). This allows us to define separate semantics for when a field is omitted entirely vs. present but with the value set to null. Build tooling enforces that this field is present if a property is required and is nullable. It can optionally be added to any non-required field.

If approved, I will go back in a followup PR and replace all the TODO values with proper descriptions.

Ironing out these semantics now will help ensure we have a more robust first stable release.

@jack-berg jack-berg requested a review from a team as a code owner October 31, 2025 15:57
Comment thread CONTRIBUTING.md
- property: otlp_http
description: Configure exporter to be OTLP with HTTP transport.
defaultBehavior: OTLP HTTP exporter is not used
nullBehavior: OTLP HTTP exporter is used with defaults
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example illustrates a case where both defaultBehavior and nullBehavior are needed.

The common case is to define only defaultBehavior, which describes semantics when the field is EITHER omitted or null.

Comment thread examples/sdk-config.yaml Outdated
# If omitted, always_on is used.
root:
# Configure sampler to be always_on.
# If omitted, ignore.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments are useful and precise, but starting to seem overly verbose. Perhaps in a followup PR, we strip the example comments down to something more terse, and save the details for schema-docs.md.

@jack-berg
Copy link
Copy Markdown
Member Author

Superseded by #426.

@jack-berg jack-berg closed this Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant