dart-sdk/pkg/telemetry
Janice Collins fef81857ca Implement broad-spectrum filtering for possible path and filenames in exception strings.
Change-Id: Ibe3d08739e2f1f199f11d40c01699ff194fc5028
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303442
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-16 15:25:37 +00:00
..
lib Implement broad-spectrum filtering for possible path and filenames in exception strings. 2023-05-16 15:25:37 +00:00
test Implement broad-spectrum filtering for possible path and filenames in exception strings. 2023-05-16 15:25:37 +00:00
analysis_options.yaml [pkg] use package:lints when analying pkg/ 2022-07-07 14:29:22 +00:00
LICENSE Update LICENSE 2021-04-07 10:28:38 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
pubspec.yaml [pkg] prefer 'any' deps for package dev dependencies 2022-05-27 01:34:59 +00:00
README.md Fix typos 2022-10-12 14:12:42 +00: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 corresponding [Analytics] object is configured to send analytics.