mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 00:27:40 +00:00
03101c0c2b
Changes to comply to internal review Closes https://github.com/dart-lang/sdk/pull/45568 https://github.com/dart-lang/sdk/pull/45568 TEST=CL contains no code changes. No-Try: true GitOrigin-RevId: 65796784e5fdfddaa021b5c55ad435b1db419700 Change-Id: I085a948f16dc9a0de128ed0bd456ae69adf6c124 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193888 Reviewed-by: Alexander Thomas <athom@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Alexander Thomas <athom@google.com> |
||
---|---|---|
.. | ||
lib | ||
test | ||
analysis_options.yaml | ||
LICENSE | ||
pubspec.yaml | ||
README.md |
telemetry
A library to facilitate reporting analytics and crash reports.
Analytics
This library is designed to allow all Dart SDK tools to easily send analytics information and crash reports. The tools share a common setting to configure sending analytics data. To use this library for a specific tool:
import 'package:telemetry/telemetry.dart';
import 'package:usage/usage.dart';
main() async {
final String myAppTrackingID = ...;
final String myAppName = ...;
Analytics analytics = createAnalyticsInstance(myAppTrackingID, myAppName);
...
analytics.sendScreenView('home');
...
await analytics.waitForLastPing();
}
The analytics object reads from the correct user configuration file automatically without any additional configuration. Analytics will not be sent if the user has opted-out.
Crash reporting
To use the crash reporting functionality, import crash_reporting.dart
, and
create a new CrashReportSender
instance:
import 'package:telemetry/crash_reporting.dart';
main() {
Analytics analytics = ...;
CrashReportSender sender = new CrashReportSender(analytics);
try {
...
} catch (e, st) {
sender.sendReport(e, st);
}
}
Crash reports will only be sent if the cooresponding [Analytics] object is configured to send analytics.