Skip to content

Add concurrency tests for meter/instrument methods#4962

Open
chimchim89 wants to merge 6 commits intoopen-telemetry:mainfrom
chimchim89:test-metrics-concurrency
Open

Add concurrency tests for meter/instrument methods#4962
chimchim89 wants to merge 6 commits intoopen-telemetry:mainfrom
chimchim89:test-metrics-concurrency

Conversation

@chimchim89
Copy link
Copy Markdown
Contributor

@chimchim89 chimchim89 commented Mar 9, 2026

Description

Addresses FIXME comments in the metrics API test files that indicated concurrency tests were needed to verify that meter and instrument methods can be called concurrently safely. No production code was modified.

Added a TestConcurrency class using Python's threading module to each of the three affected test files:

  • test_instruments.py: concurrent tests for Counter.add, UpDownCounter.add, Histogram.record, and Gauge.set
  • test_meter.py: concurrent tests for Meter.create_counter, Meter.create_up_down_counter, Meter.create_observable_counter, Meter.create_histogram, Meter.create_gauge, Meter.create_observable_gauge, Meter.create_observable_up_down_counter
  • test_meter_provider.py: concurrent tests for NoOpMeterProvider.get_meter and _ProxyMeterProvider.get_meter

Type of change

This is a test-only change that adds missing concurrency tests to address existing FIXME comments. No production code was modified.

How Has This Been Tested?

pytest opentelemetry-api/tests/metrics
76 passed in 0.62s

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@chimchim89 chimchim89 requested a review from a team as a code owner March 9, 2026 08:14
Comment thread opentelemetry-api/tests/metrics/test_instruments.py Outdated
Comment thread opentelemetry-api/tests/metrics/test_meter.py Outdated
Comment thread opentelemetry-api/tests/metrics/test_meter.py
@xrmx xrmx moved this to Ready for review in Python PR digest Mar 16, 2026
@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Mar 16, 2026
@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions bot added the Stale label Mar 31, 2026
@xrmx xrmx requested a review from herin049 April 9, 2026 15:20
@github-actions github-actions bot removed the Stale label Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

3 participants