Skip to content

Commit

Permalink
Use recordHttpBreadcrumbs to set iOS enableNetworkBreadcrumbs (#1884
Browse files Browse the repository at this point in the history
)
  • Loading branch information
denrase authored Mar 4, 2024
1 parent f754e86 commit e964e2b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Features

- Use `recordHttpBreadcrumbs` to set iOS `enableNetworkBreadcrumbs` ([#1884](https://github.com/getsentry/sentry-dart/pull/1884))

## 7.16.1

### Fixes
Expand Down
6 changes: 4 additions & 2 deletions dart/lib/src/sentry_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ class SentryOptions {
/// - In an browser environment this can be requests which fail because of CORS.
/// - In an mobile or desktop application this can be requests which failed
/// because the connection was interrupted.
/// Use with [SentryHttpClient] or `sentry_dio` integration for this to work
/// Use with [SentryHttpClient] or `sentry_dio` integration for this to work,
/// or iOS native where it sets the value to `enableCaptureFailedRequests`.
bool captureFailedRequests = true;

/// Whether to records requests as breadcrumbs. This is on by default.
/// It only has an effect when the SentryHttpClient or dio integration is in use
/// It only has an effect when the SentryHttpClient or dio integration is in
/// use, or iOS native where it sets the value to `enableNetworkBreadcrumbs`.
bool recordHttpBreadcrumbs = true;

/// Whether [SentryEvent] deduplication is enabled.
Expand Down
2 changes: 2 additions & 0 deletions flutter/example/ios/RunnerTests/SentryFlutterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ final class SentryFlutterTests: XCTestCase {
"enableWatchdogTerminationTracking": false,
"sendClientReports": false,
"maxAttachmentSize": NSNumber(value: 9004),
"recordHttpBreadcrumbs": false,
"captureFailedRequests": false,
"enableAppHangTracking": false,
"appHangTimeoutIntervalMillis": NSNumber(value: 10000)
Expand All @@ -65,6 +66,7 @@ final class SentryFlutterTests: XCTestCase {
XCTAssertEqual(false, fixture.options.enableWatchdogTerminationTracking)
XCTAssertEqual(false, fixture.options.sendClientReports)
XCTAssertEqual(9004, fixture.options.maxAttachmentSize)
XCTAssertEqual(false, fixture.options.enableNetworkBreadcrumbs)
XCTAssertEqual(false, fixture.options.enableCaptureFailedRequests)
XCTAssertEqual(false, fixture.options.enableAppHangTracking)
XCTAssertEqual(10, fixture.options.appHangTimeoutInterval)
Expand Down
3 changes: 3 additions & 0 deletions flutter/ios/Classes/SentryFlutter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public final class SentryFlutter {
if let maxAttachmentSize = data["maxAttachmentSize"] as? NSNumber {
options.maxAttachmentSize = maxAttachmentSize.uintValue
}
if let recordHttpBreadcrumbs = data["recordHttpBreadcrumbs"] as? Bool {
options.enableNetworkBreadcrumbs = recordHttpBreadcrumbs
}
if let captureFailedRequests = data["captureFailedRequests"] as? Bool {
options.enableCaptureFailedRequests = captureFailedRequests
}
Expand Down
1 change: 1 addition & 0 deletions flutter/lib/src/integrations/native_sdk_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class NativeSdkIntegration implements Integration<SentryFlutterOptions> {
'sendClientReports': options.sendClientReports,
'proguardUuid': options.proguardUuid,
'maxAttachmentSize': options.maxAttachmentSize,
'recordHttpBreadcrumbs': options.recordHttpBreadcrumbs,
'captureFailedRequests': options.captureFailedRequests,
'enableAppHangTracking': options.enableAppHangTracking,
'connectionTimeoutMillis': options.connectionTimeout.inMilliseconds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void main() {
'sendClientReports': true,
'proguardUuid': null,
'maxAttachmentSize': 20 * 1024 * 1024,
'recordHttpBreadcrumbs': true,
'captureFailedRequests': true,
'enableAppHangTracking': true,
'connectionTimeoutMillis': 5000,
Expand Down Expand Up @@ -98,6 +99,7 @@ void main() {
..enableNdkScopeSync = true
..proguardUuid = fakeProguardUuid
..maxAttachmentSize = 10
..recordHttpBreadcrumbs = false
..captureFailedRequests = false
..enableAppHangTracking = false
..connectionTimeout = Duration(milliseconds: 9001)
Expand Down Expand Up @@ -141,6 +143,7 @@ void main() {
'sendClientReports': false,
'proguardUuid': fakeProguardUuid,
'maxAttachmentSize': 10,
'recordHttpBreadcrumbs': false,
'captureFailedRequests': false,
'enableAppHangTracking': false,
'connectionTimeoutMillis': 9001,
Expand Down

0 comments on commit e964e2b

Please sign in to comment.