Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/schema/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { getPrismaVersion } from '@zenstackhq/sdk';
import exitHook from 'async-exit-hook';
import { CommanderError } from 'commander';
import { init, Mixpanel } from 'mixpanel';
import { machineIdSync } from 'node-machine-id';
import * as os from 'os';
import sleep from 'sleep-promise';
import { CliError } from './cli/cli-error';
import { TELEMETRY_TRACKING_TOKEN } from './constants';
import isDocker from './utils/is-docker';
import { getVersion } from './utils/version-utils';
import { getMachineId } from './utils/machine-id-utils';

/**
* Telemetry events
Expand All @@ -32,7 +32,7 @@ export type TelemetryEvents =
*/
export class Telemetry {
private readonly mixpanel: Mixpanel | undefined;
private readonly hostId = machineIdSync();
private readonly hostId = getMachineId();
private readonly sessionid = createId();
private readonly _os_type = os.type();
private readonly _os_release = os.release();
Expand Down
11 changes: 11 additions & 0 deletions packages/schema/src/utils/machine-id-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { machineIdSync } from "node-machine-id";
import { v4 as uuid } from 'uuid';

export function getMachineId() {
// machineIdSync() is not compatible with non-shell hosts such as Vercel
try {
return machineIdSync();
} catch {
return uuid();
}
}
21 changes: 11 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.