mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-31 15:09:29 +01:00
Adding in experimentation for autoscale test (#345)
* Adding autoscale flight info * Add flight info to cassandra collection pane * Add telemetry for autoscale toggle on/off in create resource blade and scale/settings * Run formatting and add expected properties to test file * removing empty line * Updating to pass unit tests Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
This commit is contained in:
parent
fcbc9474ea
commit
8c40df0fa1
@ -132,6 +132,7 @@ export class Features {
|
|||||||
export class Flights {
|
export class Flights {
|
||||||
public static readonly SettingsV2 = "settingsv2";
|
public static readonly SettingsV2 = "settingsv2";
|
||||||
public static readonly MongoIndexEditor = "mongoindexeditor";
|
public static readonly MongoIndexEditor = "mongoindexeditor";
|
||||||
|
public static readonly AutoscaleTest = "autoscaletest";
|
||||||
public static readonly MongoIndexing = "mongoindexing";
|
public static readonly MongoIndexing = "mongoindexing";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +165,8 @@ export class ScaleComponent extends React.Component<ScaleComponentProps> {
|
|||||||
private getThroughputInputComponent = (): JSX.Element => (
|
private getThroughputInputComponent = (): JSX.Element => (
|
||||||
<ThroughputInputAutoPilotV3Component
|
<ThroughputInputAutoPilotV3Component
|
||||||
databaseAccount={this.props.container.databaseAccount()}
|
databaseAccount={this.props.container.databaseAccount()}
|
||||||
|
databaseName={this.props.collection.databaseId}
|
||||||
|
collectionName={this.props.collection.id()}
|
||||||
serverId={this.props.container.serverId()}
|
serverId={this.props.container.serverId()}
|
||||||
throughput={this.props.throughput}
|
throughput={this.props.throughput}
|
||||||
throughputBaseline={this.props.throughputBaseline}
|
throughputBaseline={this.props.throughputBaseline}
|
||||||
|
@ -9,6 +9,8 @@ import * as DataModels from "../../../../../Contracts/DataModels";
|
|||||||
describe("ThroughputInputAutoPilotV3Component", () => {
|
describe("ThroughputInputAutoPilotV3Component", () => {
|
||||||
const baseProps: ThroughputInputAutoPilotV3Props = {
|
const baseProps: ThroughputInputAutoPilotV3Props = {
|
||||||
databaseAccount: {} as DataModels.DatabaseAccount,
|
databaseAccount: {} as DataModels.DatabaseAccount,
|
||||||
|
databaseName: "test",
|
||||||
|
collectionName: "test",
|
||||||
serverId: undefined,
|
serverId: undefined,
|
||||||
wasAutopilotOriginallySet: false,
|
wasAutopilotOriginallySet: false,
|
||||||
throughput: 100,
|
throughput: 100,
|
||||||
|
@ -41,8 +41,13 @@ import { SubscriptionType } from "../../../../../Contracts/SubscriptionType";
|
|||||||
import { usageInGB, calculateEstimateNumber } from "../../../../../Utils/PricingUtils";
|
import { usageInGB, calculateEstimateNumber } from "../../../../../Utils/PricingUtils";
|
||||||
import { Features } from "../../../../../Common/Constants";
|
import { Features } from "../../../../../Common/Constants";
|
||||||
|
|
||||||
|
import * as TelemetryProcessor from "../../../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { Action, ActionModifiers } from "../../../../../Shared/Telemetry/TelemetryConstants";
|
||||||
|
|
||||||
export interface ThroughputInputAutoPilotV3Props {
|
export interface ThroughputInputAutoPilotV3Props {
|
||||||
databaseAccount: DataModels.DatabaseAccount;
|
databaseAccount: DataModels.DatabaseAccount;
|
||||||
|
databaseName: string;
|
||||||
|
collectionName: string;
|
||||||
serverId: string;
|
serverId: string;
|
||||||
throughput: number;
|
throughput: number;
|
||||||
throughputBaseline: number;
|
throughputBaseline: number;
|
||||||
@ -447,7 +452,19 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
|
|||||||
private onChoiceGroupChange = (
|
private onChoiceGroupChange = (
|
||||||
event?: React.FormEvent<HTMLElement | HTMLInputElement>,
|
event?: React.FormEvent<HTMLElement | HTMLInputElement>,
|
||||||
option?: IChoiceGroupOption
|
option?: IChoiceGroupOption
|
||||||
): void => this.props.onAutoPilotSelected(option.key === "true");
|
): void => {
|
||||||
|
this.props.onAutoPilotSelected(option.key === "true");
|
||||||
|
TelemetryProcessor.trace(Action.ToggleAutoscaleSetting, ActionModifiers.Mark, {
|
||||||
|
changedSelectedValueTo:
|
||||||
|
option.key === "true" ? ActionModifiers.ToggleAutoscaleOn : ActionModifiers.ToggleAutoscaleOff,
|
||||||
|
subscriptionId: userContext.subscriptionId,
|
||||||
|
databaseAccountName: this.props.databaseAccount?.name,
|
||||||
|
databaseName: this.props.databaseName,
|
||||||
|
collectionName: this.props.collectionName,
|
||||||
|
apiKind: userContext.defaultExperience,
|
||||||
|
dataExplorerArea: "Scale Tab V2"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
private minRUperGBSurvey = (): JSX.Element => {
|
private minRUperGBSurvey = (): JSX.Element => {
|
||||||
const href = `https://ncv.microsoft.com/vRBTO37jmO?ctx={"AzureSubscriptionId":"${userContext.subscriptionId}","CosmosDBAccountName":"${userContext.databaseAccount?.name}"}`;
|
const href = `https://ncv.microsoft.com/vRBTO37jmO?ctx={"AzureSubscriptionId":"${userContext.subscriptionId}","CosmosDBAccountName":"${userContext.databaseAccount?.name}"}`;
|
||||||
|
@ -40,6 +40,8 @@ exports[`ScaleComponent renders with correct initial notification 1`] = `
|
|||||||
>
|
>
|
||||||
<ThroughputInputAutoPilotV3Component
|
<ThroughputInputAutoPilotV3Component
|
||||||
canExceedMaximumValue={true}
|
canExceedMaximumValue={true}
|
||||||
|
collectionName="test"
|
||||||
|
databaseName="test"
|
||||||
getThroughputWarningMessage={[Function]}
|
getThroughputWarningMessage={[Function]}
|
||||||
isAutoPilotSelected={false}
|
isAutoPilotSelected={false}
|
||||||
isEmulator={false}
|
isEmulator={false}
|
||||||
|
@ -946,6 +946,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"hasWriteAccess": [Function],
|
"hasWriteAccess": [Function],
|
||||||
"isAccountReady": [Function],
|
"isAccountReady": [Function],
|
||||||
"isAuthWithResourceToken": [Function],
|
"isAuthWithResourceToken": [Function],
|
||||||
|
"isAutoscaleDefaultEnabled": [Function],
|
||||||
"isCopyNotebookPaneEnabled": [Function],
|
"isCopyNotebookPaneEnabled": [Function],
|
||||||
"isEnableMongoCapabilityPresent": [Function],
|
"isEnableMongoCapabilityPresent": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
@ -2220,6 +2221,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"hasWriteAccess": [Function],
|
"hasWriteAccess": [Function],
|
||||||
"isAccountReady": [Function],
|
"isAccountReady": [Function],
|
||||||
"isAuthWithResourceToken": [Function],
|
"isAuthWithResourceToken": [Function],
|
||||||
|
"isAutoscaleDefaultEnabled": [Function],
|
||||||
"isCopyNotebookPaneEnabled": [Function],
|
"isCopyNotebookPaneEnabled": [Function],
|
||||||
"isEnableMongoCapabilityPresent": [Function],
|
"isEnableMongoCapabilityPresent": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
@ -3507,6 +3509,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"hasWriteAccess": [Function],
|
"hasWriteAccess": [Function],
|
||||||
"isAccountReady": [Function],
|
"isAccountReady": [Function],
|
||||||
"isAuthWithResourceToken": [Function],
|
"isAuthWithResourceToken": [Function],
|
||||||
|
"isAutoscaleDefaultEnabled": [Function],
|
||||||
"isCopyNotebookPaneEnabled": [Function],
|
"isCopyNotebookPaneEnabled": [Function],
|
||||||
"isEnableMongoCapabilityPresent": [Function],
|
"isEnableMongoCapabilityPresent": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
@ -4781,6 +4784,7 @@ exports[`SettingsComponent renders 1`] = `
|
|||||||
"hasWriteAccess": [Function],
|
"hasWriteAccess": [Function],
|
||||||
"isAccountReady": [Function],
|
"isAccountReady": [Function],
|
||||||
"isAuthWithResourceToken": [Function],
|
"isAuthWithResourceToken": [Function],
|
||||||
|
"isAutoscaleDefaultEnabled": [Function],
|
||||||
"isCopyNotebookPaneEnabled": [Function],
|
"isCopyNotebookPaneEnabled": [Function],
|
||||||
"isEnableMongoCapabilityPresent": [Function],
|
"isEnableMongoCapabilityPresent": [Function],
|
||||||
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
"isFixedCollectionWithSharedThroughputSupported": [Function],
|
||||||
|
@ -5,6 +5,9 @@ import ThroughputInputComponentAutoscaleV3 from "./ThroughputInputComponentAutos
|
|||||||
import { KeyCodes } from "../../../Common/Constants";
|
import { KeyCodes } from "../../../Common/Constants";
|
||||||
import { WaitsForTemplateViewModel } from "../../WaitsForTemplateViewModel";
|
import { WaitsForTemplateViewModel } from "../../WaitsForTemplateViewModel";
|
||||||
|
|
||||||
|
import { userContext } from "../../../UserContext";
|
||||||
|
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
/**
|
/**
|
||||||
* Throughput Input:
|
* Throughput Input:
|
||||||
*
|
*
|
||||||
@ -201,6 +204,16 @@ export class ThroughputInputViewModel extends WaitsForTemplateViewModel {
|
|||||||
this.label = options.label || ko.observable<string>();
|
this.label = options.label || ko.observable<string>();
|
||||||
this.showAutoPilot = options.showAutoPilot !== undefined ? options.showAutoPilot : ko.observable<boolean>(true);
|
this.showAutoPilot = options.showAutoPilot !== undefined ? options.showAutoPilot : ko.observable<boolean>(true);
|
||||||
this.isAutoPilotSelected = options.isAutoPilotSelected || ko.observable<boolean>(false);
|
this.isAutoPilotSelected = options.isAutoPilotSelected || ko.observable<boolean>(false);
|
||||||
|
this.isAutoPilotSelected.subscribe(value => {
|
||||||
|
TelemetryProcessor.trace(Action.ToggleAutoscaleSetting, ActionModifiers.Mark, {
|
||||||
|
changedSelectedValueTo: value ? ActionModifiers.ToggleAutoscaleOn : ActionModifiers.ToggleAutoscaleOff,
|
||||||
|
databaseAccountName: userContext.databaseAccount?.name,
|
||||||
|
subscriptionId: userContext.subscriptionId,
|
||||||
|
apiKind: userContext.defaultExperience,
|
||||||
|
dataExplorerArea: "Scale Tab V1"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
this.throughputAutoPilotRadioId = options.throughputAutoPilotRadioId;
|
this.throughputAutoPilotRadioId = options.throughputAutoPilotRadioId;
|
||||||
this.throughputProvisionedRadioId = options.throughputProvisionedRadioId;
|
this.throughputProvisionedRadioId = options.throughputProvisionedRadioId;
|
||||||
this.throughputModeRadioName = options.throughputModeRadioName;
|
this.throughputModeRadioName = options.throughputModeRadioName;
|
||||||
|
@ -209,6 +209,7 @@ export default class Explorer {
|
|||||||
public isRightPanelV2Enabled: ko.Computed<boolean>;
|
public isRightPanelV2Enabled: ko.Computed<boolean>;
|
||||||
public isMongoIndexingEnabled: ko.Observable<boolean>;
|
public isMongoIndexingEnabled: ko.Observable<boolean>;
|
||||||
public canExceedMaximumValue: ko.Computed<boolean>;
|
public canExceedMaximumValue: ko.Computed<boolean>;
|
||||||
|
public isAutoscaleDefaultEnabled: ko.Observable<boolean>;
|
||||||
|
|
||||||
public shouldShowShareDialogContents: ko.Observable<boolean>;
|
public shouldShowShareDialogContents: ko.Observable<boolean>;
|
||||||
public shareAccessData: ko.Observable<AdHocAccessData>;
|
public shareAccessData: ko.Observable<AdHocAccessData>;
|
||||||
@ -414,6 +415,8 @@ export default class Explorer {
|
|||||||
this.isSchemaEnabled = ko.computed<boolean>(() => this.isFeatureEnabled(Constants.Features.enableSchema));
|
this.isSchemaEnabled = ko.computed<boolean>(() => this.isFeatureEnabled(Constants.Features.enableSchema));
|
||||||
this.isNotificationConsoleExpanded = ko.observable<boolean>(false);
|
this.isNotificationConsoleExpanded = ko.observable<boolean>(false);
|
||||||
|
|
||||||
|
this.isAutoscaleDefaultEnabled = ko.observable<boolean>(false);
|
||||||
|
|
||||||
this.databases = ko.observableArray<ViewModels.Database>();
|
this.databases = ko.observableArray<ViewModels.Database>();
|
||||||
this.canSaveQueries = ko.computed<boolean>(() => {
|
this.canSaveQueries = ko.computed<boolean>(() => {
|
||||||
const savedQueriesDatabase: ViewModels.Database = _.find(
|
const savedQueriesDatabase: ViewModels.Database = _.find(
|
||||||
@ -1898,6 +1901,9 @@ export default class Explorer {
|
|||||||
if (!flights) {
|
if (!flights) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (flights.indexOf(Constants.Flights.AutoscaleTest) !== -1) {
|
||||||
|
this.isAutoscaleDefaultEnabled(true);
|
||||||
|
}
|
||||||
if (flights.indexOf(Constants.Flights.MongoIndexing) !== -1) {
|
if (flights.indexOf(Constants.Flights.MongoIndexing) !== -1) {
|
||||||
this.isMongoIndexingEnabled(true);
|
this.isMongoIndexingEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -929,8 +929,8 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
|||||||
this.databaseId("");
|
this.databaseId("");
|
||||||
this.partitionKey("");
|
this.partitionKey("");
|
||||||
this.throughputSpendAck(false);
|
this.throughputSpendAck(false);
|
||||||
this.isAutoPilotSelected(false);
|
this.isAutoPilotSelected(this.container.isAutoscaleDefaultEnabled());
|
||||||
this.isSharedAutoPilotSelected(false);
|
this.isSharedAutoPilotSelected(this.container.isAutoscaleDefaultEnabled());
|
||||||
this.autoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
this.autoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ export default class AddDatabasePane extends ContextualPaneBase {
|
|||||||
public resetData() {
|
public resetData() {
|
||||||
this.databaseId("");
|
this.databaseId("");
|
||||||
this.databaseCreateNewShared(this.getSharedThroughputDefault());
|
this.databaseCreateNewShared(this.getSharedThroughputDefault());
|
||||||
this.isAutoPilotSelected(false);
|
this.isAutoPilotSelected(this.container.isAutoscaleDefaultEnabled());
|
||||||
this.maxAutoPilotThroughputSet(AutoPilotUtils.minAutoPilotThroughput);
|
this.maxAutoPilotThroughputSet(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
this._updateThroughputLimitByDatabase();
|
this._updateThroughputLimitByDatabase();
|
||||||
this.throughputSpendAck(false);
|
this.throughputSpendAck(false);
|
||||||
|
@ -451,8 +451,8 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
|||||||
public resetData() {
|
public resetData() {
|
||||||
super.resetData();
|
super.resetData();
|
||||||
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
const throughputDefaults = this.container.collectionCreationDefaults.throughput;
|
||||||
this.isAutoPilotSelected(false);
|
this.isAutoPilotSelected(this.container.isAutoscaleDefaultEnabled());
|
||||||
this.isSharedAutoPilotSelected(false);
|
this.isSharedAutoPilotSelected(this.container.isAutoscaleDefaultEnabled());
|
||||||
this.selectedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
this.selectedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
|
||||||
this.throughput(AddCollectionUtility.getMaxThroughput(this.container.collectionCreationDefaults, this.container));
|
this.throughput(AddCollectionUtility.getMaxThroughput(this.container.collectionCreationDefaults, this.container));
|
||||||
|
@ -22,6 +22,7 @@ export enum Action {
|
|||||||
MongoShell,
|
MongoShell,
|
||||||
ContextualPane,
|
ContextualPane,
|
||||||
ScaleThroughput,
|
ScaleThroughput,
|
||||||
|
ToggleAutoscaleSetting,
|
||||||
SelectItem,
|
SelectItem,
|
||||||
Tab,
|
Tab,
|
||||||
UpdateDocument,
|
UpdateDocument,
|
||||||
@ -104,7 +105,9 @@ export const ActionModifiers = {
|
|||||||
Submit: "submit",
|
Submit: "submit",
|
||||||
IndexAll: "index all properties",
|
IndexAll: "index all properties",
|
||||||
NoIndex: "no indexing",
|
NoIndex: "no indexing",
|
||||||
Cancel: "cancel"
|
Cancel: "cancel",
|
||||||
|
ToggleAutoscaleOn: "autoscale on",
|
||||||
|
ToggleAutoscaleOff: "autoscale off"
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export enum SourceBlade {
|
export enum SourceBlade {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user