Skip to content

Commit 051e97a

Browse files
authored
feat: drift apm (#1709)
* draft impl * improve code * Add open span * Refactor to extend lazy database * Update * SentryTransactionExecutor * Implement tracing batch and transactions * Update tests * update changelog * Formatting * Update workflows * Update deps * Fix analyze issues * Format * Add example * Update descriptions * Fix deps * Update run commands * Update workflow * Update example * Update workflow * Format * Fix dart analyze * Try changing deps * Add to craft * Change to flutter test * Revert flutter test mock * change dir manually * download and extract sqlite.dll for windows * Try downloading sqlite3 * set up dart * fix path to file * use pub get * Use flutter pub get * fix * skip windows test * fix analyze * fix drift.yml * format * Remove redundant test * Remove debug print * update trace origin * Improvements * Improvements * Add to flutter example
1 parent 48adddf commit 051e97a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4925
-36
lines changed

.craft.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ targets:
1111
dio:
1212
file:
1313
sqflite:
14+
drift:
1415
- name: github
1516
- name: registry
1617
sdks:
@@ -20,3 +21,5 @@ targets:
2021
pub:sentry_dio:
2122
pub:sentry_file:
2223
pub:sentry_sqflite:
24+
# This needs to be published on pub.dev first before uncommenting
25+
# pub:sentry_drift:

.github/workflows/dart.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- "dio/**"
1212
- "file/**"
1313
- "sqflite/**"
14+
- "drift/**"
1415

1516
jobs:
1617
cancel-previous-workflow:

.github/workflows/dio.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- "flutter/**"
1212
- "file/**"
1313
- "sqflite/**"
14+
- "drift/**"
1415

1516
jobs:
1617
cancel-previous-workflow:

.github/workflows/drift.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: sentry-drift
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- release/**
7+
pull_request:
8+
paths-ignore:
9+
- "**/*.md"
10+
- "logging/**"
11+
- "flutter/**"
12+
- "dio/**"
13+
- "file/**"
14+
- "sqflite/**"
15+
16+
jobs:
17+
cancel-previous-workflow:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Cancel Previous Runs
21+
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # [email protected]
22+
with:
23+
access_token: ${{ github.token }}
24+
25+
build:
26+
name: ${{ matrix.target }} | ${{ matrix.os }} | ${{ matrix.sdk }}
27+
runs-on: ${{ matrix.os }}
28+
timeout-minutes: 30
29+
defaults:
30+
run:
31+
shell: bash
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
os: [ubuntu-latest, macos-latest, windows-latest]
36+
target: ["ios", "android", "macos", "linux", "windows"]
37+
sdk: ["stable", "beta"]
38+
exclude:
39+
- os: ubuntu-latest
40+
target: ios
41+
- os: ubuntu-latest
42+
target: macos
43+
- os: ubuntu-latest
44+
target: windows
45+
- os: windows-latest
46+
target: ios
47+
- os: windows-latest
48+
target: android
49+
- os: windows-latest
50+
target: macos
51+
- os: windows-latest
52+
target: linux
53+
# macos-latest is taking hours due to limited resources
54+
- os: macos-latest
55+
target: android
56+
- os: macos-latest
57+
target: linux
58+
- os: macos-latest
59+
target: windows
60+
# Bad CPU type in executable
61+
- os: macos-latest
62+
sdk: beta
63+
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- uses: actions/setup-java@v3
68+
if: ${{ matrix.target == 'android' }}
69+
with:
70+
java-version: "11"
71+
distribution: "adopt"
72+
73+
# Install required dependencies for Flutter on Linux on Ubuntu
74+
- name: "Setup Linux"
75+
run: |
76+
sudo apt update
77+
sudo apt install -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb
78+
sudo apt install -y network-manager upower
79+
if: matrix.os == 'ubuntu-latest' && matrix.target == 'linux'
80+
81+
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # [email protected]
82+
with:
83+
channel: ${{ matrix.sdk }}
84+
85+
- run: flutter upgrade
86+
87+
- name: Pub Get
88+
run: |
89+
cd drift
90+
flutter pub get
91+
92+
- name: Test VM with coverage
93+
run: |
94+
cd drift
95+
flutter test --coverage --test-randomize-ordering-seed=random
96+
97+
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@v3
98+
if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux'
99+
with:
100+
name: sentry_drift
101+
file: ./drift/coverage/lcov.info
102+
functionalities: "search" # remove after https://github.com/codecov/codecov-action/issues/600
103+
104+
- uses: VeryGoodOpenSource/very_good_coverage@e5c91bc7ce9843e87c800b3bcafdfb86fbe28491 # [email protected]
105+
if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux'
106+
with:
107+
path: "./drift/coverage/lcov.info"
108+
min_coverage: 80
109+
110+
analyze:
111+
uses: ./.github/workflows/analyze.yml
112+
with:
113+
package: drift
114+
sdk: flutter

.github/workflows/e2e_dart.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- "flutter/**"
1313
- "file/**"
1414
- "sqflite/**"
15+
- "drift/**"
1516

1617
env:
1718
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

.github/workflows/file.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- "flutter/**"
1212
- "dio/**"
1313
- "sqflite/**"
14+
- "drift/**"
1415

1516
jobs:
1617
cancel-previous-workflow:

.github/workflows/flutter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- "dio/**"
1212
- "file/**"
1313
- "sqflite/**"
14+
- "drift/**"
1415

1516
jobs:
1617
cancel-previous-workflow:

.github/workflows/logging.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- "flutter/**"
1212
- "file/**"
1313
- "sqflite/**"
14+
- "drift/**"
1415

1516
jobs:
1617
cancel-previous-workflow:

.github/workflows/min_version_test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- "**/*.md"
1010
- "file/**"
1111
- "sqflite/**"
12+
- "drift/**"
1213

1314
jobs:
1415
cancel-previous-workflow:

.github/workflows/sqflite.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- "flutter/**"
1212
- "dio/**"
1313
- "file/**"
14+
- "drift/**"
1415

1516
jobs:
1617
cancel-previous-workflow:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dio/coverage/*
2222
file/coverage/*
2323
flutter/coverage/*
2424
sqflite/coverage/*
25+
drift/coverage/*
2526

2627
pubspec.lock
2728
Podfile.lock

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Features
1111

12+
- Add APM integration for Drift ([#1709](https://github.com/getsentry/sentry-dart/pull/1709))
1213
- StackTraces in `PlatformException.message` will get nicely formatted too when present ([#1716](https://github.com/getsentry/sentry-dart/pull/1716))
1314
- Breadcrumbs for database operations ([#1656](https://github.com/getsentry/sentry-dart/pull/1656))
1415
- Add `attachScreenshotOnlyWhenResumed` to options ([#1700](https://github.com/getsentry/sentry-dart/pull/1700))

dart/lib/src/sentry_trace_origins.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ class SentryTraceOrigins {
1818
'auto.db.sqflite.database_executor';
1919
static const autoDbSqfliteDatabaseFactory =
2020
'auto.db.sqflite.database_factory';
21+
static const autoDbDriftQueryExecutor = 'auto.db.drift.query.executor';
22+
static const autoDbDriftTransactionExecutor =
23+
'auto.db.drift.transaction.executor';
2124
}

drift/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Omit committing pubspec.lock for library packages; see
2+
# https://dart.dev/guides/libraries/private-files#pubspeclock.
3+
pubspec.lock
4+
5+
# Flutter/Dart/Pub related
6+
**/doc/api/
7+
**/ios/Flutter/.last_build_id
8+
.dart_tool/
9+
.flutter-plugins
10+
.flutter-plugins-dependencies
11+
.packages
12+
.pub-cache/
13+
.pub/
14+
/build/

0 commit comments

Comments
 (0)