Skip to content
Open
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
15 changes: 12 additions & 3 deletions packages/compass-crud/src/stores/crud-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1200,10 +1200,12 @@ class CrudStoreImpl
}

async runBulkUpdate() {
const query = this.queryBar.getLastAppliedQuery('crud');
this.track(
'Bulk Update Executed',
{
isUpdatePreviewSupported: this.state.isUpdatePreviewSupported,
has_filter: Object.keys(query.filter ?? {}).length > 0,
},
this.connectionInfoRef.current
);
Expand All @@ -1219,7 +1221,7 @@ class CrudStoreImpl
});

const { ns } = this.state;
const { filter = {} } = this.queryBar.getLastAppliedQuery('crud');
const { filter = {} } = query;
let update;
try {
update = parseShellBSON(this.state.bulkUpdate.updateText);
Expand Down Expand Up @@ -1956,7 +1958,14 @@ class CrudStoreImpl
}

async runBulkDelete() {
this.track('Bulk Delete Executed', {}, this.connectionInfoRef.current);
const query = this.queryBar.getLastAppliedQuery('crud');
this.track(
'Bulk Delete Executed',
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both of these events should be called either after the operation succeeds or just before it (dataservice call). In delete event we show a confirmation modal, to which user can ignore and we still track it. Similarly for update, if the query is invalid, we still track it.

{
has_filter: Object.keys(query.filter ?? {}).length > 0,
},
Comment thread
mabaasit marked this conversation as resolved.
this.connectionInfoRef.current
);

const { affected } = this.state.bulkDelete;
this.closeBulkDeleteDialog();
Expand All @@ -1976,7 +1985,7 @@ class CrudStoreImpl

if (confirmation) {
this.bulkDeleteInProgress();
const { filter = {} } = this.queryBar.getLastAppliedQuery('crud');
const { filter = {} } = query;
try {
await this.dataService.deleteMany(this.state.ns, filter);
this.bulkDeleteSuccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('Bulk Delete', function () {
// so we just check it exists for simplicity
deleteCommonVariedProperties(executedEvent);

expect(executedEvent).to.deep.equal({});
expect(executedEvent).to.deep.equal({ has_filter: true });

// The success toast is displayed
await browser.$(Selectors.BulkDeleteSuccessToast).waitForDisplayed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ describe('Bulk Update', () => {

expect(executedEvent).to.deep.equal({
isUpdatePreviewSupported: true,
has_filter: true,
});

await browser.runFindOperation('Documents', '{ i: 5, foo: "bar" }');
Expand Down
7 changes: 6 additions & 1 deletion packages/compass-telemetry/src/telemetry-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,8 @@ type BulkUpdateExecutedEvent = ConnectionScopedEvent<{
* Specifies if update preview was supported (the update preview runs inside a transaction.)
*/
isUpdatePreviewSupported: boolean;
/** Specifies if a filter was set in the query */
has_filter: boolean;
};
}>;

Expand All @@ -1018,7 +1020,10 @@ type BulkDeleteOpenedEvent = ConnectionScopedEvent<{
*/
type BulkDeleteExecutedEvent = ConnectionScopedEvent<{
name: 'Bulk Delete Executed';
payload: Record<string, never>;
payload: {
/** Specifies if a filter was set in the query */
has_filter: boolean;
};
Comment on lines 1022 to +1026
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This event payload shape changed from {} to include has_filter. There are existing telemetry assertions in e2e tests that expect an empty payload / only isUpdatePreviewSupported (e.g., packages/compass-e2e-tests/tests/collection-bulk-delete.test.ts and collection-bulk-update.test.ts). These will fail until updated to assert the new property.

Copilot uses AI. Check for mistakes.
}>;

/**
Expand Down
Loading