Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[v9]: bump drift min version and use QueryInterceptor instead of QueryExecutor #2679

Merged
merged 34 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d43bab3
temp
buenaflor Feb 6, 2025
0c64554
update
buenaflor Feb 7, 2025
9870881
update
buenaflor Feb 10, 2025
21e2bc9
update docs
buenaflor Feb 10, 2025
93d28b2
update
buenaflor Feb 12, 2025
83dab13
Update sentry.dart
buenaflor Feb 12, 2025
4c2a339
Merge branch 'v9' into v9-task/bump-drift-and-use-interceptor
buenaflor Feb 12, 2025
14774eb
update CHANGELOG
buenaflor Feb 12, 2025
95a662f
Merge branch 'v9' into v9-task/bump-drift-and-use-interceptor
buenaflor Feb 12, 2025
7bff992
update
buenaflor Feb 13, 2025
485f2eb
fist tests
buenaflor Feb 13, 2025
4c04496
formatting
buenaflor Feb 13, 2025
7a37b9d
fix analyze
buenaflor Feb 13, 2025
fa7f0a0
fix analyze
buenaflor Feb 13, 2025
fa3a450
Merge branch 'v9' into v9-task/bump-drift-and-use-interceptor
buenaflor Feb 13, 2025
0179511
Merge branch 'v9' into v9-task/bump-drift-and-use-interceptor
buenaflor Feb 13, 2025
c7c6e0c
formatting and change integration name from to
buenaflor Feb 14, 2025
b3b1d73
improve ensureOpen instrumentation
buenaflor Feb 14, 2025
28e8693
fix hub not using hubadapter as fallback
buenaflor Feb 14, 2025
c6e6e48
update parent span
buenaflor Feb 14, 2025
2af04c5
use stack to handle parent span
buenaflor Feb 14, 2025
95bbec9
formatting
buenaflor Feb 14, 2025
5950868
Merge branch 'v9' into v9-task/bump-drift-and-use-interceptor
buenaflor Feb 14, 2025
5220270
formatting
buenaflor Feb 14, 2025
0a19ad6
fix analyze
buenaflor Feb 14, 2025
758ab6e
add disabled tracing test
buenaflor Feb 14, 2025
b131634
unused code
buenaflor Feb 14, 2025
a2d1d76
temp
buenaflor Feb 17, 2025
05827f9
update
buenaflor Feb 17, 2025
64285d3
add test
buenaflor Feb 17, 2025
9d76492
remove spotlight
buenaflor Feb 17, 2025
6e6b02d
cleanup test file
buenaflor Feb 17, 2025
1646e4d
add select query test:
buenaflor Feb 17, 2025
8b59210
removing stack in finally block
buenaflor Feb 17, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Enable JS SDK native integration by default ([#2688](https://github.com/getsentry/sentry-dart/pull/2688))
- Remove `enableTracing` ([#2695](https://github.com/getsentry/sentry-dart/pull/2695))
- Remove `options.autoAppStart` and `setAppStartEnd` ([#2680](https://github.com/getsentry/sentry-dart/pull/2680))
- Bump Drift min version to `2.24.0` and use `QueryInterceptor` instead of `QueryExecutor` ([#2679](https://github.com/getsentry/sentry-dart/pull/2679))
- Add hint for transactions ([#2675](https://github.com/getsentry/sentry-dart/pull/2675))
- `BeforeSendTransactionCallback` now has a `Hint` parameter
- Remove `dart:html` usage in favour of `package:web` ([#2710](https://github.com/getsentry/sentry-dart/pull/2710))
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export 'src/utils/http_header_utils.dart';
// ignore: invalid_export_of_internal_element
export 'src/sentry_trace_origins.dart';
// ignore: invalid_export_of_internal_element
export 'src/sentry_span_operations.dart';
export 'src/constants.dart';
// ignore: invalid_export_of_internal_element
export 'src/utils.dart';
// spotlight debugging
Expand Down
30 changes: 30 additions & 0 deletions dart/lib/src/constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:meta/meta.dart';

@internal
class SentrySpanOperations {
static const String uiLoad = 'ui.load';
static const String uiTimeToInitialDisplay = 'ui.load.initial_display';
static const String uiTimeToFullDisplay = 'ui.load.full_display';
static const String dbSqlQuery = 'db.sql.query';
static const String dbSqlTransaction = 'db.sql.transaction';
static const String dbSqlBatch = 'db.sql.batch';
static const String dbOpen = 'db.open';
static const String dbClose = 'db.close';
}

@internal
class SentrySpanData {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbd in other PR, remove SpanDataConvention and put the constants here

static const String dbSystemKey = 'db.system';
static const String dbNameKey = 'db.name';

static const String dbSystemSqlite = 'db.sqlite';
Copy link
Contributor Author

@buenaflor buenaflor Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbd in other PR, add other db systems here

}

@internal
class SentrySpanDescriptions {
static const String dbTransaction = 'Transaction';
static String dbBatch({required List<String> statements}) =>
'Batch $statements';
static String dbOpen({required String dbName}) => 'Open database $dbName';
static String dbClose({required String dbName}) => 'Close database $dbName';

Check warning on line 29 in dart/lib/src/constants.dart

View check run for this annotation

Codecov / codecov/patch

dart/lib/src/constants.dart#L26-L29

Added lines #L26 - L29 were not covered by tests
}
8 changes: 0 additions & 8 deletions dart/lib/src/sentry_span_operations.dart

This file was deleted.

4 changes: 1 addition & 3 deletions dart/lib/src/sentry_trace_origins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ class SentryTraceOrigins {
static const autoDbHiveBoxBase = 'auto.db.hive.box_base';
static const autoDbHiveLazyBox = 'auto.db.hive.lazy_box';
static const autoDbHiveBoxCollection = 'auto.db.hive.box_collection';
static const autoDbDriftQueryExecutor = 'auto.db.drift.query.executor';
static const autoDbDriftTransactionExecutor =
'auto.db.drift.transaction.executor';
static const autoDbDriftQueryInterceptor = 'auto.db.drift.query.interceptor';
static const autoUiTimeToDisplay = 'auto.ui.time_to_display';
static const manualUiTimeToDisplay = 'manual.ui.time_to_display';
}
1 change: 0 additions & 1 deletion drift/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ analyzer:
linter:
rules:
- prefer_final_locals
- public_member_api_docs
- prefer_single_quotes
- prefer_relative_imports
- unnecessary_brace_in_string_interps
Expand Down
162 changes: 162 additions & 0 deletions drift/example/database.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 34 additions & 7 deletions drift/example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,45 @@ Future<void> main() async {

Future<void> runApp() async {
final tr = Sentry.startTransaction('drift', 'op', bindToScope: true);
final executor = SentryQueryExecutor(
() => NativeDatabase.memory(),
databaseName: 'your_db_name',
final executor = NativeDatabase.memory().interceptWith(
SentryQueryInterceptor(databaseName: 'your_db_name'),
);

final db = AppDatabase(executor);

await db.into(db.todoItems).insert(
await db.transaction(() async {
await db.into(db.todoItems).insert(
TodoItemsCompanion.insert(
title: 'This is a test thing',
content: 'test',
),
);

await db.transaction(() async {
await db.into(db.todoItems).insert(
TodoItemsCompanion.insert(
title: 'This is a test thing in the tx',
content: 'test',
),
);
});

await db.batch((batch) {
batch.insertAll(db.todoItems, [
TodoItemsCompanion.insert(title: 'First entry', content: 'My content'),
TodoItemsCompanion.insert(
title: 'This is a test thing',
content: 'test',
title: 'Another entry',
content: 'More content',
),
);
]);
});
});

await db.batch((batch) async {
batch.insertAll(db.todoItems, [
TodoItemsCompanion.insert(title: 'This is a test', content: 'test'),
]);
});

final items = await db.select(db.todoItems).get();
print(items);
Expand Down
2 changes: 1 addition & 1 deletion drift/lib/sentry_drift.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
library;

export 'src/sentry_query_executor.dart';
export 'src/sentry_query_interceptor.dart';
2 changes: 2 additions & 0 deletions drift/lib/src/constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const String integrationName = 'sentryDriftTracing';
const String loggerName = 'sentry_drift';
Loading
Loading