@@ -4,7 +4,7 @@ import type {
44} from '@mongodb-js/compass-connections/provider' ;
55import type { MongoLogWriter } from '@mongodb-js/compass-logging/provider' ;
66import type { TrackFunction } from '@mongodb-js/compass-telemetry/provider' ;
7- import { setupLoggerAndTelemetry } from '@mongosh/logging' ;
7+ import { setupLoggingAndTelemetry } from '@mongosh/logging' ;
88import { EventEmitter } from 'events' ;
99
1010declare const __webpack_require__ : typeof require ;
@@ -52,30 +52,36 @@ export function createWorkerRuntime(
5252) : typeof WorkerRuntime [ 'prototype' ] {
5353 const emitter = new EventEmitter ( ) ;
5454
55- setupLoggerAndTelemetry (
56- emitter ,
57- log ,
58- {
55+ const loggingAndTelemetry = setupLoggingAndTelemetry ( {
56+ bus : emitter ,
57+ analytics : {
5958 identify : ( ) => {
6059 /* not needed */
6160 } ,
6261 // Prefix Segment events with `Shell ` to avoid event name collisions.
6362 // We always enable telemetry here, since the track call will
6463 // already check whether Compass telemetry is enabled or not.
6564 track : ( { event, properties } ) => {
66- return track ( `Shell ${ event } ` , properties , connectionInfo . current ) ;
65+ return track (
66+ `Shell ${ event as string } ` ,
67+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
68+ properties ,
69+ connectionInfo . current
70+ ) ;
6771 } ,
6872 flush : ( ) => {
6973 return Promise . resolve ( ) ; // not needed
7074 } ,
7175 } ,
72- {
76+ userTraits : {
7377 platform : process . platform ,
7478 arch : process . arch ,
7579 } ,
7680 // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-var-requires
77- require ( '../../package.json' ) . version
78- ) ;
81+ mongoshVersion : require ( '../../package.json' ) . version ,
82+ } ) ;
83+
84+ loggingAndTelemetry . attachLogger ( log ) ;
7985
8086 // We also don't need to pass a proper user id, since that is
8187 // handled by the Compass tracking code.
0 commit comments