dart-sdk/pkg/telemetry
pq 5f21e93f51 deprecated field pubspec diagnostic
Corresponding analysis in the pub client: https://github.com/dart-lang/pub/blob/master/lib/src/validator/deprecated_fields.dart

Downstream Flutter repo fixes: https://github.com/flutter/flutter/pull/84997


Change-Id: If453abcce3a24468e6fbcd2402e196000226fb4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204420
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-06-22 17:26:09 +00:00
..
lib move pkg/telemetry to using package:lints 2021-05-19 16:26:42 +00:00
test move pkg/telemetry to using package:lints 2021-05-19 16:26:42 +00:00
analysis_options.yaml move pkg/telemetry to using package:lints 2021-05-19 16:26:42 +00:00
LICENSE Update LICENSE 2021-04-07 10:28:38 +00:00
pubspec.yaml deprecated field pubspec diagnostic 2021-06-22 17:26:09 +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.