Skip to content

Commit

Permalink
Merge branch 'main' into feat/deprecate-user-segment
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor authored Jun 25, 2024
2 parents df3f463 + 7e7f0b1 commit 6cb8f46
Show file tree
Hide file tree
Showing 57 changed files with 722 additions and 133 deletions.
8 changes: 7 additions & 1 deletion .github/actions/dart-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runs:
working-directory: ${{ inputs.directory }}

- name: Test VM
run: dart test -p vm --coverage=coverage --test-randomize-ordering-seed=random --chain-stack-traces
run: dart test -p vm ${{ (runner.os == 'Linux' && matrix.sdk == 'stable' && '--coverage=coverage') || '' }} --test-randomize-ordering-seed=random --chain-stack-traces
shell: bash
working-directory: ${{ inputs.directory }}

Expand All @@ -32,3 +32,9 @@ runs:
run: dart test -p chrome --test-randomize-ordering-seed=random --chain-stack-traces
shell: bash
working-directory: ${{ inputs.directory }}

- name: Test dart2wasm
if: ${{ inputs.web == 'true' && (matrix.sdk == 'stable' || matrix.sdk == 'beta') && runner.os != 'Windows' }}
run: dart test -p chrome --compiler dart2wasm --test-randomize-ordering-seed=random --chain-stack-traces
shell: bash
working-directory: ${{ inputs.directory }}
4 changes: 2 additions & 2 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

- run: ${{ inputs.sdk }} pub get
- run: dart format --set-exit-if-changed ./

- name: dart analyze
uses: invertase/github-action-dart-analyzer@e981b01a458d0bab71ee5da182e5b26687b7101b # pin@v3.0.0
with:
Expand Down Expand Up @@ -78,6 +78,6 @@ jobs:
PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX ))
if (( $PERCENTAGE < ${{ inputs.panaThreshold }} ))
then
echo Score too low!
echo "Score too low ($PERCENTAGE % is less than the expected ${{ inputs.panaThreshold }} %)!"
exit 1
fi
39 changes: 19 additions & 20 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,28 @@ jobs:
access_token: ${{ github.token }}

build:
name: Build ${{matrix.sdk}} on ${{matrix.os}}
runs-on: ${{ matrix.os }}
name: Dart ${{matrix.sdk}} on ${{matrix.os}}
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
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
os: [ubuntu]
sdk:
- '2.18'
- '2.19'
- '3.0'
- '3.1'
- '3.2'
- '3.3'
- '3.4'
- stable
- beta
include:
- os: windows
sdk: stable
- os: macos
sdk: stable
steps:
- uses: actions/checkout@v4

Expand All @@ -49,24 +58,14 @@ jobs:
coverage: sentry
min-coverage: 85

- name: Install webdev
if: runner.os != 'Windows'
run: dart pub global activate webdev

- name: Build example
working-directory: dart/example
run: |
dart pub get
dart compile aot-snapshot bin/example.dart
- name: Build Web example
if: runner.os != 'Windows'
working-directory: dart/example_web
run: |
dart pub get
webdev build
analyze:
uses: ./.github/workflows/analyze.yml
with:
package: dart
panaThreshold: 87
1 change: 1 addition & 0 deletions .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ jobs:
with:
package: flutter
sdk: flutter
panaThreshold: 87

pod-lint:
runs-on: macos-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flutter_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: flutter pub get

- name: Gradle cache
uses: gradle/gradle-build-action@04b20c065cf1ab708c96e64a8811018d0a1fbc88 # pin@v3.4.1
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # pin@v3.4.2

- name: AVD cache
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flutter_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: flutter pub get

- name: Gradle cache
uses: gradle/gradle-build-action@04b20c065cf1ab708c96e64a8811018d0a1fbc88 # pin@v3.0.0
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 # pin@v3.0.0

- name: AVD cache
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # pin@v2.16.0
- run: xcodes select 15.0.1
- uses: ruby/setup-ruby@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # pin@v1.179.1
- uses: ruby/setup-ruby@3783f195e29b74ae398d7caca108814bbafde90e # pin@v1.180.1
with:
ruby-version: '2.7.5'
bundler-cache: true
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pubspec.lock
build/
.cxx/
.vscode/

.fvm/

.test_coverage.dart
dart/coverage/*
Expand Down
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features

- Support WebAssembly compilation (dart2wasm) ([#2113](https://github.com/getsentry/sentry-dart/pull/2113))

### Deprecated

- User segment is now deprecated and will be removed in version 9.0.0. Use a custom tag or context instead. ([#2119](https://github.com/getsentry/sentry-dart/pull/2119))
Expand Down Expand Up @@ -126,7 +130,7 @@ This release contains breaking changes, please read the changelog carefully.

### Features

- Experimental: Add support for Sentry Developer Metrics ([#1940](https://github.com/getsentry/sentry-dart/pull/1940), [#1949](https://github.com/getsentry/sentry-dart/pull/1949), [#1954](https://github.com/getsentry/sentry-dart/pull/1954), [#1958](https://github.com/getsentry/sentry-dart/pull/1958))
- Experimental: Add support for Sentry Developer Metrics ([#1940](https://github.com/getsentry/sentry-dart/pull/1940), [#1949](https://github.com/getsentry/sentry-dart/pull/1949), [#1954](https://github.com/getsentry/sentry-dart/pull/1954), [#1958](https://github.com/getsentry/sentry-dart/pull/1958))
Use the Metrics API to track processing time, download sizes, user signups, and conversion rates and correlate them back to tracing data in order to get deeper insights and solve issues faster. Our API supports counters, distributions, sets, gauges and timers, and it's easy to get started:
```dart
Sentry.metrics()
Expand Down Expand Up @@ -239,14 +243,14 @@ This release contains breaking changes, please read the changelog carefully.
- Now the device context from Android is available in `BeforeSendCallback`
- Set ip_address to {{auto}} by default, even if sendDefaultPII is disabled ([#1665](https://github.com/getsentry/sentry-dart/pull/1665))
- Instead use the "Prevent Storing of IP Addresses" option in the "Security & Privacy" project settings on sentry.io
### Fixes

### Fixes

- Remove Flutter dependency from Drift integration ([#1867](https://github.com/getsentry/sentry-dart/pull/1867))
- Remove dead code, cold start bool is now always present ([#1861](https://github.com/getsentry/sentry-dart/pull/1861))
- Fix iOS "Arithmetic Overflow" ([#1874](https://github.com/getsentry/sentry-dart/pull/1874))

### Dependencies
### Dependencies

- Bump Cocoa SDK from v8.19.0 to v8.20.0 ([#1856](https://github.com/getsentry/sentry-dart/pull/1856))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8200)
Expand Down
1 change: 1 addition & 0 deletions dart/example_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ environment:
dependencies:
sentry:
path: ../../dart/
web: ^0.5.1

dev_dependencies:
build_runner: ^2.4.2
Expand Down
33 changes: 23 additions & 10 deletions dart/example_web/web/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dart:async';
import 'dart:html';
import 'package:web/web.dart';

import 'package:sentry/sentry.dart';
import 'package:sentry/src/version.dart';
Expand All @@ -24,7 +24,7 @@ Future<void> main() async {
Future<void> runApp() async {
print('runApp');

querySelector('#output')?.text = 'Your Dart app is running.';
document.querySelector('#output')?.text = 'Your Dart app is running.';

await Sentry.addBreadcrumb(
Breadcrumb(
Expand Down Expand Up @@ -57,12 +57,20 @@ Future<void> runApp() async {
);
});

querySelector('#btEvent')
document
.querySelector('#btEvent')
?.onClick
.listen((event) => captureCompleteExampleEvent());
querySelector('#btMessage')?.onClick.listen((event) => captureMessage());
querySelector('#btException')?.onClick.listen((event) => captureException());
querySelector('#btUnhandledException')
document
.querySelector('#btMessage')
?.onClick
.listen((event) => captureMessage());
document
.querySelector('#btException')
?.onClick
.listen((event) => captureException());
document
.querySelector('#btUnhandledException')
?.onClick
.listen((event) => captureUnhandledException());
}
Expand All @@ -76,7 +84,8 @@ Future<void> captureMessage() async {
);
print('capture message result : $sentryId');
if (sentryId != SentryId.empty()) {
querySelector('#messageResult')?.style.display = 'block';
(document.querySelector('#messageResult') as HTMLElement?)?.style.display =
'block';
}
}

Expand All @@ -93,13 +102,16 @@ Future<void> captureException() async {
print('Capture exception : SentryId: $sentryId');

if (sentryId != SentryId.empty()) {
querySelector('#exceptionResult')?.style.display = 'block';
(document.querySelector('#exceptionResult') as HTMLElement?)
?.style
.display = 'block';
}
}
}

Future<void> captureUnhandledException() async {
querySelector('#unhandledResult')?.style.display = 'block';
(document.querySelector('#unhandledResult') as HTMLElement?)?.style.display =
'block';

await buildCard();
}
Expand All @@ -111,7 +123,8 @@ Future<void> captureCompleteExampleEvent() async {
print('Response SentryId: $sentryId');

if (sentryId != SentryId.empty()) {
querySelector('#eventResult')?.style.display = 'block';
(document.querySelector('#eventResult') as HTMLElement?)?.style.display =
'block';
}
}

Expand Down
9 changes: 9 additions & 0 deletions dart/example_web_legacy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Files and directories created by pub
.dart_tool/
.packages

# Conventional directory for build outputs
build/

# Directory created by dartdoc
doc/api/
8 changes: 8 additions & 0 deletions dart/example_web_legacy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Sentry Dart : web example

```sh
dart pub get

# run the project ( see https://dart.dev/tools/webdev#serve )
dart run webdev serve --release
```
5 changes: 5 additions & 0 deletions dart/example_web_legacy/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include: package:lints/recommended.yaml

analyzer:
errors:
path_does_not_exist: ignore
17 changes: 17 additions & 0 deletions dart/example_web_legacy/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: sentry_dart_web_example
description: An absolute bare-bones web app.

publish_to: 'none'

environment:
sdk: '>=2.17.0 <4.0.0'

dependencies:
sentry:
path: ../../dart/

dev_dependencies:
build_runner: ^2.3.0
build_web_compilers: ^3.2.3
lints: ^2.0.0
webdev: ^2.7.0
76 changes: 76 additions & 0 deletions dart/example_web_legacy/web/event.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import 'package:sentry/src/protocol.dart';

final event = SentryEvent(
logger: 'main',
serverName: 'server.dart',
release: '1.4.0-preview.1',
environment: 'Test',
message: SentryMessage('This is an example Dart event.'),
tags: const <String, String>{'project-id': '7371'},
// ignore: deprecated_member_use, deprecated_member_use_from_same_package
extra: const <String, String>{'section': '1'},
// fingerprint: const <String>['example-dart'],
user: SentryUser(
id: '800',
username: 'first-user',
email: 'first@user.lan',
// ipAddress: '127.0.0.1',
data: <String, String>{'first-sign-in': '2020-01-01'},
),
breadcrumbs: [
Breadcrumb(
message: 'UI Lifecycle',
timestamp: DateTime.now().toUtc(),
category: 'ui.lifecycle',
type: 'navigation',
data: {'screen': 'MainActivity', 'state': 'created'},
level: SentryLevel.info,
)
],
contexts: Contexts(
operatingSystem: const SentryOperatingSystem(
name: 'Android',
version: '5.0.2',
build: 'LRX22G.P900XXS0BPL2',
kernelVersion:
'Linux version 3.4.39-5726670 (dpi@SWHC3807) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Thu Dec 1 19:42:39 KST 2016',
rooted: false,
),
runtimes: [const SentryRuntime(name: 'ART', version: '5')],
app: SentryApp(
name: 'Example Dart App',
version: '1.42.0',
identifier: 'HGT-App-13',
build: '93785',
buildType: 'release',
deviceAppHash: '5afd3a6',
startTime: DateTime.now().toUtc(),
),
browser: const SentryBrowser(name: 'Firefox', version: '42.0.1'),
device: SentryDevice(
name: 'SM-P900',
family: 'SM-P900',
model: 'SM-P900 (LRX22G)',
modelId: 'LRX22G',
arch: 'armeabi-v7a',
batteryLevel: 99,
orientation: SentryOrientation.landscape,
manufacturer: 'samsung',
brand: 'samsung',
screenDensity: 2.1,
screenDpi: 320,
online: true,
charging: true,
lowMemory: true,
simulator: false,
memorySize: 1500,
freeMemory: 200,
usableMemory: 4294967296,
storageSize: 4294967296,
freeStorage: 2147483648,
externalStorageSize: 8589934592,
externalFreeStorage: 2863311530,
bootTime: DateTime.now().toUtc(),
),
),
);
Binary file added dart/example_web_legacy/web/favicon.ico
Binary file not shown.
Loading

0 comments on commit 6cb8f46

Please sign in to comment.