Skip to content

Commit

Permalink
Allow disabling app hang monitoring in ObjC API
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnm committed Jun 18, 2024
1 parent 1563925 commit 7f66da3
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

1 comment on commit 7f66da3

@mariedm
Copy link
Member

Choose a reason for hiding this comment

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

👌

Please sign in to comment.