Interal vs External Telemetry (#521)
* count number of internal vs external (to msft) users
This commit is contained in:
Родитель
4f17b8e98b
Коммит
0dd5ec5a28
|
@ -27,7 +27,7 @@ export enum TELEMETRY_PAGE_NAMES {
|
|||
|
||||
export enum TELEMETRY_EVENTS {
|
||||
FETCH_DEVICES = 'fetch_devices',
|
||||
INIT = 'init',
|
||||
INTERNAL_USER = 'internal_user',
|
||||
UPDATE_BANNER_DISPLAYED = 'update_banner:displayed',
|
||||
UPDATE_BANNER_CLICKED = 'update_banner:clicked'
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
||||
import { TELEMETRY_EVENTS } from '../../constants/telemetry';
|
||||
import { appConfig } from '../../../appConfig/appConfig';
|
||||
import { isMicrosoftInternalDomain } from '../utils/utils';
|
||||
|
||||
export class AppInsightsClient {
|
||||
private static instance: ApplicationInsights;
|
||||
|
||||
|
@ -12,7 +14,7 @@ export class AppInsightsClient {
|
|||
} });
|
||||
try {
|
||||
appInsights.loadAppInsights();
|
||||
appInsights.trackEvent({name: TELEMETRY_EVENTS.INIT});
|
||||
appInsights.trackEvent({name: TELEMETRY_EVENTS.INTERNAL_USER}, {isInternal: isMicrosoftInternalDomain()});
|
||||
AppInsightsClient.instance = appInsights;
|
||||
} catch (e) {
|
||||
// tslint:disable-next-line:no-console
|
||||
|
|
|
@ -74,3 +74,14 @@ export const getParentFolder = (currentFolder: string): string => {
|
|||
return index === 0 ? '/' : index > 0 && currentFolder.substr(0, index);
|
||||
}
|
||||
};
|
||||
|
||||
export const isMicrosoftInternalDomain = (): boolean => {
|
||||
const msftInternalDomains = ['redmond.corp.microsoft.com', 'northamerica.corp.microsoft.com', 'fareast.corp.microsoft.com', 'ntdev.corp.microsoft.com', 'wingroup.corp.microsoft.com', 'southpacific.corp.microsoft.com', 'wingroup.windeploy.ntdev.microsoft.com', 'ddnet.microsoft.com', 'europe.corp.microsoft.com'];
|
||||
const userDnsDomain = process.env.userdnsdomain;
|
||||
if (!userDnsDomain) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const domain = userDnsDomain.toLowerCase();
|
||||
return msftInternalDomains.some(msftDomain => domain === msftDomain);
|
||||
};
|
||||
|
|
|
@ -47,7 +47,14 @@ const config: webpack.Configuration = {
|
|||
to: 'images',
|
||||
}
|
||||
]
|
||||
})
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
process: {
|
||||
env: {
|
||||
userdnsdomain: JSON.stringify(process.env.userdnsdomain),
|
||||
},
|
||||
},
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
// Add '.ts' and '.tsx' as resolvable extensions.
|
||||
|
|
Загрузка…
Ссылка в новой задаче