diff --git a/packages/compass-collection/src/components/collection-tab.tsx b/packages/compass-collection/src/components/collection-tab.tsx index 609698d38e0..5bcb7dd318f 100644 --- a/packages/compass-collection/src/components/collection-tab.tsx +++ b/packages/compass-collection/src/components/collection-tab.tsx @@ -22,6 +22,7 @@ import { } from './collection-tab-stats'; import type { CollectionSubtab } from '@mongodb-js/compass-workspaces'; import { useTelemetry } from '@mongodb-js/compass-telemetry/provider'; +import { useConnectionInfoAccess } from '@mongodb-js/compass-connections/provider'; function trackingIdForTabName(name: string) { return name.toLowerCase().replace(/ /g, '_'); @@ -119,6 +120,7 @@ const CollectionTabWithMetadata: React.FunctionComponent< stats, }) => { const track = useTelemetry(); + const connectionInfoAccess = useConnectionInfoAccess(); const { log, mongoLogId } = useLogger('COMPASS-COLLECTION-TAB-UI'); useEffect(() => { const activeSubTabName = currentTab @@ -126,11 +128,15 @@ const CollectionTabWithMetadata: React.FunctionComponent< : null; if (activeSubTabName) { - track('Screen', { - name: activeSubTabName, - }); + track( + 'Screen', + { + name: activeSubTabName, + }, + connectionInfoAccess.getCurrentConnectionInfo() + ); } - }, [currentTab, track]); + }, [currentTab, track, connectionInfoAccess]); const pluginTabs = useCollectionSubTabs(); const pluginModals = useCollectionScopedModals(); diff --git a/packages/compass/src/app/components/entrypoint.tsx b/packages/compass/src/app/components/entrypoint.tsx index 100977886e4..c263e42c6a9 100644 --- a/packages/compass/src/app/components/entrypoint.tsx +++ b/packages/compass/src/app/components/entrypoint.tsx @@ -25,8 +25,10 @@ import { LoggerProvider } from '@mongodb-js/compass-logging/provider'; import { TelemetryProvider } from '@mongodb-js/compass-telemetry/provider'; import { getAppName, getAppVersion } from '@mongodb-js/compass-utils'; import Home, { type HomeProps } from './home'; -import { createIpcSendTrack } from '@mongodb-js/compass-telemetry'; -import type { TelemetryServiceOptions } from '@mongodb-js/compass-telemetry/dist/generic-track'; +import { + type TelemetryServiceOptions, + createIpcSendTrack, +} from '@mongodb-js/compass-telemetry'; const WithPreferencesAndLoggerProviders: React.FC = ({ children }) => { const loggerProviderValue = useRef({