Added extra logging for mongo index update RP call (#303)

* Added extra logging

* changes error -> error.message in traceFailure
This commit is contained in:
Srinath Narayanan 2020-10-27 13:39:38 -07:00 committed by GitHub
parent 4bee46ce55
commit 542abf4d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 20 deletions

View File

@ -230,6 +230,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
if ( if (
this.container.isMongoIndexEditorEnabled() && this.container.isMongoIndexEditorEnabled() &&
this.container.isPreferredApiMongoDB() && this.container.isPreferredApiMongoDB() &&
this.container.isEnableMongoCapabilityPresent() &&
this.container.databaseAccount() this.container.databaseAccount()
) { ) {
await this.refreshIndexTransformationProgress(); await this.refreshIndexTransformationProgress();
@ -395,24 +396,54 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
} }
if (this.state.isMongoIndexingPolicySaveable && this.mongoDBCollectionResource) { if (this.state.isMongoIndexingPolicySaveable && this.mongoDBCollectionResource) {
const newMongoIndexes = this.getMongoIndexesToSave(); try {
const newMongoCollection: MongoDBCollectionResource = { const newMongoIndexes = this.getMongoIndexesToSave();
...this.mongoDBCollectionResource, const newMongoCollection: MongoDBCollectionResource = {
indexes: newMongoIndexes ...this.mongoDBCollectionResource,
}; indexes: newMongoIndexes
this.mongoDBCollectionResource = await updateMongoDBCollectionThroughRP( };
this.collection.databaseId,
this.collection.id(),
newMongoCollection
);
await this.refreshIndexTransformationProgress(); this.mongoDBCollectionResource = await updateMongoDBCollectionThroughRP(
this.setState({ this.collection.databaseId,
isMongoIndexingPolicySaveable: false, this.collection.id(),
indexesToDrop: [], newMongoCollection
indexesToAdd: [], );
currentMongoIndexes: [...this.mongoDBCollectionResource.indexes]
}); await this.refreshIndexTransformationProgress();
this.setState({
isMongoIndexingPolicySaveable: false,
indexesToDrop: [],
indexesToAdd: [],
currentMongoIndexes: [...this.mongoDBCollectionResource.indexes]
});
traceSuccess(
Action.MongoIndexUpdated,
{
databaseAccountName: this.container.databaseAccount()?.name,
databaseName: this.collection?.databaseId,
collectionName: this.collection?.id(),
defaultExperience: this.container.defaultExperience(),
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle()
},
startKey
);
} catch (error) {
traceFailure(
Action.MongoIndexUpdated,
{
databaseAccountName: this.container.databaseAccount()?.name,
databaseName: this.collection?.databaseId,
collectionName: this.collection?.id(),
defaultExperience: this.container.defaultExperience(),
dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle(),
error: error.message
},
startKey
);
throw error;
}
} }
if (this.state.isScaleSaveable) { if (this.state.isScaleSaveable) {
@ -542,7 +573,7 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
defaultExperience: this.container.defaultExperience(), defaultExperience: this.container.defaultExperience(),
dataExplorerArea: Constants.Areas.Tab, dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.props.settingsTab.tabTitle(), tabTitle: this.props.settingsTab.tabTitle(),
error: reason error: reason.message
}, },
startKey startKey
); );

View File

@ -1222,7 +1222,7 @@ export default class SettingsTab extends TabsBase implements ViewModels.WaitsFor
defaultExperience: this.container.defaultExperience(), defaultExperience: this.container.defaultExperience(),
dataExplorerArea: Constants.Areas.Tab, dataExplorerArea: Constants.Areas.Tab,
tabTitle: this.tabTitle(), tabTitle: this.tabTitle(),
error: error error: error.message
}, },
startKey startKey
); );

View File

@ -89,7 +89,8 @@ export enum Action {
ClickResourceTreeNodeContextMenuItem, ClickResourceTreeNodeContextMenuItem,
DiscardSettings, DiscardSettings,
SettingsV2Updated, SettingsV2Updated,
SettingsV2Discarded SettingsV2Discarded,
MongoIndexUpdated
} }
export const ActionModifiers = { export const ActionModifiers = {