Skip to content

Commit 89abf14

Browse files
committed
chore(query-bar): add telemetry for default sort COMPASS-9763
1 parent f1c5f4f commit 89abf14

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/compass-crud/src/stores/crud-store.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,13 +1596,19 @@ class CrudStoreImpl
15961596

15971597
if (onApply) {
15981598
const { isTimeSeries, isReadonly } = this.state;
1599+
const { defaultSortOrder } = this.preferences.getPreferences();
15991600
this.track(
16001601
'Query Executed',
16011602
{
16021603
has_projection:
16031604
!!query.project && Object.keys(query.project).length > 0,
16041605
has_skip: (query.skip ?? 0) > 0,
16051606
has_sort: !!query.sort && Object.keys(query.sort).length > 0,
1607+
default_sort: !defaultSortOrder
1608+
? 'none'
1609+
: /_id/.test(defaultSortOrder)
1610+
? '_id'
1611+
: 'natural',
16061612
has_limit: (query.limit ?? 0) > 0,
16071613
has_collation: !!query.collation,
16081614
changed_maxtimems: query.maxTimeMS !== DEFAULT_INITIAL_MAX_TIME_MS,

packages/compass-telemetry/src/telemetry-events.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,11 @@ type QueryExecutedEvent = ConnectionScopedEvent<{
17351735
*/
17361736
has_sort: boolean;
17371737

1738+
/**
1739+
* Indicates which default sort was set in settings
1740+
*/
1741+
default_sort: 'natural' | '_id' | 'none';
1742+
17381743
/**
17391744
* Indicates whether the query includes a limit operation.
17401745
*/

0 commit comments

Comments
 (0)