dart-sdk/pkg/telemetry
Kevin Moore 0236c5c051 pkg:analyzer_fe_comparison, diagnostics, telemetry remove version info
Until we plan to publish these, it helps tools track what are our public
packages

Change-Id: I5bb692fd6f3da5cfdc9b759d55375435c7885b83
Reviewed-on: https://dart-review.googlesource.com/c/87220
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2018-12-13 16:44:44 +00:00
..
lib Plumb in more of the analytics impl into the analysis server; allow clients to enble analytics. 2018-06-28 16:28:25 +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 Test out no_implicit_casts on the analyzer source base. 2018-06-28 02:20:43 +00:00
LICENSE Add initial version of analytics and crash reporting package. 2017-06-29 16:46:54 -07:00
pubspec.yaml pkg:analyzer_fe_comparison, diagnostics, telemetry remove version info 2018-12-13 16:44:44 +00:00
README.md Fix spelling errors in telemetry README. 2017-07-07 10:57:58 -07:00

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.