Skip to content

Commit

Permalink
Merge pull request #1908 from DataDog/nogorodnikov/allow-disabling-ap…
Browse files Browse the repository at this point in the history
…p-hang-monitoring-in-objc-api

Allow disabling app hang monitoring in ObjC API
  • Loading branch information
0xnm authored Jun 18, 2024
2 parents d184aeb + 7f66da3 commit 846eda0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- [IMPROVEMENT] Allow disabling app hang monitoring in ObjC API. See [#1908][]

# 2.13.0 / 13-06-2024

- [IMPROVEMENT] Bump `IPHONEOS_DEPLOYMENT_TARGET` and `TVOS_DEPLOYMENT_TARGET` from 11 to 12. See [#1891][]
Expand Down Expand Up @@ -684,6 +686,7 @@ Release `2.0` introduces breaking changes. Follow the [Migration Guide](MIGRATIO
[#1835]: https://github.com/DataDog/dd-sdk-ios/pull/1835
[#1886]: https://github.com/DataDog/dd-sdk-ios/pull/1886
[#1898]: https://github.com/DataDog/dd-sdk-ios/pull/1898
[#1908]: https://github.com/DataDog/dd-sdk-ios/pull/1908
[@00fa9a]: https://github.com/00FA9A
[@britton-earnin]: https://github.com/Britton-Earnin
[@hengyu]: https://github.com/Hengyu
Expand Down
8 changes: 7 additions & 1 deletion DatadogCore/Tests/DatadogObjc/DDRUMConfigurationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,18 @@ class DDRUMConfigurationTests: XCTestCase {
}

func testAppHangThreshold() {
let random: TimeInterval = .mockRandom()
let random: TimeInterval = .mockRandom(min: 0.01, max: .greatestFiniteMagnitude)
objc.appHangThreshold = random
XCTAssertEqual(objc.appHangThreshold, random)
XCTAssertEqual(swift.appHangThreshold, random)
}

func testAppHangThresholdDisable() {
objc.appHangThreshold = 0
XCTAssertEqual(objc.appHangThreshold, 0)
XCTAssertEqual(swift.appHangThreshold, nil)
}

func testVitalsUpdateFrequency() {
objc.vitalsUpdateFrequency = .frequent
XCTAssertEqual(swift.vitalsUpdateFrequency, .frequent)
Expand Down
2 changes: 1 addition & 1 deletion DatadogObjc/Sources/RUM/RUM+objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public class DDRUMConfiguration: NSObject {
}

@objc public var appHangThreshold: TimeInterval {
set { swiftConfig.appHangThreshold = newValue }
set { swiftConfig.appHangThreshold = newValue == 0 ? nil : newValue }
get { swiftConfig.appHangThreshold ?? 0 }
}

Expand Down

0 comments on commit 846eda0

Please sign in to comment.