Skip to content

Commit

Permalink
chore(telemetry): add "Index Create Failed" to mirror Index Created C…
Browse files Browse the repository at this point in the history
…OMPASS-8100 (#6360)

* add Index Failed to mirror Index Created

* name it Index Create Failed like in the ticket rather
  • Loading branch information
lerouxb authored Oct 14, 2024
1 parent 0828207 commit 968edaa
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/compass-indexes/src/modules/regular-indexes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ export function createRegularIndex(
await dispatch(refreshRegularIndexes());
} catch (err) {
dispatch(indexCreationFailed(inProgressIndexId, (err as Error).message));
track('Index Create Failed', trackEvent, connectionInfoRef.current);
}
};
}
Expand Down
8 changes: 8 additions & 0 deletions packages/compass-indexes/src/modules/search-indexes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,14 @@ export const createIndex = ({
dispatch(
createSearchIndexFailed(ATLAS_SEARCH_SERVER_ERRORS[error] || error)
);
track(
'Index Create Failed',
{
atlas_search: true,
type,
},
connectionInfoRef.current
);
return;
}

Expand Down
57 changes: 57 additions & 0 deletions packages/compass-telemetry/src/telemetry-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,62 @@ type IndexCreatedEvent = ConnectionScoped<{
};
}>;

/**
* This event is fired when user creates an index and it fails.
*
* @category Indexes
*/
type IndexCreateFailedEvent = ConnectionScoped<{
name: 'Index Create Failed';

payload: {
/**
* Indicates whether the index is unique.
*/
unique?: boolean;

/**
* Specifies the time-to-live (TTL) setting for the index.
*/
ttl?: any;

/**
* Indicates whether the index is a columnstore index.
*/
columnstore_index?: boolean;

/**
* Indicates if the index has a columnstore projection.
*/
has_columnstore_projection?: any;

/**
* Indicates if the index includes a wildcard projection.
*/
has_wildcard_projection?: any;

/**
* Specifies if the index uses a custom collation.
*/
custom_collation?: any;

/**
* Indicates whether the index is a geospatial index.
*/
geo?: boolean;

/**
* Indicates whether the index is an Atlas Search index.
*/
atlas_search?: boolean;

/**
* Specifies the type of the index.
*/
type?: string;
};
}>;

/**
* This event is fired when user updates an index.
*
Expand Down Expand Up @@ -2556,6 +2612,7 @@ export type TelemetryEvent =
| ImportErrorLogOpenedEvent
| ImportOpenedEvent
| IndexCreatedEvent
| IndexCreateFailedEvent
| IndexCreateOpenedEvent
| IndexDroppedEvent
| IndexEditedEvent
Expand Down

0 comments on commit 968edaa

Please sign in to comment.