open-telemetry / open-telemetry/opentelemetry-python-contrib
MetricReader gives transient, incorrect warnings
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
The MetricReader gives this warning in stdout:
WARNING:opentelemetry.sdk.metrics._internal.export:Cannot call collect on a MetricReader until it is registered on a MeterProvider
WARNING:opentelemetry.sdk.metrics._internal.export:Cannot call collect on a MetricReader until it is registered on a MeterProvider
However, the MetricReader is indeed registered with a MeterProvider:
OTLP_ENDPOINT=os.getenv("OTLP_ENDPOINT")
otlp_metric_reader = PeriodicExportingMetricReader(OTLPMetricExporter(endpoint=OTLP_ENDPOINT))
mprovider = MeterProvider(resource=resource, metric_readers=[otlp_metric_reader])
metrics.set_meter_provider(mprovider)
meter = metrics.get_meter("demo-meter")
latency_histogram = meter.create_histogram(
"response_time",
unit="ms",
description="Time spent in a request",
)
call_count = meter.create_counter(
"call_count",
unit="1",
description="Number of requests",
)
... # see https://github.com/open-telemetry/opentelemetry-python-contrib/issues/2075 for full setup
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 the MetricReader and MeterProvider setup shown in the issue, then compare it with issue #2075's full setup. Reproduce the two warnings and trace when collection occurs relative to registration. Done means valid registration no longer emits the reported transient warnings, with coverage for the reported setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100