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

port: remove unnecessary verbose trace logging #2936

Merged
merged 3 commits into from
Oct 21, 2020
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
5 changes: 0 additions & 5 deletions libraries/botbuilder-dialogs/src/dialogHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ export async function runDialog(
}

const activeDialogContext = getActiveDialogContext(dialogContext);
const remoteCancelText = 'Skill was canceled through an EndOfConversation activity from the parent.';
await context.sendTraceActivity(telemetryEventName, undefined, undefined, `${remoteCancelText}`);

// Send cancellation message to the top dialog in the stack to ensure all the parents are canceled in the right order.
await activeDialogContext.cancelAllDialogs(true);
Expand All @@ -93,9 +91,6 @@ export async function runDialog(

if (result.status === DialogTurnStatus.complete || result.status === DialogTurnStatus.cancelled) {
if (shouldSendEndOfConversationToParent(context, result)) {
const endMessageText = `Dialog ${dialog.id} has **completed**. Sending EndOfConversation.`;
await context.sendTraceActivity(telemetryEventName, result.result, undefined, `${endMessageText}`);

// Send End of conversation at the end.
const code =
result.status == DialogTurnStatus.complete
Expand Down
10 changes: 1 addition & 9 deletions libraries/botbuilder-dialogs/src/dialogManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export class DialogManager extends Configurable {
*/
private async sendStateSnapshotTrace(dc: DialogContext, traceLabel: string): Promise<void> {
// send trace of memory
const snapshot: object = getActiveDialogContext(dc).state.getMemorySnapshot();
const snapshot = getActiveDialogContext(dc).state.getMemorySnapshot();
await dc.context.sendActivity({
type: ActivityTypes.Trace,
name: 'BotState',
Expand Down Expand Up @@ -293,9 +293,6 @@ export class DialogManager extends Configurable {
// Handle remote cancellation request from parent.
const activeDialogContext = getActiveDialogContext(dc);

const remoteCancelText = 'Skill was canceled through an EndOfConversation activity from the parent.';
await turnContext.sendTraceActivity(`DialogManager.onTurn()`, undefined, undefined, remoteCancelText);

// Send cancellation message to the top dialog in the stack to ensure all the parents are canceled in the right order.
return await activeDialogContext.cancelAllDialogs(true);
}
Expand All @@ -319,17 +316,12 @@ export class DialogManager extends Configurable {
let turnResult = await dc.continueDialog();
if (turnResult.status == DialogTurnStatus.empty) {
// restart root dialog
const startMessageText = `Starting ${this._rootDialogId}.`;
await turnContext.sendTraceActivity('DialogManager.onTurn()', undefined, undefined, startMessageText);
turnResult = await dc.beginDialog(this._rootDialogId);
}

await this.sendStateSnapshotTrace(dc, 'Skill State');

if (shouldSendEndOfConversationToParent(turnContext, turnResult)) {
const endMessageText = `Dialog ${this._rootDialogId} has **completed**. Sending EndOfConversation.`;
await turnContext.sendTraceActivity('DialogManager.onTurn()', turnResult.result, undefined, endMessageText);

// Send End of conversation at the end.
const activity: Partial<Activity> = {
type: ActivityTypes.EndOfConversation,
Expand Down
27 changes: 0 additions & 27 deletions libraries/botbuilder-dialogs/src/skillDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ export class SkillDialog extends Dialog<Partial<BeginSkillDialogOptions>> {
public async beginDialog(dc: DialogContext, options: BeginSkillDialogOptions): Promise<DialogTurnResult> {
const dialogArgs = this.validateBeginDialogArgs(options);

await dc.context.sendTraceActivity(
`${this.id}.beginDialog()`,
undefined,
undefined,
`Using activity of type: ${dialogArgs.activity.type}`
);

// Create deep clone of the original activity to avoid altering it before forwarding it.
const clonedActivity = this.cloneActivity(dialogArgs.activity);

Expand Down Expand Up @@ -118,21 +111,8 @@ export class SkillDialog extends Dialog<Partial<BeginSkillDialogOptions>> {
return Dialog.EndOfTurn;
}

await dc.context.sendTraceActivity(
`${this.id}.continueDialog()`,
undefined,
undefined,
`ActivityType: ${dc.context.activity.type}`
);

// Handle EndOfConversation from the skill (this will be sent to the this dialog by the SkillHandler if received from the Skill)
if (dc.context.activity.type === ActivityTypes.EndOfConversation) {
await dc.context.sendTraceActivity(
`${this.id}.continueDialog()`,
undefined,
undefined,
`Got ${ActivityTypes.EndOfConversation}`
);
return await dc.endDialog(dc.context.activity.value);
}

Expand Down Expand Up @@ -162,13 +142,6 @@ export class SkillDialog extends Dialog<Partial<BeginSkillDialogOptions>> {
public async endDialog(context: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void> {
// Send of of conversation to the skill if the dialog has been cancelled.
if (reason == DialogReason.cancelCalled || reason == DialogReason.replaceCalled) {
await context.sendTraceActivity(
`${this.id}.endDialog()`,
undefined,
undefined,
`ActivityType: ${context.activity.type}`
);

const reference = TurnContext.getConversationReference(context.activity);
// Apply conversation reference and common properties from incoming activity before sending.
const activity = TurnContext.applyConversationReference(
Expand Down
6 changes: 0 additions & 6 deletions libraries/botbuilder-dialogs/tests/dialogManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@ describe('DialogManager', function() {
const dialog = new SimpleComponentDialog();
const testFlow = createTestFlow(dialog, FlowTestCase.LeafSkill, true);
await testFlow.send('Hi')
.assertReply(reply => {
strictEqual(reply.type, ActivityTypes.Trace);
})
.assertReply('Hello, what is your name?')
.assertReply(reply => {
strictEqual(reply.type, ActivityTypes.Trace);
Expand All @@ -246,9 +243,6 @@ describe('DialogManager', function() {
strictEqual(reply.type, ActivityTypes.Trace);
strictEqual(reply.label, 'Skill State');
})
.assertReply(reply => {
strictEqual(reply.type, ActivityTypes.Trace);
})
.startTest();
strictEqual(_dmTurnResult.turnResult.status, DialogTurnStatus.complete);
});
Expand Down