### Motivation:
In the previous PR, we noticed that these warnings seem to discourage
explicit dependency injection, but it's not clear why we should be
discouraging it.
### Modifications:
Removed the warning.
### Result:
N/A
### Motivation:
To allow for things like parallel testing, it'd be useful if we can
explicitly provide a MetricsFactory to the existing Counter/... types.
### Modifications:
Added a `factory: MetricsFactory` parameter to all the initializers of
Counter/... types, and kept the existing methods that continue to
default to `MetricsSystem.factory`.
### Result:
Adopters can use a custom MetricsFactory explicitly passed in at metric
creation time. Existing adopters are not affected, unless you opt in,
you continue to use the global factory.
Motivation:
Swift 6.1 has been released, we should add it to our CI coverage.
Modifications:
Add additional Swift 6.1 jobs where appropriate in main.yml,
pull_request.yml
Result:
Improved test coverage.
Motivation:
* Improve test coverage
Modifications:
Enable macOS CI to be run on pull request commits and make the use of
the nightly runner pool for main.yml jobs explicit.
Result:
Improved test coverage.
Motivation:
* Improve test coverage
* Check test pass/fail status
* Monitor CI throughput
Modifications:
Enable macOS CI to be run on all merges to main and on a daily timer.
Result:
Improved test coverage run out-of-band at the moment so we can get a
feeling for if any changes need to be made in the repo or in the CI
pipelines to ensure timely and stable checks.
Specifically Swift 5.10 on Intel on Ubuntu Noble (24.04) has a crazy bug
which leads to compilation failures in a #if compiler(>=6.0) block:
swiftlang/swift#79285 .
This workaround fixes the compilation by changing the whitespace.
Fixes https://github.com/apple/swift-metrics/issues/166
# Motivation
This PR supersedes https://github.com/apple/swift-metrics/pull/135. The
goal is to make it easier to measure asynchronous code when using
`Metrics`.
# Modification
This PR does:
- Deprecate the current static method for measuring synchronous code
- Add a new instance method to measure synchronous code
- Add a new instance method to measure asynchronous code
Our README claims we support 4 metric types, and then lists five. But it
fails to list FloatingPointCounter, which we also support, so the real
number is six.
While I was here I also fixed the DocC topic, which omitted
FloatingPointCounter from the list of metrics but _also_ omitted Gauge
for some weird reason.
This PR makes the single `import Android` addition that is needed to get
this package building for Android. `skip android test` passes against
the emulator after I made this one change.
Enable MemberImportVisibility check on all targets. Use a standard
string header and footer to bracket the new block for ease of updating
in the future with scripts.
Motivation:
It's consistant with support policy (see https://github.com/apple/swift-metrics/pull/141).
It matches what's being tested.
It will make future changes adopting new features easier.
Modifications:
Bump swift tools version to 5.8
Remove linux tests and test discovery flag which are not required.
Result:
Will not longer build using swift before 5.8 - older compilers will find older
versions of this library when resolving versions.
* Update API breakage CI script
* restate sendable conformance to avoid warning/as-error
---------
Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
# Motivation
Most of the server ecosystem follows the supported Swift versions from `swift-nio`. This means supporting the latest 3 Swift releases.
# Modification
This PR drops support for all Swift versions before 5.8.
# Result
This makes maintaining this repository easier and allows us to clean up some no longer needed stuff.
Motivation:
`Duration` is available starting Swift 5.7, and we
should probably support it in our convinience API.
Modifications:
- Timer.record(_ duration: Duration) implementation
- A unit test case
- Generated Linux tests
motivation: expose increment and decrement public APIs
changes:
* add increment and decrement public API to Meter
* improve the implementation of AccumulatingMeter and TestMeter
* add tests for new APIs
* refactor/modernize other tests
motivation: seperate gauge from recorder in a backwards compatible way
changes:
* add new meter and meter handler pair
* add increment and decrement to meter handler
* add default implementation based on recorder for backwards compatibility
* add and adjust tests
* +docc prepare for docc publishing
* fix test discovery on 5.5 and 5.6
* Delete Package@swift-5.6.swift
* Update Package.swift
* Apply suggestions from code review
Co-authored-by: Yim Lee <yim_lee@apple.com>
Co-authored-by: Yim Lee <yim_lee@apple.com>
motivation: adjust to swift 5.6
changes:
* define sendable shims for protocols and structs that may be used in async context
* refactor Gauge to include rather than inherit Recorder
* adjust tests
* add a test to make sure no warning are emitted
motivation: prepare for sendable checks (they dont work well with static state)
changes:
* abstract the MetricsSystem state into a "boxed" class that handles the locking
* adjust call sites