-
-
Notifications
You must be signed in to change notification settings - Fork 277
Fix/unified api fixes and web example #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
28792c6
ioClient : set a default Client
rxlabz a5e3fb8
options.compressPayload default value + minor
rxlabz 4b5e8ea
captureMessage as a static method
rxlabz ee35bad
io example : send a formatted message
rxlabz 51d18de
add a Dart web example
rxlabz f0ab2b9
changelog
rxlabz cc4e835
update web example
rxlabz c43d5bd
Merge remote-tracking branch 'origin/feature/unified-api' into fix/un…
rxlabz c2f89fa
Merge remote-tracking branch 'origin/feature/unified-api' into fix/un…
rxlabz 27a8d31
add tests ( applyScope, captureMessage )
rxlabz 070bfa5
minor
rxlabz eaa39e0
more applyScope tests
rxlabz 352a270
refacto sentry client tests
rxlabz 9c5110c
add a client.captureException test
rxlabz 904b7b9
clean
rxlabz d0728c7
Update dart/examples/web_example/pubspec.yaml
rxlabz 3f6f198
update the web example readme
rxlabz f5dc698
rename example methods
rxlabz c2e6b4d
clear the SentryOptions ctor
rxlabz fa1a8b1
refactor clients and update tests
rxlabz 1f5828d
fix a test
rxlabz b0de53b
typo
rxlabz 91beccc
clear tests
rxlabz 1e36ab9
update examples
rxlabz d30a89b
move back example to /example ( pub.dev visibility)
rxlabz 7b618c7
update example events
rxlabz edc6f35
update example events
rxlabz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,4 +15,6 @@ ios/ | |
| build/ | ||
| .cxx/ | ||
|
|
||
|
|
||
| .test_coverage.dart | ||
| dart/coverage/* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,26 +6,12 @@ final event = SentryEvent( | |
| release: '1.4.0-preview.1', | ||
| environment: 'Test', | ||
| message: Message('This is an example Dart event.'), | ||
| transaction: '/example/app', | ||
| level: SentryLevel.warning, | ||
| tags: const <String, String>{'project-id': '7371'}, | ||
| extra: const <String, String>{'company-name': 'Dart Inc'}, | ||
| fingerprint: const <String>['example-dart'], | ||
| userContext: const User( | ||
| id: '800', | ||
| username: 'first-user', | ||
| email: '[email protected]', | ||
| ipAddress: '127.0.0.1', | ||
| extras: <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 OperatingSystem( | ||
| name: 'Android', | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| // Copyright 2017 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'dart:async'; | ||
| import 'dart:io'; | ||
|
|
||
| import 'package:sentry/sentry.dart'; | ||
|
|
||
| import 'event_example.dart'; | ||
|
|
||
| /// Sends a test exception report to Sentry.io using this Dart client. | ||
| Future<void> main(List<String> rawArgs) async { | ||
| if (rawArgs.length != 1) { | ||
marandaneto marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| stderr.writeln( | ||
| 'Expected exactly one argument, which is the DSN issued by Sentry.io to your project.', | ||
| ); | ||
| exit(1); | ||
| } | ||
|
|
||
| final dsn = rawArgs.single; | ||
| Sentry.init((options) => options..dsn = dsn); | ||
|
|
||
| Sentry.addBreadcrumb( | ||
| Breadcrumb( | ||
| message: 'UI Lifecycle', | ||
| timestamp: DateTime.now().toUtc(), | ||
marandaneto marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| category: 'ui.lifecycle', | ||
| type: 'navigation', | ||
| data: {'screen': 'MainActivity', 'state': 'created'}, | ||
| level: SentryLevel.info), | ||
marandaneto marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ); | ||
|
|
||
| Sentry.configureScope((scope) { | ||
| scope | ||
marandaneto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ..user = User( | ||
| id: '800', | ||
| username: 'first-user', | ||
| email: '[email protected]', | ||
| ipAddress: '127.0.0.1', | ||
| extras: <String, String>{'first-sign-in': '2020-01-01'}, | ||
| ) | ||
| ..fingerprint = ['example-dart'] | ||
| ..transaction = '/example/app' | ||
| ..level = SentryLevel.warning | ||
| ..setTag('project-id', '7371') | ||
| ..setExtra('company-name', 'Dart Inc'); | ||
| }); | ||
|
|
||
| print('\nReporting a complete event example: '); | ||
|
|
||
| // Sends a full Sentry event payload to show the different parts of the UI. | ||
| final sentryId = await Sentry.captureEvent(event); | ||
marandaneto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| print('Capture event result : SentryId : ${sentryId}'); | ||
marandaneto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| print('\nCapture message: '); | ||
|
|
||
| // Sends a full Sentry event payload to show the different parts of the UI. | ||
| final messageSentryId = await Sentry.captureMessage( | ||
| 'Message 1', | ||
| level: SentryLevel.warning, | ||
| template: 'Message %s', | ||
| params: ['1'], | ||
| ); | ||
|
|
||
| print('Capture message result : SentryId : ${messageSentryId}'); | ||
|
|
||
| try { | ||
| await loadConfig(); | ||
| } catch (error, stackTrace) { | ||
| print('\nReporting the following stack trace: '); | ||
| print(stackTrace); | ||
| final sentryId = await Sentry.captureException( | ||
| error, | ||
| stackTrace: stackTrace, | ||
| ); | ||
|
|
||
| print('Capture exception result : SentryId : ${sentryId}'); | ||
| } finally { | ||
| await Sentry.close(); | ||
| } | ||
|
|
||
| /* TODO(rxlabz) Sentry CaptureMessage(message, level) */ | ||
| } | ||
|
|
||
| Future<void> loadConfig() async { | ||
| await parseConfig(); | ||
| } | ||
|
|
||
| Future<void> parseConfig() async { | ||
| await decode(); | ||
| } | ||
|
|
||
| Future<void> decode() async { | ||
| throw StateError('This is a test error'); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Sentry Dart : web example | ||
|
|
||
| ```dart | ||
| pub get | ||
|
|
||
| # run the project ( see https://dart.dev/tools/webdev#serve ) | ||
| webdev serve --release | ||
|
|
||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| name: sentry_dart_web_example | ||
| description: An absolute bare-bones web app. | ||
marandaneto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # version: 1.0.0 | ||
| #homepage: https://www.example.com | ||
|
|
||
| environment: | ||
| sdk: ^2.0.0 | ||
|
|
||
| dependencies: | ||
| sentry: | ||
| path: ../.. | ||
|
|
||
| dev_dependencies: | ||
| build_runner: ^1.10.0 | ||
| build_web_compilers: ^2.13.0 | ||
| pedantic: ^1.9.0 | ||
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <!DOCTYPE html> | ||
|
|
||
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <meta name="scaffolded-by" content="https://github.com/dart-lang/stagehand"> | ||
| <title>dart_web</title> | ||
| <link rel="stylesheet" href="styles.css"> | ||
| <link rel="icon" href="favicon.ico"> | ||
|
|
||
| <style> | ||
| .bloc { | ||
| display: flex; | ||
| margin: 1rem; | ||
| } | ||
|
|
||
| .result { | ||
| padding-left: 1rem; | ||
| color: green; | ||
| display: none; | ||
| } | ||
| </style> | ||
|
|
||
| <script defer src="main.dart.js"></script> | ||
| </head> | ||
|
|
||
| <body> | ||
|
|
||
| <div id="output"></div> | ||
|
|
||
| <div class="bloc"> | ||
| <button id="btEvent">Capture Event</button> | ||
| <div id="eventResult" class="result">Captured</div> | ||
| </div> | ||
|
|
||
| <div class="bloc"> | ||
| <button id="btMessage">Capture Message</button> | ||
| <div id="messageResult" class="result">Captured</div> | ||
| </div> | ||
|
|
||
| <div class="bloc"> | ||
| <button id="btException">Capture Exception</button> | ||
| <div id="exceptionResult" class="result">Captured</div> | ||
| </div> | ||
|
|
||
| </body> | ||
| </html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are they removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved back fields which are "merged" with scope