open-telemetry / open-telemetry/opentelemetry-ruby
Add `attributes` support to LoggerProvider#logger
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 606
- Forks
- 301
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 42
Description
Spec requirement
Get a Logger MUST be structured to accept a variable number of instrumentation-scope attributes, including none (api.md:86-91).
Current behavior
Neither the no-op LoggerProvider#logger (logs_api/lib/opentelemetry/logs/logger_provider.rb:20 (permalink)) nor the SDK's version of the method (logs_sdk/lib/opentelemetry/sdk/logs/logger_provider.rb:44 (permalink)) accept an attributes parameter. logs_sdk/lib/opentelemetry/sdk/logs/logger.rb:25 (permalink) builds InstrumentationScope.new(name, version) without a slot to receive either.
The InstrumentationScope class sdk/lib/opentelemetry/sdk/instrumentation_scope.rb (permalink) has been recently updated to accept attributes and these improvements should be included in logs.
Suggested fix
Add attributes: keyword param to both LoggerProvider#logger implementations. See PR #2273 for how Metrics added this keyword.
Related rows in SPEC_COMPLIANCE_LOGS.md
API-6, NOOP-2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with logs_api/lib/opentelemetry/logs/logger_provider.rb:20 and logs_sdk/lib/opentelemetry/sdk/logs/logger_provider.rb:44, then inspect logs_sdk/lib/opentelemetry/sdk/logs/logger.rb:25 and the updated InstrumentationScope class. Review PR #2273 for the Metrics pattern. Done means both logger methods accept optional attributes and the SDK passes them into InstrumentationScope, covering API-6 and NOOP-2.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100