Added telelmetry for settings v2 and v1 (#269)

* Added telelmetry for settings v2 and v1

* format errors fixed

* renamed actions
This commit is contained in:
Srinath Narayanan 2020-10-12 09:01:00 -07:00 committed by GitHub
parent 47cc6fd7a8
commit a9a57f4ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 11 deletions

View File

@ -6,8 +6,8 @@ import * as SharedConstants from "../../../Shared/Constants";
import * as ViewModels from "../../../Contracts/ViewModels";
import DiscardIcon from "../../../../images/discard.svg";
import SaveIcon from "../../../../images/save-cosmos.svg";
import { traceStart, traceFailure, traceSuccess } from "../../../Shared/Telemetry/TelemetryProcessor";
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
import { traceStart, traceFailure, traceSuccess, trace } from "../../../Shared/Telemetry/TelemetryProcessor";
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
import { RequestOptions } from "@azure/cosmos/dist-esm";
import Explorer from "../../Explorer";
import { updateOffer } from "../../../Common/dataAccess/updateOffer";
@ -122,8 +122,8 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
this.changeFeedPolicyVisible = this.collection?.container.isFeatureEnabled(
Constants.Features.enableChangeFeedPolicy
);
// Mongo container with system partition key still treat as "Fixed"
// Mongo container with system partition key still treat as "Fixed"
this.isFixedContainer =
!this.collection.partitionKey ||
(this.container.isPreferredApiMongoDB() && this.collection.partitionKey.systemKey);
@ -264,7 +264,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
this.props.settingsTab.isExecutionError(false);
this.props.settingsTab.isExecuting(true);
const startKey: number = traceStart(Action.UpdateSettings, {
const startKey: number = traceStart(Action.SettingsV2Updated, {
databaseAccountName: this.container.databaseAccount()?.name,
defaultExperience: this.container.defaultExperience(),
dataExplorerArea: Constants.Areas.Tab,
@ -405,7 +405,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
this.setState({ isScaleSaveable: false, isScaleDiscardable: false });
} catch (error) {
traceFailure(
Action.UpdateSettings,
Action.SettingsV2Updated,
{
databaseAccountName: this.container.databaseAccount().name,
databaseName: this.collection && this.collection.databaseId,
@ -454,7 +454,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
this.setBaseline();
this.setState({ wasAutopilotOriginallySet: this.state.isAutoPilotSelected });
traceSuccess(
Action.UpdateSettings,
Action.SettingsV2Updated,
{
databaseAccountName: this.container.databaseAccount()?.name,
defaultExperience: this.container.defaultExperience(),
@ -468,7 +468,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
this.props.settingsTab.isExecutionError(true);
console.error(reason);
traceFailure(
Action.UpdateSettings,
Action.SettingsV2Updated,
{
databaseAccountName: this.container.databaseAccount()?.name,
defaultExperience: this.container.defaultExperience(),
@ -482,6 +482,10 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
};
public onRevertClick = (): void => {
trace(Action.SettingsV2Discarded, ActionModifiers.Mark, {
message: "Settings Discarded"
});
this.setState({
throughput: this.state.throughputBaseline,
timeToLive: this.state.timeToLiveBaseline,

View File

@ -13,7 +13,7 @@ import Q from "q";
import SaveIcon from "../../../images/save-cosmos.svg";
import TabsBase from "./TabsBase";
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
import { Action } from "../../Shared/Telemetry/TelemetryConstants";
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
import { PlatformType } from "../../PlatformType";
import { RequestOptions } from "@azure/cosmos/dist-esm";
import Explorer from "../Explorer";
@ -1233,6 +1233,9 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
};
public onRevertClick = (): Q.Promise<any> => {
TelemetryProcessor.trace(Action.DiscardSettings, ActionModifiers.Mark, {
message: "Settings Discarded"
});
this.throughput.setBaseline(this.throughput.getEditableOriginalValue());
this.timeToLive.setBaseline(this.timeToLive.getEditableOriginalValue());
this.timeToLiveSeconds.setBaseline(this.timeToLiveSeconds.getEditableOriginalValue());

View File

@ -9,6 +9,7 @@ export default class SettingsTabV2 extends TabsBase {
constructor(options: ViewModels.TabOptions) {
super(options);
this.tabId = "SettingsV2-" + this.tabId;
const props: SettingsComponentProps = {
settingsTab: this
};

View File

@ -88,7 +88,8 @@ export default class TabsBase extends WaitsForTemplateViewModel {
databaseAccountName: this.getContainer().databaseAccount().name,
defaultExperience: this.getContainer().defaultExperience(),
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.tabTitle()
tabTitle: this.tabTitle(),
tabId: this.tabId
});
}
@ -145,7 +146,8 @@ export default class TabsBase extends WaitsForTemplateViewModel {
databaseAccountName: this.getContainer().databaseAccount().name,
defaultExperience: this.getContainer().defaultExperience(),
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.tabTitle()
tabTitle: this.tabTitle(),
tabId: this.tabId
});
return Q();
}

View File

@ -86,7 +86,10 @@ export enum Action {
CreateMongoCollectionWithWildcardIndex,
ClickCommandBarButton,
RefreshResourceTreeMyNotebooks,
ClickResourceTreeNodeContextMenuItem
ClickResourceTreeNodeContextMenuItem,
DiscardSettings,
SettingsV2Updated,
SettingsV2Discarded
}
export const ActionModifiers = {