Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
347b8f4
Prepare breadcrumb tests
denrase Sep 19, 2023
12f0b6d
Merge branch 'main' into feat/database-breadcrumbs
denrase Sep 25, 2023
6de44bb
create breadcrumbs for batch operations
denrase Sep 25, 2023
bd9a135
add breadcrumbs to sentry database & executor
denrase Sep 25, 2023
2e6d025
create breadcrumb when opening db
denrase Sep 25, 2023
b7a2fbc
create breadcrumb in SentrySqfliteDatabaseFactory
denrase Sep 25, 2023
86d796e
choose correct breadcrumb in batch tests
denrase Sep 26, 2023
cfc7715
set additional error info in batch
denrase Sep 26, 2023
98ee0af
set query and error breadcrumb type
denrase Sep 26, 2023
a38cfd5
update in sqflite and database factory
denrase Sep 26, 2023
932ca1c
Merge branch 'main' into feat/database-breadcrumbs
denrase Sep 26, 2023
aa66f4a
run format
denrase Sep 26, 2023
0382383
add changelog entries
denrase Sep 26, 2023
2778594
bump ios im runtime
denrase Sep 26, 2023
9978a74
manually set deployemtn target for pods
denrase Oct 3, 2023
26a77fc
Merge branch 'main' into feat/database-breadcrumbs
denrase Oct 17, 2023
788364d
Change status value
denrase Oct 17, 2023
e58a4d8
Merge branch 'main' into feat/database-breadcrumbs
denrase Oct 24, 2023
af3d295
change breadcrumb type and level
denrase Oct 24, 2023
1a5d4e3
remove duplicated lines
denrase Oct 24, 2023
aaf22b4
set type query to success breadcrumbs
denrase Oct 24, 2023
24f79d4
Merge branch 'main' into feat/database-breadcrumbs
denrase Oct 30, 2023
73d740a
fix changelog
denrase Oct 30, 2023
2c353b2
remove remaining error level
denrase Oct 31, 2023
6830e50
Merge branch 'main' into feat/database-breadcrumbs
denrase Oct 31, 2023
a20d194
fix changelog
denrase Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Prepare breadcrumb tests
  • Loading branch information
denrase committed Sep 19, 2023
commit 347b8f41787fb94f35333cb740b7354f77ba7c5a
6 changes: 6 additions & 0 deletions sqflite/lib/src/sentry_batch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class SentryBatch implements Batch {
rethrow;
} finally {
await span?.finish();
await _hub.scope.addBreadcrumb(
Breadcrumb(),
);
}
});
}
Expand Down Expand Up @@ -111,6 +114,9 @@ class SentryBatch implements Batch {
rethrow;
} finally {
await span?.finish();
await _hub.scope.addBreadcrumb(
Breadcrumb(),
);
}
});
}
Expand Down
129 changes: 93 additions & 36 deletions sqflite/test/mocks/mocks.mocks.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// Mocks generated by Mockito 5.4.0 from annotations
// Mocks generated by Mockito 5.4.2 from annotations
// in sentry_sqflite/test/mocks/mocks.dart.
// Do not manually edit this file.

// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'dart:async' as _i4;

import 'package:mockito/mockito.dart' as _i1;
import 'package:mockito/src/dummies.dart' as _i7;
import 'package:sentry/sentry.dart' as _i2;
import 'package:sentry/src/sentry_tracer.dart' as _i5;
import 'package:sqflite_common/sql.dart' as _i6;
import 'package:sqflite_common/sqlite_api.dart' as _i3;

import 'mocks.dart' as _i7;
import 'mocks.dart' as _i8;

// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values
Expand Down Expand Up @@ -76,7 +77,7 @@ class _FakeDatabase_4 extends _i1.SmartFake implements _i3.Database {
);
}

class _FakeFuture_5<T> extends _i1.SmartFake implements _i4.Future<T> {
class _FakeFuture_5<T1> extends _i1.SmartFake implements _i4.Future<T1> {
_FakeFuture_5(
Object parent,
Invocation parentInvocation,
Expand Down Expand Up @@ -126,8 +127,18 @@ class _FakeSentryId_9 extends _i1.SmartFake implements _i2.SentryId {
);
}

class _FakeHub_10 extends _i1.SmartFake implements _i2.Hub {
_FakeHub_10(
class _FakeScope_10 extends _i1.SmartFake implements _i2.Scope {
_FakeScope_10(
Object parent,
Invocation parentInvocation,
) : super(
parent,
parentInvocation,
);
}

class _FakeHub_11 extends _i1.SmartFake implements _i2.Hub {
_FakeHub_11(
Object parent,
Invocation parentInvocation,
) : super(
Expand Down Expand Up @@ -666,14 +677,25 @@ class MockDatabase extends _i1.Mock implements _i3.Database {
[action],
{#exclusive: exclusive},
),
returnValue: _FakeFuture_5<T>(
this,
Invocation.method(
#transaction,
[action],
{#exclusive: exclusive},
),
),
returnValue: _i7.ifNotNull(
_i7.dummyValueOrNull<T>(
this,
Invocation.method(
#transaction,
[action],
{#exclusive: exclusive},
),
),
(T v) => _i4.Future<T>.value(v),
) ??
_FakeFuture_5<T>(
this,
Invocation.method(
#transaction,
[action],
{#exclusive: exclusive},
),
),
) as _i4.Future<T>);
@override
_i4.Future<T> devInvokeMethod<T>(
Expand All @@ -688,16 +710,29 @@ class MockDatabase extends _i1.Mock implements _i3.Database {
arguments,
],
),
returnValue: _FakeFuture_5<T>(
this,
Invocation.method(
#devInvokeMethod,
[
method,
arguments,
],
),
),
returnValue: _i7.ifNotNull(
_i7.dummyValueOrNull<T>(
this,
Invocation.method(
#devInvokeMethod,
[
method,
arguments,
],
),
),
(T v) => _i4.Future<T>.value(v),
) ??
_FakeFuture_5<T>(
this,
Invocation.method(
#devInvokeMethod,
[
method,
arguments,
],
),
),
) as _i4.Future<T>);
@override
_i4.Future<T> devInvokeSqlMethod<T>(
Expand All @@ -714,17 +749,31 @@ class MockDatabase extends _i1.Mock implements _i3.Database {
arguments,
],
),
returnValue: _FakeFuture_5<T>(
this,
Invocation.method(
#devInvokeSqlMethod,
[
method,
sql,
arguments,
],
),
),
returnValue: _i7.ifNotNull(
_i7.dummyValueOrNull<T>(
this,
Invocation.method(
#devInvokeSqlMethod,
[
method,
sql,
arguments,
],
),
),
(T v) => _i4.Future<T>.value(v),
) ??
_FakeFuture_5<T>(
this,
Invocation.method(
#devInvokeSqlMethod,
[
method,
sql,
arguments,
],
),
),
) as _i4.Future<T>);
@override
_i4.Future<void> execute(
Expand Down Expand Up @@ -1300,6 +1349,14 @@ class MockHub extends _i1.Mock implements _i2.Hub {
),
) as _i2.SentryId);
@override
_i2.Scope get scope => (super.noSuchMethod(
Invocation.getter(#scope),
returnValue: _FakeScope_10(
this,
Invocation.getter(#scope),
),
) as _i2.Scope);
@override
_i4.Future<_i2.SentryId> captureEvent(
_i2.SentryEvent? event, {
dynamic stackTrace,
Expand Down Expand Up @@ -1433,7 +1490,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
#clone,
[],
),
returnValue: _FakeHub_10(
returnValue: _FakeHub_11(
this,
Invocation.method(
#clone,
Expand Down Expand Up @@ -1487,7 +1544,7 @@ class MockHub extends _i1.Mock implements _i2.Hub {
#customSamplingContext: customSamplingContext,
},
),
returnValue: _i7.startTransactionShim(
returnValue: _i8.startTransactionShim(
name,
operation,
description: description,
Expand Down
6 changes: 6 additions & 0 deletions sqflite/test/sentry_batch_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void main() {
fixture = Fixture();

when(fixture.hub.options).thenReturn(fixture.options);
when(fixture.hub.scope).thenReturn(fixture.scope);
when(fixture.hub.getSpan()).thenReturn(fixture.tracer);

// using ffi for testing on vm
Expand Down Expand Up @@ -63,6 +64,9 @@ void main() {
// ignore: invalid_use_of_internal_member
expect(span.origin, SentryTraceOrigins.autoDbSqfliteBatch);

final breadcrumb = fixture.hub.scope.breadcrumbs.first;
expect(breadcrumb, isNotNull);

await db.close();
});

Expand Down Expand Up @@ -334,6 +338,7 @@ SELECT * FROM Product''';
fixture = Fixture();

when(fixture.hub.options).thenReturn(fixture.options);
when(fixture.hub.scope).thenReturn(fixture.scope);
when(fixture.hub.getSpan()).thenReturn(fixture.tracer);
});

Expand Down Expand Up @@ -378,6 +383,7 @@ class Fixture {
late final tracer = SentryTracer(_context, hub);
final batch = MockBatch();
final exception = Exception('error');
late final scope = Scope(options);

Future<Database> getDatabase({
double? tracesSampleRate = 1.0,
Expand Down