Skip to content

Commit ed0f7e9

Browse files
Hongyan JiangGitHub Enterprise
authored andcommitted
Default configuration update for performance monitoring (#81)
1 parent 2fe7c2f commit ed0f7e9

File tree

10 files changed

+26
-21
lines changed

10 files changed

+26
-21
lines changed

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 1.9.0
4+
- enable app launch time monitoring by default, other performance monitoring off
5+
36
## 1.8.9
47
- fix pod lib lint error
58

Dev/InstanaAgentExample/AppDelegate.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2929
// options.debugAllScreenNames = true
3030
options.queryTrackedDomainList = queryTrackedDomainList
3131
// options.dropBeaconReporting = true
32-
// options.perfConfig = InstanaPerformanceConfig(enableAnrReport: true, anrThreshold: 5.0)
32+
// options.rateLimits = .MID_LIMITS
33+
// options.perfConfig = InstanaPerformanceConfig(enableAnrReport: true, anrThreshold: 5.0, enableLowMemoryReport: true)
3334
if !Instana.setup(key: InstanaKey, reportingURL: InstanaURL, options: options) {
3435
os_log("Instana setup failed", log: myLog, type: .error)
3536
}

InstanaAgent.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "InstanaAgent"
19-
s.version = "1.8.9"
19+
s.version = "1.9.0"
2020
s.summary = "Instana iOS agent."
2121

2222
# This description is used to generate tags and improve search results.

Sources/InstanaAgent/Configuration/InstanaConfiguraton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class InstanaConfiguration {
9999
self.httpCaptureConfig = httpCaptureConfig
100100
monitorTypes = MonitorTypes.current
101101
// Performance monitor
102-
if perfConfig?.enableAppStartTimeReport == true {
102+
if perfConfig?.enableAppStartTimeReport != false {
103103
monitorTypes.insert(.appLaunchTime)
104104
}
105105
if perfConfig?.enableLowMemoryReport == true {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
struct VersionConfig {
2-
static let agentVersion = "1.8.9"
2+
static let agentVersion = "1.9.0"
33
}

Sources/InstanaAgent/InstanaSetupOptions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ import Foundation
7272
var enableAppStartTimeReport: Bool = true
7373
var enableAnrReport: Bool = false
7474
var anrThreshold: Double = 3.0 // in seconds
75-
var enableLowMemoryReport: Bool = true
75+
var enableLowMemoryReport: Bool = false
7676

7777
@objc public
78-
init(enableAppStartTimeReport: Bool = false, enableAnrReport: Bool = true,
79-
anrThreshold: Double = 3.0, enableLowMemoryReport: Bool = true) {
78+
init(enableAppStartTimeReport: Bool = true, enableAnrReport: Bool = true,
79+
anrThreshold: Double = 3.0, enableLowMemoryReport: Bool = false) {
8080
self.enableAppStartTimeReport = enableAppStartTimeReport
8181
self.enableAnrReport = enableAnrReport
8282
self.anrThreshold = anrThreshold

Tests/InstanaAgentTests/Configuration/InstanaConfigurationTests.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class InstanaConfigurationTests: InstanaTestCase {
2121
AssertTrue(config.maxRetries == 3)
2222
AssertTrue(config.preQueueUsageTime == 2)
2323
AssertTrue(config.reporterSendLowBatteryDebounce == 10)
24-
AssertTrue(config.monitorTypes.count == 2)
24+
AssertTrue(config.monitorTypes.count == 3)
2525
AssertTrue(config.monitorTypes.contains(.http))
2626
AssertTrue(config.reporterRateLimits.count == 2)
2727
AssertTrue(config.reporterRateLimits.first?.maxItems == 20)
@@ -88,4 +88,13 @@ class InstanaConfigurationTests: InstanaTestCase {
8888
AssertEqualAndNotNil(limiter.timeout, 60 * 5)
8989
AssertEqualAndNotNil(limiter.maxItems, 2500)
9090
}
91+
92+
func test_performance_default() {
93+
let config = InstanaConfiguration.default(key: "a",
94+
reportingURL: url,
95+
enableCrashReporting: false)
96+
AssertTrue(config.monitorTypes.contains(.appLaunchTime))
97+
AssertFalse(config.monitorTypes.contains(.memoryWarning))
98+
AssertFalse(config.monitorTypes.contains(.alertApplicationNotResponding(threshold: 3.0)))
99+
}
91100
}

Tests/InstanaAgentTests/Configuration/InstanaSystemUtilsTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class InstanaSystemUtilsTests: InstanaTestCase {
55

66
func test_AgentVersion() {
77
// Then
8-
AssertTrue(InstanaSystemUtils.agentVersion == "1.8.9")
8+
AssertTrue(InstanaSystemUtils.agentVersion == "1.9.0")
99
}
1010

1111
func test_systemVersion() {

Tests/InstanaAgentTests/InstanaSetupOptionsTest.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class InstanaPerformanceConfigTests: XCTestCase {
5656
func test_setEnableLowMemoryReport() {
5757
// Given
5858
let pfConfig = InstanaPerformanceConfig()
59-
AssertTrue(pfConfig.enableLowMemoryReport)
59+
AssertFalse(pfConfig.enableLowMemoryReport)
6060

6161
// When
6262
pfConfig.setEnableLowMemoryReport(false)
@@ -80,7 +80,7 @@ class InstanaPerformanceConfigTests: XCTestCase {
8080
AssertEqualAndNotNil(pfConfig.enableAppStartTimeReport, true)
8181
AssertEqualAndNotNil(pfConfig.enableAnrReport, false)
8282
AssertEqualAndNotNil(pfConfig.anrThreshold, 3.0)
83-
AssertEqualAndNotNil(pfConfig.enableLowMemoryReport, true)
83+
AssertEqualAndNotNil(pfConfig.enableLowMemoryReport, false)
8484
}
8585
}
8686

Tests/InstanaAgentTests/InstanaTests.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ class InstanaTests: InstanaTestCase {
112112
AssertTrue(Instana.current!.session.collectionEnabled)
113113
AssertEqualAndNotNil(Instana.sessionID, Instana.current?.session.id.uuidString)
114114
AssertEqualAndNotNil(Instana.reportingURL, reportingURL)
115+
AssertEqualAndNotNil(Instana.current?.session.configuration.key, key)
115116
AssertEqualAndNotNil(Instana.current?.session.configuration.reportingURL, reportingURL)
116117
AssertEqualAndNotNil(Instana.current?.session.configuration.httpCaptureConfig, .automatic)
117-
AssertEqualAndNotNil(Instana.current?.session.configuration,
118-
.default(key: key, reportingURL: reportingURL, enableCrashReporting: false))
118+
AssertFalse(Instana.current!.session.configuration.monitorTypes.contains(.crash))
119119
AssertEqualAndNotNil(Instana.current?.session.configuration.slowSendInterval, 0.0)
120120
AssertEqualAndNotNil(Instana.current?.session.configuration.usiRefreshTimeIntervalInHrs, defaultUsiRefreshTimeIntervalInHrs)
121121
}
@@ -174,10 +174,6 @@ class InstanaTests: InstanaTestCase {
174174
AssertEqualAndNotNil(Instana.reportingURL, reportingURL)
175175
AssertEqualAndNotNil(Instana.current?.session.configuration.reportingURL, reportingURL)
176176
AssertEqualAndNotNil(Instana.current?.session.configuration.httpCaptureConfig, .manual)
177-
AssertEqualAndNotNil(Instana.current?.session.configuration,
178-
.default(key: key, reportingURL: reportingURL,
179-
httpCaptureConfig: httpCaptureConfig,
180-
enableCrashReporting: false))
181177
}
182178

183179
func test_setup_automaticAndManual_http_capture() {
@@ -196,10 +192,6 @@ class InstanaTests: InstanaTestCase {
196192
AssertEqualAndNotNil(Instana.reportingURL, reportingURL)
197193
AssertEqualAndNotNil(Instana.current?.session.configuration.reportingURL, reportingURL)
198194
AssertEqualAndNotNil(Instana.current?.session.configuration.httpCaptureConfig, .automaticAndManual)
199-
AssertEqualAndNotNil(Instana.current?.session.configuration,
200-
.default(key: key, reportingURL: reportingURL,
201-
httpCaptureConfig: httpCaptureConfig,
202-
enableCrashReporting: false))
203195
}
204196

205197
func test_setup_and_expect_SessionProfileBeacon() {

0 commit comments

Comments
 (0)