feat(semconv): autoload namespaces so a single require exposes all constants#2204
Open
bdewater-thatch wants to merge 2 commits into
Open
feat(semconv): autoload namespaces so a single require exposes all constants#2204bdewater-thatch wants to merge 2 commits into
bdewater-thatch wants to merge 2 commits into
Conversation
…nstants Consuming apps previously had to require each SemConv namespace by hand (`require 'opentelemetry/semconv/http'`, ...), which got verbose. Register every stable and incubating namespace with Ruby's `autoload` instead, so a single `require 'opentelemetry-semantic_conventions'` makes them all referenceable while still loading a namespace's file only on first use -- preserving the goal of not pulling in constants an app never touches. - Generate lib/opentelemetry/semconv.rb (autoload manifest) via a new `generate_autoload_manifest` Rake task wired into `rake generate`; it reads the existing rollup files, so it needs no Docker/weaver. - Require the manifest from the gem entrypoint. Backward compatible: manual per-namespace requires and the legacy SemanticConventions path still work. - Document the single-require pattern in the README. - Add tests covering lazy loading (in a clean subprocess) and a drift guard asserting every generated rollup has an autoload entry.
efb0ce7 to
535aa72
Compare
mwear
approved these changes
Jun 26, 2026
kaylareopelle
approved these changes
Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consuming apps previously had to require each SemConv namespace by hand (
require 'opentelemetry/semconv/http'), which got verbose. This PR registers every stable and incubating namespace with Ruby'sautoloadinstead, so a singlerequire 'opentelemetry-semantic_conventions'makes them all referenceable while still loading a namespace's file only on first use, preserving the goal of not pulling in constants an app never touches.