Skip to content

Conversation

@david-gang
Copy link
Contributor

Description

The system metrics tests on mac are failing:

tox -e py312-test-instrumentation-system-metrics -- -ra

> self.assertEqual(sorted(metric_names), sorted(observer_names)) E AssertionError: Lists differ: ['pro[588 chars]work.dropped_packets', 'system.network.errors'[114 chars]unt'] != ['pro[588 chars]work.connections', 'system.network.dropped_pac[144 chars]unt'] E E First differing element 20: E 'system.network.dropped_packets' E 'system.network.connections' E E Second list contains 1 additional elements. E First extra element 27: E 'system.thread_count' E E Diff is 872 characters long. Set self.maxDiff to None to see it. instrumentation/opentelemetry-instrumentation-system-metrics/tests/test_system_metrics.py:141: AssertionError 

The issue is easy to understand

if sys.platform == "darwin": # see https://github.com/giampaolo/psutil/issues/1219 _DEFAULT_CONFIG.pop("system.network.connections") 

But in the unit tests this metric is still tested.
Fixes # (issue)

Type of change

Skip the check of this metric on mac
Please delete options that are not relevant.

  • [V ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Run Unit test on mac and see that everything passes

tox -e py312-test-instrumentation-system-metrics -- -ra

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • [V ] No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • [ V] Followed the style guidelines of this project
  • Changelogs have been updated - No changelog to update
  • Unit tests have been added - Just needed to skip one
  • Documentation has been updated - Nothing to update. i just skip a fix
@david-gang david-gang changed the title format Fix system metrics unit tests on mac Jul 13, 2025
Don't test for system.network.connections on mac
@david-gang david-gang force-pushed the fix_system_metrics branch from 534d3b2 to 57cdd2a Compare July 13, 2025 05:56
@xrmx xrmx moved this to Easy to review / merge / close in @xrmx's Python PR digest Jul 14, 2025
@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jul 14, 2025
Copy link
Member

@emdneto emdneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we should care about macOS since we don't even support it on CI, but it doesn't hurt to provide this skip for Mac users.

@xrmx xrmx merged commit f9453b9 into open-telemetry:main Jul 14, 2025
625 of 626 checks passed
@github-project-automation github-project-automation bot moved this from Easy to review / merge / close to Done in @xrmx's Python PR digest Jul 14, 2025
devmonkey22 pushed a commit to devmonkey22/opentelemetry-python-contrib that referenced this pull request Aug 5, 2025
* Fix system metrics unit tests on mac Don't test for system.network.connections on mac * round
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

3 participants