Skip to content

Implements a metrics provider for Darwin#78

Merged
kukushechkin merged 6 commits intoapple:mainfrom
barrytomasini:darwin-metrics
Dec 19, 2025
Merged

Implements a metrics provider for Darwin#78
kukushechkin merged 6 commits intoapple:mainfrom
barrytomasini:darwin-metrics

Conversation

@barrytomasini
Copy link
Copy Markdown
Contributor

This branch adds a Darwin metrics provider, using macOS system APIs.

Motivation:

Someone developing or deploying a service on macOS should be able to take advantage of the same system metrics that are available to Swift processes running on Linux. (#72)

Modifications:

  • Replaced the stub implementation for Darwin, which previously returned nil
  • Implemented unit tests for metrics like CPU time, resident memory, & open file descriptors

Result:

Feature parity between macOS and Linux for collecting system metrics.

@kukushechkin kukushechkin added this to the 1.0.0 milestone Dec 18, 2025
@kukushechkin kukushechkin added the 🆕 semver/minor Adds new public API. label Dec 18, 2025
@kukushechkin kukushechkin linked an issue Dec 18, 2025 that may be closed by this pull request
@kukushechkin
Copy link
Copy Markdown
Contributor

@barrytomasini Thanks for taking the time to work on this!

@kukushechkin
Copy link
Copy Markdown
Contributor

I think we can go with this macOS-specific implementation — add #if os(macOS) to the implementation and the corresponding tests, add a similar warning to one we had before and update the Docs that only Linux and macOS are supported. We can always add iOS/tvOS/watchOS/visionOS implementations later.

@barrytomasini
Copy link
Copy Markdown
Contributor Author

Thanks, @kukushechkin! I've restored the warning for non-macOS Darwin platforms, added a note to the doc comment, and restored the platform checks in the shared test cases. Let me know if anything else needs to be updated!

Copy link
Copy Markdown
Contributor

@kukushechkin kukushechkin left a comment

Choose a reason for hiding this comment

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

One linter error left

@kukushechkin kukushechkin merged commit 394e826 into apple:main Dec 19, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Darwin support

2 participants