Skip to content

Commit

Permalink
APM for hive (#1672)
Browse files Browse the repository at this point in the history
* setup sentry hive library

* Add SentryBox with first test

* test added spans

* Add sentry hive impl

* introduce base box to avoid duplication

* implement lazy box test

* expose sentry hive and updata documentation

* add hive to flutter example app

* test throwing in base_box, cleanup

* test lazy box error cases

* test sentry hive impl failures

* run fix & format

* fix test failure race condition

* add hive workflow, update other workflows

* add changelog entry

* remove path+provider from dev_dependencies

* add coverage dev dependency

* fix deprecation warnings

* fix changelog

* move span wrapping on own class to avoid duplication

* add sentry box collection

* test added spans, fix imports

* test throwing code

* fix changelog

* change dbSystem value

* change db system

* remove unneccessary async & await

* Fix analyze

* Formatting

* Add changelog symlink

* Ignore hive coverage

* Create symlink for dartdoc_options

---------

Co-authored-by: Giancarlo Buenaflor <giancarlo_buenaflor@yahoo.com>
  • Loading branch information
denrase and buenaflor authored Nov 15, 2023
1 parent 3e5078c commit 7748b7c
Show file tree
Hide file tree
Showing 47 changed files with 3,441 additions and 1,600 deletions.
4 changes: 3 additions & 1 deletion .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ targets:
dio:
file:
sqflite:
hive:
drift:
- name: github
- name: registry
Expand All @@ -21,5 +22,6 @@ targets:
pub:sentry_dio:
pub:sentry_file:
pub:sentry_sqflite:
# This needs to be published on pub.dev first before uncommenting
# Initial release on pub.dev needed first before uncommenting
# pub:sentry_drift:
# pub:sentry_hive:
1 change: 1 addition & 0 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "dio/**"
- "file/**"
- "sqflite/**"
- "hive/**"
- "drift/**"

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/diagrams.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
working-directory: ./logging
run: lakos . -i "{test/**,example/**}" | dot -Tsvg -o class-diagram.svg

- name: hive
working-directory: ./hive
run: lakos . -i "{test/**,example/**}" | dot -Tsvg -o class-diagram.svg

# Source: https://stackoverflow.com/a/58035262
- name: Extract branch name
shell: bash
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "flutter/**"
- "file/**"
- "sqflite/**"
- "hive/**"
- "drift/**"

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/e2e_dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- "flutter/**"
- "file/**"
- "sqflite/**"
- "hive/**"
- "drift/**"

env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "flutter/**"
- "dio/**"
- "sqflite/**"
- "hive/**"
- "drift/**"

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "dio/**"
- "file/**"
- "sqflite/**"
- "hive/**"
- "drift/**"

jobs:
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/hive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: sentry-hive
on:
push:
branches:
- main
- release/**
pull_request:
paths-ignore:
- "**/*.md"
- "logging/**"
- "flutter/**"
- "dio/**"
- "file/**"
- "sqflite/**"

jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # pin@0.11.0
with:
access_token: ${{ github.token }}

build:
name: Build ${{matrix.sdk}} on ${{matrix.os}}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
defaults:
run:
shell: bash
working-directory: ./hive
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
sdk: [stable, beta]
exclude:
- os: windows-latest
sdk: beta
- os: macos-latest
sdk: beta
steps:
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1
with:
sdk: ${{ matrix.sdk }}
- uses: actions/checkout@v3

- name: Test VM
run: |
dart pub get
dart test -p vm --coverage=coverage --test-randomize-ordering-seed=random --chain-stack-traces
dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # pin@v3
if: runner.os == 'Linux' && matrix.sdk == 'stable'
with:
name: sentry_hive
files: ./hive/coverage/lcov.info

- uses: VeryGoodOpenSource/very_good_coverage@e5c91bc7ce9843e87c800b3bcafdfb86fbe28491 # pin@v2.1.0
if: runner.os == 'Linux' && matrix.sdk == 'stable'
with:
path: "./hive/coverage/lcov.info"
min_coverage: 55

analyze:
uses: ./.github/workflows/analyze.yml
with:
package: hive
panaThreshold: 90
1 change: 1 addition & 0 deletions .github/workflows/logging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "flutter/**"
- "file/**"
- "sqflite/**"
- "hive/**"
- "drift/**"

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/min_version_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- "**/*.md"
- "file/**"
- "sqflite/**"
- "hive/**"
- "drift/**"

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sqflite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "flutter/**"
- "dio/**"
- "file/**"
- "hive/**"
- "drift/**"

jobs:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ file/coverage/*
flutter/coverage/*
sqflite/coverage/*
drift/coverage/*
hive/coverage/*

pubspec.lock
Podfile.lock
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Add APM integration for Drift ([#1709](https://github.com/getsentry/sentry-dart/pull/1709))
- StackTraces in `PlatformException.message` will get nicely formatted too when present ([#1716](https://github.com/getsentry/sentry-dart/pull/1716))
- Breadcrumbs for database operations ([#1656](https://github.com/getsentry/sentry-dart/pull/1656))
- APM for hive ([#1672](https://github.com/getsentry/sentry-dart/pull/1672))
- Add `attachScreenshotOnlyWhenResumed` to options ([#1700](https://github.com/getsentry/sentry-dart/pull/1700))

### Dependencies
Expand Down
4 changes: 4 additions & 0 deletions dart/lib/src/sentry_trace_origins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class SentryTraceOrigins {
'auto.db.sqflite.database_executor';
static const autoDbSqfliteDatabaseFactory =
'auto.db.sqflite.database_factory';
static const autoDbHive = 'auto.db.hive';
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';
Expand Down
Loading

0 comments on commit 7748b7c

Please sign in to comment.