Skip to content

fix(config): parse nullable objects without properties as present - #2465

Merged
kaylareopelle merged 5 commits into
open-telemetry:mainfrom
mwear:config-nullable-objects
Oct 20, 2026
Merged

kaylareopelle merged 5 commits into
open-telemetry:mainfrom
mwear:config-nullable-objects

Conversation

@mwear

@mwear mwear commented Oct 15, 2026

Copy link
Copy Markdown
Member

Description

Related to #2127

Several schema objects are typed ["object", "null"], meaning they can appear in a config file without any properties, e.g. otlp_http: or trace_id_ratio_based:. The generated constants treat these as absent when they have no properties, so the configured component is dropped. For example, trace_id_ratio_based: silently falls back to the default parent_based sampler, and otlp_http: fails with "no valid span exporter".

This updates the generator to parse these as present with default values and regenerates the constants.

While I was at it, I fixed two issues that prevented a clean regeneration. The task was writing to lib/opentelemetry/constants/ instead of lib/opentelemetry/config/, and it emitted h.reject where the checked-in file uses h.except. With these fixes, regenerating against v1.0.0-rc.3 reproduces the checked-in file, aside from the nullable object changes.

Changes

  • Write generated constants to lib/opentelemetry/config/generated_constants.rb
  • Emit Hash#except for additional_properties
  • Parse nullable objects without properties as present with defaults, and regenerate the constants

Authorship

  • I, a human, wrote this pull request description myself.

Comment thread config/test/opentelemetry/config/generated_constants_test.rb
Comment thread config/lib/tasks/generate_constants.rake Outdated
@mwear mwear mentioned this pull request Oct 20, 2026
@kaylareopelle
kaylareopelle merged commit e49ffba into open-telemetry:main Oct 20, 2026
71 checks passed
@otelbot-ruby otelbot-ruby Bot mentioned this pull request Oct 20, 2026
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.

2 participants