3
3
* This module abstracts the exact service/framework used for tracking usage.
4
4
*/
5
5
import isGlob from 'is-glob'
6
- import { cloneDeep } from 'lodash'
6
+ import { cloneDeep , get } from 'lodash'
7
7
import jsonpath from 'jsonpath'
8
8
import { isRedisearchAvailable } from 'uiSrc/utils'
9
9
import { ApiEndpoints , KeyTypes } from 'uiSrc/constants'
10
10
import { KeyViewType } from 'uiSrc/slices/interfaces/keys'
11
11
import { IModuleSummary , ITelemetrySendEvent , ITelemetrySendPageView , RedisModulesKeyType } from 'uiSrc/telemetry/interfaces'
12
12
import { apiService } from 'uiSrc/services'
13
+ import { store } from 'uiSrc/slices/store'
13
14
import { AdditionalRedisModule } from 'apiSrc/modules/database/models/additional.redis.module'
14
15
import {
15
16
IRedisModulesSummary ,
@@ -19,6 +20,8 @@ import {
19
20
import { TelemetryEvent } from './events'
20
21
import { checkIsAnalyticsGranted } from './checkAnalytics'
21
22
23
+ export const getProvider = ( ) : string => get ( store . getState ( ) , 'connections.instances.connectedInstance.provider' , '' )
24
+
22
25
const TELEMETRY_EMPTY_VALUE = 'none'
23
26
24
27
const sendEventTelemetry = async ( { event, eventData = { } , traits = { } } : ITelemetrySendEvent ) => {
@@ -27,7 +30,9 @@ const sendEventTelemetry = async ({ event, eventData = {}, traits = {} }: ITelem
27
30
if ( ! isAnalyticsGranted ) {
28
31
return
29
32
}
30
- await apiService . post ( `${ ApiEndpoints . ANALYTICS_SEND_EVENT } ` , { event, eventData, traits } )
33
+ const provider = getProvider ( )
34
+ await apiService . post ( `${ ApiEndpoints . ANALYTICS_SEND_EVENT } ` ,
35
+ { event, eventData : { ...eventData , provider } , traits } )
31
36
} catch ( e ) {
32
37
// continue regardless of error
33
38
}
@@ -39,7 +44,8 @@ const sendPageViewTelemetry = async ({ name, eventData }: ITelemetrySendPageView
39
44
if ( ! isAnalyticsGranted ) {
40
45
return
41
46
}
42
- await apiService . post ( `${ ApiEndpoints . ANALYTICS_SEND_PAGE } ` , { event : name , eventData, } )
47
+ const provider = getProvider ( )
48
+ await apiService . post ( `${ ApiEndpoints . ANALYTICS_SEND_PAGE } ` , { event : name , eventData : { ...eventData , provider } } )
43
49
} catch ( e ) {
44
50
// continue regardless of error
45
51
}
0 commit comments