-
-
Notifications
You must be signed in to change notification settings - Fork 277
Breadcrumbs for database operations #1656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
347b8f4
12f0b6d
6de44bb
bd9a135
2e6d025
b7a2fbc
86d796e
cfc7715
98ee0af
a38cfd5
932ca1c
aa66f4a
0382383
2778594
9978a74
26a77fc
788364d
e58a4d8
af3d295
1a5d4e3
aaf22b4
24f79d4
73d740a
2c353b2
6830e50
a20d194
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,11 @@ class SentryBatch implements Batch { | |
| span?.origin = SentryTraceOrigins.autoDbSqfliteBatch; | ||
| setDatabaseAttributeData(span, _dbName); | ||
|
|
||
| final Map<String, dynamic> breadcrumbData = {}; | ||
| var breadcrumb = Breadcrumb( | ||
| message: _buffer.toString().trim(), | ||
| data: {}, | ||
| ); | ||
| setDatabaseAttributeOnBreadcrumb(breadcrumb, _dbName); | ||
|
|
||
| try { | ||
| final result = await _batch.apply( | ||
|
|
@@ -65,22 +69,23 @@ class SentryBatch implements Batch { | |
| ); | ||
|
|
||
| span?.status = SpanStatus.ok(); | ||
| breadcrumbData['status'] = 'ok'; | ||
|
|
||
| breadcrumb.data?['status'] = 'ok'; | ||
|
|
||
| return result; | ||
| } catch (exception) { | ||
| span?.throwable = exception; | ||
| span?.status = SpanStatus.internalError(); | ||
| breadcrumbData['status'] = 'internalError'; | ||
|
|
||
| breadcrumb.data?['status'] = 'internalError'; | ||
| breadcrumb = breadcrumb.copyWith( | ||
| type: 'error', | ||
|
||
| level: SentryLevel.error, | ||
| ); | ||
|
|
||
| rethrow; | ||
| } finally { | ||
| await span?.finish(); | ||
| final breadcrumb = Breadcrumb( | ||
| message: _buffer.toString().trim(), | ||
| data: breadcrumbData, | ||
| ); | ||
| setDatabaseAttributeOnBreadcrumb(breadcrumb, _dbName); | ||
| // ignore: invalid_use_of_internal_member | ||
| await _hub.scope.addBreadcrumb(breadcrumb); | ||
| } | ||
|
|
@@ -105,7 +110,11 @@ class SentryBatch implements Batch { | |
| span?.origin = SentryTraceOrigins.autoDbSqfliteBatch; | ||
| setDatabaseAttributeData(span, _dbName); | ||
|
|
||
| final Map<String, dynamic> breadcrumbData = {}; | ||
| var breadcrumb = Breadcrumb( | ||
| message: _buffer.toString().trim(), | ||
| data: {}, | ||
| ); | ||
| setDatabaseAttributeOnBreadcrumb(breadcrumb, _dbName); | ||
|
|
||
| try { | ||
| final result = await _batch.commit( | ||
|
|
@@ -115,22 +124,22 @@ class SentryBatch implements Batch { | |
| ); | ||
|
|
||
| span?.status = SpanStatus.ok(); | ||
| breadcrumbData['status'] = 'ok'; | ||
| breadcrumb.data?['status'] = 'ok'; | ||
|
|
||
| return result; | ||
| } catch (exception) { | ||
| span?.throwable = exception; | ||
| span?.status = SpanStatus.internalError(); | ||
| breadcrumbData['status'] = 'internalError'; | ||
|
|
||
| breadcrumb.data?['status'] = 'internalError'; | ||
| breadcrumb = breadcrumb.copyWith( | ||
| type: 'error', | ||
denrase marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| level: SentryLevel.error, | ||
| ); | ||
|
|
||
| rethrow; | ||
| } finally { | ||
| await span?.finish(); | ||
| final breadcrumb = Breadcrumb( | ||
| message: _buffer.toString().trim(), | ||
| data: breadcrumbData, | ||
| ); | ||
| setDatabaseAttributeOnBreadcrumb(breadcrumb, _dbName); | ||
| // ignore: invalid_use_of_internal_member | ||
| await _hub.scope.addBreadcrumb(breadcrumb); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.