Skip to content

Commit 9adf265

Browse files
committed
add telemetry
1 parent c70b197 commit 9adf265

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

packages/compass-data-modeling/src/store/export-diagram.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export function exportDiagram(
103103
Promise<void>,
104104
ExportStartedAction | ExportCompletedAction
105105
> {
106-
return async (dispatch, getState) => {
106+
return async (dispatch, getState, { track }) => {
107107
const {
108108
exportDiagram: { exportFormat, isExporting },
109109
diagram,
@@ -129,6 +129,9 @@ export function exportDiagram(
129129
cancelExportAbortController.signal
130130
);
131131
}
132+
track('Data Modeling Diagram Exported', {
133+
format: exportFormat,
134+
});
132135
} catch (error) {
133136
if (!isCancelError(error)) {
134137
openToast('export-diagram-error', {
@@ -148,8 +151,14 @@ export function exportDiagram(
148151
};
149152
}
150153

151-
export function showExportModal(): ModalOpenedAction {
152-
return { type: ExportDiagramActionTypes.MODAL_OPENED };
154+
export function showExportModal(): DataModelingThunkAction<
155+
void,
156+
ModalOpenedAction
157+
> {
158+
return (dispatch, getState, { track }) => {
159+
track('Screen', { name: 'export_diagram_modal' }, undefined);
160+
return dispatch({ type: ExportDiagramActionTypes.MODAL_OPENED });
161+
};
153162
}
154163

155164
export function closeExportModal(): DataModelingThunkAction<

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,7 +2708,8 @@ type ScreenEvent = ConnectionScopedEvent<{
27082708
| 'save_pipeline_modal'
27092709
| 'shell_info_modal'
27102710
| 'update_search_index_modal'
2711-
| 'end_of_life_mongodb_modal';
2711+
| 'end_of_life_mongodb_modal'
2712+
| 'export_diagram_modal';
27122713
};
27132714
}>;
27142715

@@ -2876,6 +2877,18 @@ type CreateIndexStrategiesDocumentationClicked = CommonEvent<{
28762877
};
28772878
}>;
28782879

2880+
/**
2881+
* This event is fired when user exports data modeling diagram.
2882+
*
2883+
* @category Data Modeling
2884+
*/
2885+
type DataModelingDiagramExported = CommonEvent<{
2886+
name: 'Data Modeling Diagram Exported';
2887+
payload: {
2888+
format: 'png' | 'json';
2889+
};
2890+
}>;
2891+
28792892
export type TelemetryEvent =
28802893
| AggregationCanceledEvent
28812894
| AggregationCopiedEvent
@@ -3021,4 +3034,5 @@ export type TelemetryEvent =
30213034
| CreateIndexInputIndexCopied
30223035
| CreateIndexIndexSuggestionsCopied
30233036
| CreateIndexStrategiesDocumentationClicked
3024-
| UUIDEncounteredEvent;
3037+
| UUIDEncounteredEvent
3038+
| DataModelingDiagramExported;

0 commit comments

Comments
 (0)