Use a tunneled transport when necessary

This commit is contained in:
vishnukvmd 2022-05-29 04:50:23 +05:30
parent f8f815c340
commit 106dbac6b6
4 changed files with 13 additions and 0 deletions

View file

@ -7,6 +7,7 @@ const String kSentryDSN =
"https://2235e5c99219488ea93da34b9ac1cb68@sentry.ente.io/4";
const String kSentryDebugDSN =
"https://ca5e686dd7f149d9bf94e620564cceba@sentry.ente.io/3";
const String kSentryTunnel = "https://sentry-reporter.ente.io";
const String kRoadmapURL = "https://roadmap.ente.io";
const int kMicroSecondsInDay = 86400000000;
const int kAndroid11SDKINT = 30;

View file

@ -7,11 +7,13 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
import 'package:logging/logging.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:photos/core/error-reporting/tunneled_transport.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
typedef FutureOrVoidCallback = FutureOr<void> Function();
@ -74,6 +76,8 @@ class LogConfig {
/// If this is [null], Sentry logger is completely disabled (default).
String sentryDsn;
String tunnel;
/// A built-in retry mechanism for sending errors to sentry.
///
/// This parameter defines the time to wait for, before retrying.
@ -118,6 +122,7 @@ class LogConfig {
LogConfig({
this.sentryDsn,
this.tunnel,
this.sentryRetryDelay = const Duration(seconds: 30),
this.logDirPath,
this.maxLogFiles = 10,
@ -175,6 +180,11 @@ class SuperLogging {
await SentryFlutter.init(
(options) {
options.dsn = config.sentryDsn;
options.httpClient = http.Client();
if (config.tunnel != null) {
options.transport =
TunneledTransport(Uri.parse(config.tunnel), options);
}
},
appRunner: () => config.body(),
);

View file

@ -159,6 +159,7 @@ Future _runWithLogs(Function() function, {String prefix = ""}) async {
logDirPath: (await getTemporaryDirectory()).path + "/logs",
maxLogFiles: 5,
sentryDsn: kDebugMode ? kSentryDebugDSN : kSentryDSN,
tunnel: kSentryTunnel,
enableInDebugMode: true,
prefix: prefix,
));

1
thirdparty/sentry-dart vendored Submodule

@ -0,0 +1 @@
Subproject commit 1ba4085ad44496f37392ae9172393d741fe65b75