Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add telemetry events for new qna, luis and speech flows #7227

Merged
merged 15 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
setHighlightLUIS(true);
},
onClick: (step) => {
TelemetryClient.track('GettingStartedActionClicked', { taskName: 'luis', priority: 'required' });
openLink(linkToLUISSettings);
if (!step?.checked) {
setDisplayManageLuis(true);
Expand All @@ -144,6 +145,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
setHighlightQNA(true);
},
onClick: (step) => {
TelemetryClient.track('GettingStartedActionClicked', { taskName: 'qna', priority: 'required' });
openLink(linktoQNASettings);
if (!step?.checked) {
setDisplayManageQNA(true);
Expand All @@ -165,6 +167,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
required: true,
checked: hasPublishingProfile,
onClick: (step) => {
TelemetryClient.track('GettingStartedActionClicked', { taskName: 'publishing', priority: 'recommended' });
openLink(linkToPublishProfile);
},
});
Expand All @@ -179,6 +182,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
learnMore: '',
checked: false,
onClick: () => {
TelemetryClient.track('GettingStartedActionClicked', { taskName: 'packages', priority: 'optional' });
openLink(linkToPackageManager);
},
},
Expand All @@ -189,6 +193,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
learnMore: '',
checked: false,
onClick: () => {
TelemetryClient.track('GettingStartedActionClicked', { taskName: 'editlg', priority: 'optional' });
openLink(linkToLGEditor);
},
},
Expand All @@ -199,6 +204,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
learnMore: '',
checked: false,
onClick: () => {
TelemetryClient.track('GettingStartedActionClicked', { taskName: 'editlu', priority: 'optional' });
openLink(linkToLUEditor);
},
},
Expand All @@ -211,6 +217,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
learnMore: '',
checked: false,
onClick: () => {
TelemetryClient.track('GettingStartedActionClicked', { taskName: 'insights', priority: 'optional' });
openLink(linkToAppInsights);
},
},
Expand All @@ -221,6 +228,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
learnMore: '',
checked: false,
onClick: () => {
TelemetryClient.track('GettingStartedActionClicked', { taskName: 'devops', priority: 'optional' });
openLink(linkToDevOps);
},
},
Expand All @@ -234,6 +242,7 @@ export const GetStartedNextSteps: React.FC<GetStartedProps> = (props) => {
learnMore: '',
checked: false,
onClick: () => {
TelemetryClient.track('GettingStartedActionClicked', { taskName: 'connections', priority: 'optional' });
openLink(linkToConnections);
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { ProvisionHandoff } from '@bfc/ui-shared';
import sortBy from 'lodash/sortBy';
import { NeutralColors } from '@uifabric/fluent-theme';

import TelemetryClient from '../../telemetry/TelemetryClient';
import { AuthClient } from '../../utils/authClient';
import { AuthDialog } from '../../components/Auth/AuthDialog';
import { armScopes } from '../../constants';
Expand Down Expand Up @@ -255,6 +256,13 @@ export const ManageService = (props: ManageServiceProps) => {
}
}

TelemetryClient.track('SettingsGetKeysCreateNewResourceStarted', {
subscriptionId,
region,
resourceType: props.serviceName,
createNewResourceGroup: resourceGroupKey === CREATE_NEW_KEY,
});

try {
if (props.createServiceInBackground) {
props.createService(tokenCredentials, subscriptionId, resourceGroupName, resourceName, region);
Expand All @@ -267,6 +275,13 @@ export const ManageService = (props: ManageServiceProps) => {
region
);

TelemetryClient.track('SettingsGetKeysCreateNewResourceCompleted', {
subscriptionId,
region,
resourceType: props.serviceName,
createNewResourceGroup: resourceGroupKey === CREATE_NEW_KEY,
});

setKey(newKey);
// ALL DONE!
// this will pass the new values back to the caller
Expand Down Expand Up @@ -356,6 +371,11 @@ export const ManageService = (props: ManageServiceProps) => {
};

const chooseExistingKey = () => {
TelemetryClient.track('SettingsGetKeysExistingResourceSelected', {
subscriptionId,
resourceType: props.serviceName,
});

// close the modal!
props.onGetKey({
key: key,
Expand Down Expand Up @@ -385,6 +405,10 @@ export const ManageService = (props: ManageServiceProps) => {

const performNextAction = () => {
if (nextAction === 'handoff') {
TelemetryClient.track('SettingsGetKeysResourceRequestSelected', {
subscriptionId,
resourceType: props.serviceName,
});
setShowHandoff(true);
props.onDismiss();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SearchManagementClient } from '@azure/arm-search';
import { WebSiteManagementClient } from '@azure/arm-appservice';
import { ApplicationInsightsManagementClient } from '@azure/arm-appinsights';

import TelemetryClient from '../../telemetry/TelemetryClient';
import {
getCompletedQNANotificationCardProps,
getPendingQNANotificationCardProps,
Expand Down Expand Up @@ -208,6 +209,13 @@ export const provisionQNADispatcher = () => {
});
settingStorage.setField(projectId, 'qna.endpointKey', endpointKey);

TelemetryClient.track('SettingsGetKeysCreateNewResourceCompleted', {
subscriptionId,
region,
createNewResourceGroup: false,
resourceType: 'QnA Maker',
});

deleteNotificationInternal(callbackHelpers, notification.id);
const timeElapsed = Math.floor((new Date().getTime() - startTime) / (60 * 1000));
const completedNotification = createNotification(getCompletedQNANotificationCardProps({ time: timeElapsed }));
Expand Down
33 changes: 33 additions & 0 deletions Composer/packages/types/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type ApplicationEvents = {

type GettingStartedEvents = {
GettingStartedLinkClicked: { method: 'link' | 'button'; url: string };
GettingStartedActionClicked: { taskName: string; priority: string };
};

type PackageManagerEvents = {
Expand Down Expand Up @@ -107,11 +108,29 @@ type QnaEvents = {
AlternateQnAPhraseAdded: undefined;
};

type ResourcesItem = {
GeoffCoxMSFT marked this conversation as resolved.
Show resolved Hide resolved
description: string;
text: string;
tier: string;
group: string;
key: string;
required: boolean;
[key: string]: any;
};

type PublishingEvents = {
NewPublishingProfileStarted: undefined;
NewPublishingProfileSaved: { type: string; msAppId?: string; subscriptionId?: string };
PublishingProfileStarted: { target: string; projectId: string; msAppId?: string; subscriptionId?: string };
PublishingProfileCompleted: { target: string; projectId: string; msAppId?: string; subscriptionId?: string };
ProvisionAddResourcesNavigate: undefined;
ProvisionConfigureResources: undefined;
ProvisionEditJSON: undefined;
ProvisionReviewResources: undefined;
ProvisionStart: { region: string; subscriptionId: string; externalResources: ResourcesItem[] };
ProvisionCancel: undefined;
ProvisionShowHandoff: undefined;
ProvisionAddResourcesCancel: undefined;
};

type AppSettingsEvents = {
Expand All @@ -121,6 +140,20 @@ type AppSettingsEvents = {
type BotSettingsEvents = {
CustomRuntimeToggleChanged: { enabled: boolean };
GetNewRuntime: { runtimeType: string };
SettingsGetKeysExistingResourceSelected: { subscriptionId: string; resourceType: string };
SettingsGetKeysCreateNewResourceStarted: {
subscriptionId: string;
resourceType: string;
createNewResourceGroup: boolean;
region: string;
};
SettingsGetKeysCreateNewResourceCompleted: {
subscriptionId: string;
resourceType: string;
createNewResourceGroup: boolean;
region: string;
};
SettingsGetKeysResourceRequestSelected: { subscriptionId?: string; resourceType: string };
};

type LgEditorEvents = {
Expand Down
25 changes: 24 additions & 1 deletion extensions/azurePublish/src/components/azureProvisionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ import styled from '@emotion/styled';
import { useState, useMemo, useEffect, Fragment, useCallback, useRef } from 'react';
import { Dropdown, IDropdownOption } from 'office-ui-fabric-react/lib/Dropdown';
import { DefaultButton, PrimaryButton } from 'office-ui-fabric-react/lib/Button';
import { logOut, usePublishApi, getTenants, getARMTokenForTenant, useLocalStorage } from '@bfc/extension-client';
import {
logOut,
usePublishApi,
getTenants,
getARMTokenForTenant,
useLocalStorage,
useTelemetryClient,
TelemetryClient,
} from '@bfc/extension-client';
import { Subscription } from '@azure/arm-subscriptions/esm/models';
import { DeployLocation, AzureTenant } from '@botframework-composer/types';
import { FluentTheme, NeutralColors } from '@uifabric/fluent-theme';
Expand Down Expand Up @@ -258,6 +266,7 @@ export const AzureProvisionDialog: React.FC = () => {
getTenantIdFromCache,
setTenantId,
} = usePublishApi();
const telemetryClient: TelemetryClient = useTelemetryClient();

const { setItem, getItem, clearAll } = useLocalStorage();
// set type of publish - azurePublish or azureFunctionsPublish
Expand Down Expand Up @@ -337,18 +346,22 @@ export const AzureProvisionDialog: React.FC = () => {
setPage(page);
GeoffCoxMSFT marked this conversation as resolved.
Show resolved Hide resolved
switch (page) {
case PageTypes.AddResources:
telemetryClient.track('ProvisionAddResourcesNavigate');
setTitle(DialogTitle.ADD_RESOURCES);
break;
case PageTypes.ChooseAction:
setTitle(DialogTitle.CHOOSE_ACTION);
break;
case PageTypes.ConfigProvision:
telemetryClient.track('ProvisionConfigureResources');
setTitle(DialogTitle.CONFIG_RESOURCES);
break;
case PageTypes.EditJson:
telemetryClient.track('ProvisionEditJSON');
setTitle(DialogTitle.EDIT);
break;
case PageTypes.ReviewResource:
telemetryClient.track('ProvisionReviewResources');
setTitle(DialogTitle.REVIEW);
break;
}
Expand Down Expand Up @@ -671,6 +684,13 @@ export const AzureProvisionDialog: React.FC = () => {

const onSubmit = useCallback((options) => {
// call back to the main Composer API to begin this process...

telemetryClient.track('ProvisionStart', {
region: options.location,
subscriptionId: options.subscription,
externalResources: options.externalResources,
});

startProvision(options);
clearAll();
closeDialog();
Expand Down Expand Up @@ -941,6 +961,7 @@ export const AzureProvisionDialog: React.FC = () => {
style={{ margin: '0 4px' }}
text={formatMessage('Cancel')}
onClick={() => {
telemetryClient.track('ProvisionCancel');
closeDialog();
}}
/>
Expand Down Expand Up @@ -1036,6 +1057,7 @@ export const AzureProvisionDialog: React.FC = () => {
text={formatMessage('Next')}
onClick={() => {
if (formData.creationType === 'generate') {
telemetryClient.track('ProvisionShowHandoff');
setShowHandoff(true);
} else {
setPageAndTitle(PageTypes.ReviewResource);
Expand All @@ -1059,6 +1081,7 @@ export const AzureProvisionDialog: React.FC = () => {
style={{ margin: '0 4px' }}
text={formatMessage('Cancel')}
onClick={() => {
telemetryClient.track('ProvisionAddResourcesCancel');
closeDialog();
}}
/>
Expand Down