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

chore: Added telemetry to watch tab #8235

Merged
merged 1 commit into from
Jul 1, 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 @@ -40,6 +40,7 @@ import {
webChatTrafficState,
} from '../../../../../recoilModel';
import { WatchVariablePicker } from '../../WatchVariablePicker/WatchVariablePicker';
import TelemetryClient from '../../../../../telemetry/TelemetryClient';

import { WatchTabObjectValue } from './WatchTabObjectValue';

Expand Down Expand Up @@ -278,6 +279,10 @@ export const WatchTabContent: React.FC<DebugPanelTabHeaderProps> = ({ isActive }
if (selectedVariables?.length) {
selectedVariables.map((item: IObjectWithKey) => {
delete updatedUncommitted[item.key as string];
if (updatedCommitted[item.key as string]) {
// track only when we remove a property that is actually being watched
TelemetryClient.track('StateWatchPropertyRemoved', { property: updatedCommitted[item.key as string] });
}
delete updatedCommitted[item.key as string];
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
userSettingsState,
watchedVariablesState,
} from '../../../../recoilModel';
import TelemetryClient from '../../../../telemetry/TelemetryClient';

import { PropertyItem } from './utils/components/PropertyTreeItem';
import { computePropertyItemTree, getAllNodes, WatchDataPayload } from './utils/helpers';
Expand Down Expand Up @@ -135,6 +136,7 @@ export const WatchVariablePicker = React.memo((props: WatchVariablePickerProps)
setQuery(path);
event?.preventDefault();
setErrorMessage('');
TelemetryClient.track('StateWatchPropertyAdded', { property: path });
setWatchedVariables(currentProjectId, { ...watchedVariables, [variableId]: path });
onHideContextualMenu();
}
Expand Down Expand Up @@ -165,6 +167,7 @@ export const WatchVariablePicker = React.memo((props: WatchVariablePickerProps)
event?.preventDefault();
const path = paths[node.id];
setErrorMessage('');
TelemetryClient.track('StateWatchPropertyAdded', { property: path });
setWatchedVariables(currentProjectId, { ...watchedVariables, [variableId]: path });
onHideContextualMenu();
},
Expand Down Expand Up @@ -222,6 +225,7 @@ export const WatchVariablePicker = React.memo((props: WatchVariablePickerProps)
} else {
// watch the variable
setErrorMessage('');
TelemetryClient.track('StateWatchPropertyAdded', { property: query });
setWatchedVariables(currentProjectId, { ...watchedVariables, [variableId]: query });
onHideContextualMenu();
inputBoxElementRef.current?.blur();
Expand Down
8 changes: 7 additions & 1 deletion Composer/packages/types/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ type WebChatEvents = {
SaveTranscriptClicked: undefined;
};

type DebuggingEvents = {
StateWatchPropertyAdded: { property: string };
StateWatchPropertyRemoved: { property: string };
};

type ABSChannelsEvents = {
ConnectionsAddNewProfile: undefined;
ConnectionsChannelStatusDisplayed: { teams: boolean; speech: boolean; webchat: boolean };
Expand Down Expand Up @@ -260,7 +265,8 @@ export type TelemetryEvents = ApplicationEvents &
OrchestratorEvents &
PropertyEditorEvents &
CreationEvents &
SurveyEvents;
SurveyEvents &
DebuggingEvents;

export type TelemetryEventName = keyof TelemetryEvents;

Expand Down