Skip to content

Commit

Permalink
Merge pull request #2446 from snyk/feat/analytics-arch
Browse files Browse the repository at this point in the history
feat: include os architecture in analytics
  • Loading branch information
Jahed Ahmed committed Dec 29, 2021
2 parents c2aa312 + 3202e8e commit e91a9bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/analytics/getStandardData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as version from '../version';
import { v4 as uuidv4 } from 'uuid';
import * as os from 'os';
const osName = require('os-name');
import * as crypto from 'crypto';
import { isCI } from '../is-ci';
import {
Expand All @@ -11,12 +10,12 @@ import {
getIntegrationEnvironmentVersion,
getCommandVersion,
} from './sources';

import { StandardAnalyticsData } from './types';
import { MetricsCollector } from '../metrics';
import * as createDebug from 'debug';
import { ArgsOptions } from '../../cli/args';

const osName = require('os-name');
const debug = createDebug('snyk');
const START_TIME = Date.now();

Expand Down Expand Up @@ -49,6 +48,9 @@ export async function getStandardData(

const data = {
os: osName(os.platform(), os.release()),
osPlatform: os.platform(),
osRelease: os.release(),
osArch: os.arch(),
version: snykVersion,
nodeVersion: process.version,
standalone: isStandalone,
Expand Down
6 changes: 6 additions & 0 deletions test/jest/unit/lib/analytics/getStandardData.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ describe('getStandardData returns object', () => {

expect(standardData).toMatchObject({
os: expect.any(String),
osPlatform: expect.any(String),
osRelease: expect.any(String),
osArch: expect.any(String),
version: '1.0.0-monorepo',
id: expect.any(String),
ci: expect.any(Boolean),
Expand Down Expand Up @@ -49,6 +52,9 @@ describe('getStandardData returns object', () => {
const standardData = await getStandardData(args);
expect(standardData).toMatchObject({
os: expect.any(String),
osPlatform: expect.any(String),
osRelease: expect.any(String),
osArch: expect.any(String),
version: '1.0.0-monorepo',
id: expect.any(String),
ci: expect.any(Boolean),
Expand Down

0 comments on commit e91a9bc

Please sign in to comment.