-
-
Notifications
You must be signed in to change notification settings - Fork 267
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 15 commits
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
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,12 @@ class SentryBatch implements Batch { | |
span?.origin = SentryTraceOrigins.autoDbSqfliteBatch; | ||
setDatabaseAttributeData(span, _dbName); | ||
|
||
var breadcrumb = Breadcrumb( | ||
message: _buffer.toString().trim(), | ||
data: {}, | ||
); | ||
setDatabaseAttributeOnBreadcrumb(breadcrumb, _dbName); | ||
|
||
try { | ||
final result = await _batch.apply( | ||
noResult: noResult, | ||
|
@@ -64,14 +70,24 @@ class SentryBatch implements Batch { | |
|
||
span?.status = SpanStatus.ok(); | ||
|
||
breadcrumb.data?['status'] = 'ok'; | ||
|
||
return result; | ||
} catch (exception) { | ||
span?.throwable = exception; | ||
span?.status = SpanStatus.internalError(); | ||
|
||
breadcrumb.data?['status'] = 'internalError'; | ||
breadcrumb = breadcrumb.copyWith( | ||
type: 'error', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. type shouldn't be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked in the documentation and error seemed appropriate, or am I missing something here? https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/#breadcrumb-types Do you have a suggestion which type to use instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my understanding is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed: the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for clearing this up! Warning seems better yes, as users might handle these. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok updated them to query. Thinking if this is also correct in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stefanosiano any thoughts on that? not sure about that here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I think it's fine, as they are still operations on the database |
||
level: SentryLevel.error, | ||
); | ||
|
||
rethrow; | ||
} finally { | ||
await span?.finish(); | ||
// ignore: invalid_use_of_internal_member | ||
await _hub.scope.addBreadcrumb(breadcrumb); | ||
} | ||
}); | ||
} | ||
|
@@ -94,6 +110,12 @@ class SentryBatch implements Batch { | |
span?.origin = SentryTraceOrigins.autoDbSqfliteBatch; | ||
setDatabaseAttributeData(span, _dbName); | ||
|
||
var breadcrumb = Breadcrumb( | ||
message: _buffer.toString().trim(), | ||
data: {}, | ||
); | ||
setDatabaseAttributeOnBreadcrumb(breadcrumb, _dbName); | ||
|
||
try { | ||
final result = await _batch.commit( | ||
exclusive: exclusive, | ||
|
@@ -102,15 +124,24 @@ class SentryBatch implements Batch { | |
); | ||
|
||
span?.status = SpanStatus.ok(); | ||
breadcrumb.data?['status'] = 'ok'; | ||
|
||
return result; | ||
} catch (exception) { | ||
span?.throwable = exception; | ||
span?.status = SpanStatus.internalError(); | ||
|
||
breadcrumb.data?['status'] = 'internalError'; | ||
breadcrumb = breadcrumb.copyWith( | ||
type: 'error', | ||
denrase marked this conversation as resolved.
Show resolved
Hide resolved
|
||
level: SentryLevel.error, | ||
); | ||
|
||
rethrow; | ||
} finally { | ||
await span?.finish(); | ||
// ignore: invalid_use_of_internal_member | ||
await _hub.scope.addBreadcrumb(breadcrumb); | ||
} | ||
}); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.