mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 02:54:21 +08:00
feat(@angular/cli): report RAM in gigabytes instead of megabytes
Otherwise its too much noise. Some people have weird MB count probably due to containers and VMs.
This commit is contained in:
parent
3e5e2574c7
commit
46ade49a2f
@ -43,7 +43,7 @@ Note: There's a limit of 20 custom dimensions.
|
||||
|:---:|:---|:---|
|
||||
| 1 | `CPU Count` | `number` |
|
||||
| 2 | `CPU Speed` | `number` |
|
||||
| 3 | `RAM (In MB)` | `number` |
|
||||
| 3 | `RAM (In GB)` | `number` |
|
||||
| 4 | `Node Version` | `number` |
|
||||
| 5 | `Flag: --style` | `string` |
|
||||
| 6 | `--collection` | `string` |
|
||||
|
@ -614,7 +614,7 @@ export declare class MultiAnalytics implements Analytics {
|
||||
export declare enum NgCliAnalyticsDimensions {
|
||||
CpuCount = 1,
|
||||
CpuSpeed = 2,
|
||||
RamInMegabytes = 3,
|
||||
RamInGigabytes = 3,
|
||||
NodeVersion = 4,
|
||||
NgAddCollection = 6,
|
||||
NgBuildBuildEventLog = 7,
|
||||
|
@ -20,7 +20,7 @@ import { isTTY } from '../utilities/tty';
|
||||
const analyticsDebug = debug('ng:analytics'); // Generate analytics, including settings and users.
|
||||
const analyticsLogDebug = debug('ng:analytics:log'); // Actual logs of events.
|
||||
|
||||
const BYTES_PER_MEGABYTES = 1024 * 1024;
|
||||
const BYTES_PER_GIGABYTES = 1024 * 1024 * 1024;
|
||||
|
||||
let _defaultAngularCliPropertyCache: string;
|
||||
export const AnalyticsProperties = {
|
||||
@ -129,8 +129,8 @@ function _getCpuSpeed() {
|
||||
* @private
|
||||
*/
|
||||
function _getRamSize() {
|
||||
// Report in megabytes. Otherwise it's too much noise.
|
||||
return Math.floor(os.totalmem() / BYTES_PER_MEGABYTES);
|
||||
// Report in gigabytes (or closest). Otherwise it's too much noise.
|
||||
return Math.round(os.totalmem() / BYTES_PER_GIGABYTES);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -287,7 +287,7 @@ export class UniversalAnalytics implements analytics.Analytics {
|
||||
// We set custom metrics for values we care about.
|
||||
this._dimensions[analytics.NgCliAnalyticsDimensions.CpuCount] = _getCpuCount();
|
||||
this._dimensions[analytics.NgCliAnalyticsDimensions.CpuSpeed] = _getCpuSpeed();
|
||||
this._dimensions[analytics.NgCliAnalyticsDimensions.RamInMegabytes] = _getRamSize();
|
||||
this._dimensions[analytics.NgCliAnalyticsDimensions.RamInGigabytes] = _getRamSize();
|
||||
this._dimensions[analytics.NgCliAnalyticsDimensions.NodeVersion] = _getNumericNodeVersion();
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@ export * from './logging';
|
||||
export * from './multi';
|
||||
export * from './noop';
|
||||
|
||||
|
||||
/**
|
||||
* MAKE SURE TO KEEP THIS IN SYNC WITH THE TABLE AND CONTENT IN `/docs/design/analytics.md`.
|
||||
* WE LIST THOSE DIMENSIONS (AND MORE).
|
||||
@ -23,7 +22,7 @@ export * from './noop';
|
||||
export enum NgCliAnalyticsDimensions {
|
||||
CpuCount = 1,
|
||||
CpuSpeed = 2,
|
||||
RamInMegabytes = 3,
|
||||
RamInGigabytes = 3,
|
||||
NodeVersion = 4,
|
||||
NgAddCollection = 6,
|
||||
NgBuildBuildEventLog = 7,
|
||||
@ -53,7 +52,7 @@ export enum NgCliAnalyticsMetrics {
|
||||
export const NgCliAnalyticsDimensionsFlagInfo: { [name: string]: [string, string] } = {
|
||||
CpuCount: ['CPU Count', 'number'],
|
||||
CpuSpeed: ['CPU Speed', 'number'],
|
||||
RamInMegabytes: ['RAM (In MB)', 'number'],
|
||||
RamInGigabytes: ['RAM (In GB)', 'number'],
|
||||
NodeVersion: ['Node Version', 'number'],
|
||||
NgAddCollection: ['--collection', 'string'],
|
||||
NgBuildBuildEventLog: ['--buildEventLog', 'boolean'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user