dart-sdk/pkg/telemetry
Devon Carew 983447f95a [analyzer] fix an exception when run on platforms w/o home dirs
Bug: https://github.com/dart-lang/sdk/issues/37308
Change-Id: I2e117a678bfc99dcc3f48d4a58ea5895d0079261
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107580
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-06-28 18:31:49 +00:00
..
lib [analyzer] fix an exception when run on platforms w/o home dirs 2019-06-28 18:31:49 +00:00
test Plumb in more of the analytics impl into the analysis server; allow clients to enble analytics. 2018-06-28 16:28:25 +00:00
analysis_options.yaml
LICENSE
pubspec.yaml [analyzer] fix an exception when run on platforms w/o home dirs 2019-06-28 18:31:49 +00:00
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.