dart-sdk/pkg/telemetry
Jaime Wren 03483c1dab Update the isRunningOnBot() check in telemetry.dart for Travis, check for env.containsKey('BOT'), instead of env['BOT'] == true
This should fix bot failures such as https://travis-ci.org/github/flutter/devtools/builds/700932057

Change-Id: Ie65455d3f7de825f6691669174ec05f8bac6925e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152020
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2020-06-22 20:49:46 +00:00
..
lib Update the isRunningOnBot() check in telemetry.dart for Travis, check for env.containsKey('BOT'), instead of env['BOT'] == true 2020-06-22 20:49:46 +00:00
test [analysis_server] Report to both prod & staging crash reporting 2020-05-04 18:11:54 +00:00
analysis_options.yaml Test out no_implicit_casts on the analyzer source base. 2018-06-28 02:20:43 +00:00
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 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.