open-telemetry / open-telemetry/opentelemetry-ruby

Guard against registering one `MetricReader` on two `MeterProvider`s

Open
#2,365 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug metrics spec-compliance spec:stable
Dominant language
Ruby
Stars
606
Forks
301
Avg merge
3d 19h
Merged PRs (30d)
42

Description

Spec requirement

The SDK MUST NOT allow a MetricReader instance to be registered on more than one MeterProvider (sdk.md:1466-1494, specifically L1472).

Current behavior

Nothing in meter_provider.rb:114-122 (permalink) or export/metric_reader.rb (permalink) tracks or rejects the same MetricReader instance being passed to add_metric_reader on two different MeterProviders.

Suggested fix

Track an owning MeterProvider reference (or a simple "already registered" flag) on MetricReader, and raise/reject in add_metric_reader if the reader is already owned by a different provider.

Related rows in SPEC_COMPLIANCE_METRICS.md

SDK-54

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with meter_provider.rb:114-122 and export/metric_reader.rb, then read the linked metrics SDK specification requirement. Ensure a MetricReader cannot be registered with more than one MeterProvider, rejecting the second registration; verify the behavior against the SDK-54 requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.