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
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ updates:
- dependency-name: "@mongosh/*"
- dependency-name: "@mongodb-js/*"
- dependency-name: os-dns-native
- dependency-name: native-machine-id
- dependency-name: system-ca

# All the electron and its related deps
Expand All @@ -36,6 +37,7 @@ updates:
- "mongodb-client-encryption"
- "kerberos"
- "os-dns-native"
- "native-machine-id"
- "system-ca"
- "saslprep"

Expand Down
1 change: 1 addition & 0 deletions configs/webpack-config-compass/src/externals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const sharedExternals: string[] = [
'keytar',
'kerberos',
'interruptor',
'native-machine-id',
'os-dns-native',
'system-ca',
'win-export-certificate-and-key',
Expand Down
2 changes: 2 additions & 0 deletions docs/tracking-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ Traits sent along with the Segment identify call
- **arch** (required): `string`
- The architecture of the system's processor, derived from Node.js `os.arch()`.
'x64' for 64-bit processors and 'arm' for ARM processors.
- **device_id** (required): `string`
- A unique identifier for the device running Compass. Set to `"unknown"` if not available.
- **os_type** (optional): `string | undefined`
- The type of operating system, including specific operating system
names or types (e.g., 'Linux', 'Windows_NT', 'Darwin').
Expand Down
15 changes: 15 additions & 0 deletions package-lock.json

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

9 changes: 9 additions & 0 deletions packages/compass-e2e-tests/helpers/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { EJSON } from 'bson';
import type { MongoLogEntry } from 'mongodb-log-writer';
import { TEST_COMPASS_WEB } from './compass';
import type { CompassBrowser } from './compass-browser';
import { expect } from 'chai';

export type Telemetry = {
requests: any[];
Expand Down Expand Up @@ -109,3 +110,11 @@ export async function startTelemetryServer(): Promise<Telemetry> {
screens,
};
}

export function deleteCommonVariedProperties(entry: unknown): void {
expect(entry).to.have.property('connection_id');
delete (entry as { connection_id: unknown }).connection_id;

// Device ID is not set in all track events so we delete without asserting.
delete (entry as { device_id: unknown }).device_id;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { expect } from 'chai';
import type { CompassBrowser } from '../helpers/compass-browser';
import { startTelemetryServer } from '../helpers/telemetry';
import {
deleteCommonVariedProperties,
startTelemetryServer,
} from '../helpers/telemetry';
import type { Telemetry } from '../helpers/telemetry';
import {
init,
Expand Down Expand Up @@ -59,8 +62,7 @@ describe('Bulk Delete', function () {
// Check the telemetry
const openedEvent = await telemetryEntry('Bulk Delete Opened');

expect(openedEvent.connection_id).to.exist;
delete openedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(openedEvent);

expect(openedEvent).to.deep.equal({});

Expand Down Expand Up @@ -95,8 +97,7 @@ describe('Bulk Delete', function () {

// this id is always different, because the connection is not a saved one
// so we just check it exists for simplicity
expect(executedEvent.connection_id).to.exist;
delete executedEvent.connection_id;
deleteCommonVariedProperties(executedEvent);

expect(executedEvent).to.deep.equal({});

Expand Down Expand Up @@ -177,8 +178,7 @@ describe('Bulk Delete', function () {
// Check the telemetry
const openedEvent = await telemetryEntry('Delete Export Opened');

expect(openedEvent.connection_id).to.exist;
delete openedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(openedEvent);

expect(openedEvent).to.deep.equal({});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { expect } from 'chai';
import type { CompassBrowser } from '../helpers/compass-browser';
import { startTelemetryServer } from '../helpers/telemetry';
import {
deleteCommonVariedProperties,
startTelemetryServer,
} from '../helpers/telemetry';
import type { Telemetry } from '../helpers/telemetry';
import {
init,
Expand Down Expand Up @@ -59,8 +62,7 @@ describe('Bulk Update', () => {
// Check the telemetry
const openedEvent = await telemetryEntry('Bulk Update Opened');

expect(openedEvent.connection_id).to.exist;
delete openedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(openedEvent);

expect(openedEvent).to.deep.equal({
isUpdatePreviewSupported: true,
Expand Down Expand Up @@ -125,8 +127,7 @@ describe('Bulk Update', () => {
// Check the telemetry
const executedEvent = await telemetryEntry('Bulk Update Executed');

expect(executedEvent.connection_id).to.exist;
delete executedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(executedEvent);

expect(executedEvent).to.deep.equal({
isUpdatePreviewSupported: true,
Expand Down Expand Up @@ -173,8 +174,7 @@ describe('Bulk Update', () => {
// Check the telemetry
const favoritedEvent = await telemetryEntry('Bulk Update Favorited');

expect(favoritedEvent.connection_id).to.exist;
delete favoritedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(favoritedEvent);

expect(favoritedEvent).to.deep.equal({
isUpdatePreviewSupported: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import chai from 'chai';
import clipboard from 'clipboardy';
import type { CompassBrowser } from '../helpers/compass-browser';
import { startTelemetryServer } from '../helpers/telemetry';
import {
deleteCommonVariedProperties,
startTelemetryServer,
} from '../helpers/telemetry';
import type { Telemetry } from '../helpers/telemetry';
import {
init,
Expand Down Expand Up @@ -168,8 +171,7 @@ describe('Collection documents tab', function () {
// Check the telemetry
const queryExecutedEvent = await telemetryEntry('Query Executed');

expect(queryExecutedEvent.connection_id).to.exist;
delete queryExecutedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(queryExecutedEvent);

expect(queryExecutedEvent).to.deep.equal({
changed_maxtimems: false,
Expand Down Expand Up @@ -208,8 +210,7 @@ describe('Collection documents tab', function () {
// Check the telemetry
const queryExecutedEvent = await telemetryEntry('Query Executed');

expect(queryExecutedEvent.connection_id).to.exist;
delete queryExecutedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(queryExecutedEvent);

expect(queryExecutedEvent).to.deep.equal({
changed_maxtimems: false,
Expand Down
44 changes: 17 additions & 27 deletions packages/compass-e2e-tests/tests/collection-export.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { promises as fs } from 'fs';
import { expect } from 'chai';
import type { CompassBrowser } from '../helpers/compass-browser';
import { startTelemetryServer } from '../helpers/telemetry';
import {
deleteCommonVariedProperties,
startTelemetryServer,
} from '../helpers/telemetry';
import type { Telemetry } from '../helpers/telemetry';
import {
init,
Expand Down Expand Up @@ -143,8 +146,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
has_projection: false,
Expand Down Expand Up @@ -214,8 +216,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
has_projection: false,
Expand Down Expand Up @@ -283,8 +284,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
has_projection: true,
Expand Down Expand Up @@ -337,8 +337,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: true,
file_type: 'csv',
Expand Down Expand Up @@ -411,8 +410,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
file_type: 'json',
Expand Down Expand Up @@ -480,8 +478,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
file_type: 'json',
Expand Down Expand Up @@ -534,8 +531,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: true,
file_type: 'json',
Expand Down Expand Up @@ -590,8 +586,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: true,
file_type: 'json',
Expand Down Expand Up @@ -681,8 +676,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
file_type: 'csv',
Expand Down Expand Up @@ -768,8 +762,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
file_type: 'json',
Expand Down Expand Up @@ -863,8 +856,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
file_type: 'csv',
Expand Down Expand Up @@ -978,8 +970,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
file_type: 'csv',
Expand Down Expand Up @@ -1081,8 +1072,7 @@ describe('Collection export', function () {

const exportCompletedEvent = await telemetryEntry('Export Completed');
delete exportCompletedEvent.duration; // Duration varies.
expect(exportCompletedEvent.connection_id).to.exist;
delete exportCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(exportCompletedEvent);
expect(exportCompletedEvent).to.deep.equal({
all_docs: false,
file_type: 'json',
Expand Down
8 changes: 5 additions & 3 deletions packages/compass-e2e-tests/tests/collection-import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import {
} from '../helpers/compass';
import type { Compass } from '../helpers/compass';
import * as Selectors from '../helpers/selectors';
import { startTelemetryServer } from '../helpers/telemetry';
import {
deleteCommonVariedProperties,
startTelemetryServer,
} from '../helpers/telemetry';
import type { Telemetry } from '../helpers/telemetry';
import {
createDummyCollections,
Expand Down Expand Up @@ -752,8 +755,7 @@ describe('Collection import', function () {

const importCompletedEvent = await telemetryEntry('Import Completed');
delete importCompletedEvent.duration; // Duration varies.
expect(importCompletedEvent.connection_id).to.exist;
delete importCompletedEvent.connection_id; // connection_id varies
deleteCommonVariedProperties(importCompletedEvent);
expect(importCompletedEvent).to.deep.equal({
delimiter: ',',
newline: '\n',
Expand Down
Loading