Skip to content

Commit 2d5c5c2

Browse files
Removing MeterPayloadProvider
1 parent 9481f6b commit 2d5c5c2

File tree

6 files changed

+29
-278
lines changed

6 files changed

+29
-278
lines changed

Package.swift

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version: 5.9
22

33
import PackageDescription
44

55
let package = Package(
66
name: "Meter",
7-
platforms: [.macOS(.v10_13), .iOS(.v12), .tvOS(.v12), .watchOS(.v3)],
7+
platforms: [
8+
.macOS(.v10_13),
9+
.iOS(.v12),
10+
.tvOS(.v12),
11+
.watchOS(.v4),
12+
.visionOS(.v1),
13+
],
814
products: [
915
.library(name: "Meter", targets: ["Meter"]),
1016
],
1117
dependencies: [],
1218
targets: [
1319
.target(name: "BinaryImage", publicHeadersPath: "."),
1420
.target(name: "Meter", dependencies: ["BinaryImage"]),
15-
.testTarget(name: "MeterTests",
16-
dependencies: ["Meter"],
17-
resources: [
18-
.copy("Resources"),
19-
]),
20-
.testTarget(name: "BinaryImageTests",
21-
dependencies: ["BinaryImage"]),
21+
.testTarget(
22+
name: "MeterTests",
23+
dependencies: ["Meter"],
24+
resources: [
25+
.copy("Resources"),
26+
]
27+
),
28+
.testTarget(
29+
name: "BinaryImageTests",
30+
dependencies: ["BinaryImage"]
31+
),
2232
]
2333
)
34+
35+
let swiftSettings: [SwiftSetting] = [
36+
.enableExperimentalFeature("StrictConcurrency")
37+
]
38+
39+
for target in package.targets {
40+
var settings = target.swiftSettings ?? []
41+
settings.append(contentsOf: swiftSettings)
42+
target.swiftSettings = settings
43+
}

README.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,6 @@ As of iOS 17, macOS 14, visionOS 1.0, MetricKit does capture uncaught [NSExcepti
4747

4848
How you actually get access to the `NSException` is not defined by Meter. But, if you have one, the `CrashDiagnostic` type also includes an `exceptionInfo` property that can accept one of these for easy encoding.
4949

50-
## MXMetricManager and Diagnostics Polyfill
51-
52-
MetricKit's crash reporting facilities require iOS 14/macOS 12.0, and isn't supported at all for tvOS or watchOS. You may want to start moving towards using it as a standard interface between your app and whatever system consumes the data. Meter offers an API that's very similar to MetricKit's `MXMetricManager` to help do just that.
53-
54-
```swift
55-
// adding a subscriber
56-
MeterPayloadManager.shared.add(obj)
57-
58-
extension MyObject: MeterPayloadSubscriber {
59-
func didReceive(_ payloads: [DiagnosticPayloadProtocol]) {
60-
// this will be called for both simulated payloads *and* MeterKit payloads on OSes it supports
61-
print("received payloads \(payloads)")
62-
}
63-
}
64-
65-
// posting diagnostics
66-
MeterPayloadManager.shared.deliver(payloads)
67-
```
68-
69-
This makes it easier to support the full capabilities of MetricKit when available, and gracefully degrade when they aren't. It can be nice to have a uniform interface to whatever backend system you are using to consume the reports. And, as you move towards a supported minimum, and as (hopefully) Apple starts supporting MetricKit on all platforms, it will be easier to pull out Meter altogether.
70-
71-
Backwards compatibility is still up to you, though. One solution is [ImpactMeterAdapter](https://github.com/ChimeHQ/ImpactMeterAdapter), which uses [Impact](https://github.com/ChimeHQ/Impact) to collect crash data for OSes that don't support `MXCrashDiagnostic`.
72-
7350
## On-Device Symbolication
7451

7552
The stack traces provided by MetricKit, like other types of crash logs, are not symbolicated. There are a bunch of different ways to tackle this problem, but one very convenient option is just to do it as a post-processing step on the device where the crash occurred. This does come, however, with one major drawback. It only works when you still have access to the same binaries. OS updates will almost certainly change all the OS binaries. The same is true for an app update, though in that case, an off-line symbolication step using a dSYM is still doable.

Sources/Meter/CallStackTree.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,7 @@ public class CallStackTree: Codable {
123123
}
124124

125125
#if canImport(MetricKit)
126-
#if compiler(>=5.9)
127126
@available(iOS 14.0, macOS 12.0, visionOS 1.0, *)
128-
#else
129-
@available(iOS 14.0, macOS 12.0, *)
130-
#endif
131127
@available(tvOS, unavailable)
132128
@available(watchOS, unavailable)
133129
public static func from(callStackTree: MXCallStackTree) throws -> CallStackTree {

Sources/Meter/DiagnosticPayload.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ public class DiagnosticPayload: Codable {
6060
}
6161

6262
#if canImport(MetricKit)
63-
#if compiler(>=5.9)
6463
@available(iOS 14.0, macOS 12.0, visionOS 1.0, *)
65-
#else
66-
@available(iOS 14.0, macOS 12.0, *)
67-
#endif
6864
@available(tvOS, unavailable)
6965
@available(watchOS, unavailable)
7066
public static func from(payload: MXDiagnosticPayload) throws -> DiagnosticPayload {
@@ -119,11 +115,7 @@ public extension DiagnosticPayload {
119115
}
120116

121117
#if canImport(MetricKit)
122-
#if compiler(>=5.9)
123118
@available(iOS 14.0, macOS 12.0, visionOS 1.0, *)
124-
#else
125-
@available(iOS 14.0, macOS 12.0, *)
126-
#endif
127119
@available(tvOS, unavailable)
128120
@available(watchOS, unavailable)
129121
public extension MXDiagnosticPayload {

Sources/Meter/MeterPayloadProvider.swift

Lines changed: 0 additions & 144 deletions
This file was deleted.

Tests/MeterTests/PayloadProviderTests.swift

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)