mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
send channel name as a custom dimension (#10814)
* send channel name as a custom dimension * tweaks from review * remove unused import
This commit is contained in:
parent
c14470e0c7
commit
b471a9cffc
@ -26,8 +26,9 @@ class Usage {
|
||||
_analytics = new AnalyticsIO(_kFlutterUA, settingsName, version);
|
||||
|
||||
// Report a more detailed OS version string than package:usage does by
|
||||
// default as custom dimension 1 (configured in our analytics account).
|
||||
// default. Also, send the branch name as the "channel".
|
||||
_analytics.setSessionValue('dimension1', os.name);
|
||||
_analytics.setSessionValue('dimension2', FlutterVersion.getBranchName(whitelistBranchName: true));
|
||||
|
||||
bool runningOnCI = false;
|
||||
|
||||
|
||||
@ -149,6 +149,16 @@ class FlutterVersion {
|
||||
String commit = _shortGitRevision(_runSync(<String>['git', 'rev-parse', 'HEAD']));
|
||||
commit = commit.isEmpty ? 'unknown' : commit;
|
||||
|
||||
final String branch = getBranchName(whitelistBranchName: whitelistBranchName);
|
||||
|
||||
return '$branch/$commit';
|
||||
}
|
||||
|
||||
/// Return the branch name.
|
||||
///
|
||||
/// If whitelistBranchName is true and the branch is unknown,
|
||||
/// the branch name will be returned as 'dev'.
|
||||
static String getBranchName({ bool whitelistBranchName: false }) {
|
||||
String branch = _runSync(<String>['git', 'rev-parse', '--abbrev-ref', 'HEAD']);
|
||||
branch = branch == 'HEAD' ? 'master' : branch;
|
||||
|
||||
@ -158,7 +168,7 @@ class FlutterVersion {
|
||||
branch = 'dev';
|
||||
}
|
||||
|
||||
return '$branch/$commit';
|
||||
return branch;
|
||||
}
|
||||
|
||||
/// The amount of time we wait before pinging the server to check for the
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user