Added self serve component telemetry (#820)

This commit is contained in:
Srinath Narayanan 2021-05-25 01:06:57 +05:30 committed by GitHub
parent 2fda881770
commit eae5b2219e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 0 deletions

View File

@ -17,6 +17,8 @@ import * as _ from "underscore";
import { sendMessage } from "../Common/MessageHandler";
import { SelfServeMessageTypes } from "../Contracts/SelfServeContracts";
import { SmartUiComponent, SmartUiDescriptor } from "../Explorer/Controls/SmartUi/SmartUiComponent";
import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants";
import { trace } from "../Shared/Telemetry/TelemetryProcessor";
import { commandBarItemStyles, commandBarStyles, containerStackTokens, separatorStyles } from "./SelfServeStyles";
import {
AnyDisplay,
@ -27,6 +29,7 @@ import {
Node,
NumberInput,
RefreshResult,
SelfServeComponentTelemetryType,
SelfServeDescriptor,
SmartUiInput,
StringInput,
@ -87,6 +90,12 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
}
});
this.initializeSmartUiComponent();
const telemetryData = {
selfServeClassName: this.props.descriptor.root.id,
eventType: SelfServeComponentTelemetryType.Load,
};
trace(Action.SelfServeComponent, ActionModifiers.Mark, telemetryData, SelfServeMessageTypes.TelemetryInfo);
}
constructor(props: SelfServeComponentProps) {
@ -262,6 +271,12 @@ export class SelfServeComponent extends React.Component<SelfServeComponentProps,
};
public performSave = async (): Promise<void> => {
const telemetryData = {
selfServeClassName: this.props.descriptor.root.id,
eventType: SelfServeComponentTelemetryType.Save,
};
trace(Action.SelfServeComponent, ActionModifiers.Mark, telemetryData, SelfServeMessageTypes.TelemetryInfo);
this.setState({ isSaving: true, notification: undefined });
try {
const onSaveResult = await this.props.descriptor.onSave(

View File

@ -70,6 +70,12 @@ export interface SelfServeDescriptor {
refreshParams?: RefreshParams;
}
/**@internal */
export enum SelfServeComponentTelemetryType {
Load = "Load",
Save = "Save",
}
/**@internal */
export type AnyDisplay = NumberInput | BooleanInput | StringInput | ChoiceInput | DescriptionDisplay;

View File

@ -117,6 +117,7 @@ export enum Action {
SelfServe,
ExpandAddCollectionPaneAdvancedSection,
SchemaAnalyzerClickAnalyze,
SelfServeComponent,
}
export const ActionModifiers = {