def test_crete_trace_activity_no_value_type(self): # Arrange name = "test-activity" value = "test-value" label = "test-label" # Act result = Activity.create_trace_activity(name=name, value=value, label=label) # Assert self.assertEqual(result.type, ActivityTypes.trace) self.assertEqual(result.value_type, type(value)) self.assertEqual(result.label, label)
async def send_state_snapshot_trace( dialog_context: DialogContext, trace_label: str ): """ Helper to send a trace activity with a memory snapshot of the active dialog DC. :param dialog_context: :param trace_label: :return: """ # send trace of memory snapshot = DialogManager.get_active_dialog_context( dialog_context ).state.get_memory_snapshot() trace_activity = Activity.create_trace_activity( "BotState", "https://www.botframework.com/schemas/botState", snapshot, trace_label, ) await dialog_context.context.send_activity(trace_activity)
async def _send_state_snapshot_trace(dialog_context: DialogContext): """ Helper to send a trace activity with a memory snapshot of the active dialog DC. :param dialog_context: :return: """ claims_identity = dialog_context.context.turn_state.get( BotAdapter.BOT_IDENTITY_KEY, None) trace_label = ( "Skill State" if isinstance(claims_identity, ClaimsIdentity) and SkillValidation.is_skill_claim(claims_identity.claims) else "Bot State") # send trace of memory snapshot = DialogExtensions._get_active_dialog_context( dialog_context).state.get_memory_snapshot() trace_activity = Activity.create_trace_activity( "BotState", "https://www.botframework.com/schemas/botState", snapshot, trace_label, ) await dialog_context.context.send_activity(trace_activity)