[flutter_tools] Add more info to pub get failure event (#41652)
This commit is contained in:
@@ -27,7 +27,7 @@ class DisabledUsage implements Usage {
|
||||
void sendCommand(String command, { Map<String, String> parameters }) { }
|
||||
|
||||
@override
|
||||
void sendEvent(String category, String parameter, { Map<String, String> parameters }) { }
|
||||
void sendEvent(String category, String parameter, { String label, Map<String, String> parameters }) { }
|
||||
|
||||
@override
|
||||
void sendTiming(String category, String variableName, Duration duration, { String label }) { }
|
||||
|
||||
@@ -9,13 +9,16 @@ part of reporting;
|
||||
/// If sending values for custom dimensions is required, extend this class as
|
||||
/// below.
|
||||
class UsageEvent {
|
||||
UsageEvent(this.category, this.parameter);
|
||||
UsageEvent(this.category, this.parameter, {
|
||||
this.label,
|
||||
});
|
||||
|
||||
final String category;
|
||||
final String parameter;
|
||||
final String label;
|
||||
|
||||
void send() {
|
||||
flutterUsage.sendEvent(category, parameter);
|
||||
flutterUsage.sendEvent(category, parameter, label: label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +104,7 @@ class DoctorResultEvent extends UsageEvent {
|
||||
@override
|
||||
void send() {
|
||||
if (validator is! GroupedValidator) {
|
||||
flutterUsage.sendEvent(category, parameter);
|
||||
flutterUsage.sendEvent(category, parameter, label: label);
|
||||
return;
|
||||
}
|
||||
final GroupedValidator group = validator;
|
||||
@@ -114,10 +117,11 @@ class DoctorResultEvent extends UsageEvent {
|
||||
}
|
||||
|
||||
/// An event that reports success or failure of a pub get.
|
||||
class PubGetEvent extends UsageEvent {
|
||||
PubGetEvent({
|
||||
@required bool success,
|
||||
}) : super('packages-pub-get', success ? 'success' : 'failure');
|
||||
class PubResultEvent extends UsageEvent {
|
||||
PubResultEvent({
|
||||
@required String context,
|
||||
@required String result,
|
||||
}) : super('pub', context, label: result);
|
||||
}
|
||||
|
||||
/// An event that reports something about a build.
|
||||
|
||||
@@ -124,6 +124,7 @@ abstract class Usage {
|
||||
void sendEvent(
|
||||
String category,
|
||||
String parameter, {
|
||||
String label,
|
||||
Map<String, String> parameters,
|
||||
});
|
||||
|
||||
@@ -262,6 +263,7 @@ class _DefaultUsage implements Usage {
|
||||
void sendEvent(
|
||||
String category,
|
||||
String parameter, {
|
||||
String label,
|
||||
Map<String, String> parameters,
|
||||
}) {
|
||||
if (suppressAnalytics) {
|
||||
@@ -273,7 +275,12 @@ class _DefaultUsage implements Usage {
|
||||
cdKey(CustomDimensions.localTime): formatDateTime(systemClock.now()),
|
||||
};
|
||||
|
||||
_analytics.sendEvent(category, parameter, parameters: paramsWithLocalTime);
|
||||
_analytics.sendEvent(
|
||||
category,
|
||||
parameter,
|
||||
label: label,
|
||||
parameters: paramsWithLocalTime,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user