Edit

Share via


TelemetryLoggerMiddleware Class

Middleware for logging incoming, outgoing, updated or deleted Activity messages.

Constructor

TelemetryLoggerMiddleware(telemetry_client: BotTelemetryClient, log_personal_information: bool)

Parameters

Name Description
telemetry_client
Required
log_personal_information
Required

Methods

fill_delete_event_properties

Fills the event properties for the BotMessageDelete. These properties are logged when an activity message is deleted by the Bot. :param activity: activity sent from user. :param additional_properties: Additional properties to add to the event. Additional properties can override "stock" properties.

BotTelemetryClient.track_event method for the BotMessageUpdate event.

fill_receive_event_properties

Fills the event properties for the BotMessageReceived. Adheres to the LogPersonalInformation flag to filter Name, Text and Speak properties. :param activity: activity sent from user. :param additional_properties: Additional properties to add to the event. Additional properties can override "stock" properties.

BotTelemetryClient.track_event method for the BotMessageReceived event.

fill_send_event_properties

Fills the event properties for the BotMessageSend. These properties are logged when an activity message is sent by the Bot to the user. :param activity: activity sent from user. :param additional_properties: Additional properties to add to the event. Additional properties can override "stock" properties.

BotTelemetryClient.track_event method for the BotMessageSend event.

fill_update_event_properties

Fills the event properties for the BotMessageUpdate. These properties are logged when an activity message is updated by the Bot. For example, if a card is interacted with by the use, and the card needs to be updated to reflect some interaction. :param activity: activity sent from user. :param additional_properties: Additional properties to add to the event. Additional properties can override "stock" properties.

BotTelemetryClient.track_event method for the BotMessageUpdate event.

on_delete_activity

Invoked when the bot deletes a message. Performs logging of telemetry data using the BotTelemetryClient.track_event() method. This event name used is "BotMessageDelete". :param activity: Current activity sent from user.

on_receive_activity

Invoked when a message is received from the user. Performs logging of telemetry data using the BotTelemetryClient.track_event() method. This event name used is "BotMessageReceived". :param activity: Current activity sent from user.

on_send_activity

Invoked when the bot sends a message to the user. Performs logging of telemetry data using the BotTelemetryClient.track_event() method. This event name used is "BotMessageSend". :param activity: Current activity sent from bot.

on_turn

Logs events based on incoming and outgoing activities using BotTelemetryClient base class

on_update_activity

Invoked when the bot updates a message. Performs logging of telemetry data using the BotTelemetryClient.track_event() method. This event name used is "BotMessageUpdate". :param activity: Current activity sent from user.

fill_delete_event_properties

Fills the event properties for the BotMessageDelete. These properties are logged when an activity message is deleted by the Bot. :param activity: activity sent from user. :param additional_properties: Additional properties to add to the event. Additional properties can override "stock" properties.

BotTelemetryClient.track_event method for the BotMessageUpdate event.

async fill_delete_event_properties(activity: Activity, additional_properties: Dict[str, str] = None) -> Dict[str, str]

Parameters

Name Description
activity
Required
additional_properties
Default value: None

Returns

Type Description

A dictionary that is sent as "Properties" to the

fill_receive_event_properties

Fills the event properties for the BotMessageReceived. Adheres to the LogPersonalInformation flag to filter Name, Text and Speak properties. :param activity: activity sent from user. :param additional_properties: Additional properties to add to the event. Additional properties can override "stock" properties.

BotTelemetryClient.track_event method for the BotMessageReceived event.

async fill_receive_event_properties(activity: Activity, additional_properties: Dict[str, str] = None) -> Dict[str, str]

Parameters

Name Description
activity
Required
additional_properties
Default value: None

Returns

Type Description

A dictionary that is sent as "Properties" to

fill_send_event_properties

Fills the event properties for the BotMessageSend. These properties are logged when an activity message is sent by the Bot to the user. :param activity: activity sent from user. :param additional_properties: Additional properties to add to the event. Additional properties can override "stock" properties.

BotTelemetryClient.track_event method for the BotMessageSend event.

async fill_send_event_properties(activity: Activity, additional_properties: Dict[str, str] = None) -> Dict[str, str]

Parameters

Name Description
activity
Required
additional_properties
Default value: None

Returns

Type Description

A dictionary that is sent as "Properties" to the

fill_update_event_properties

Fills the event properties for the BotMessageUpdate. These properties are logged when an activity message is updated by the Bot. For example, if a card is interacted with by the use, and the card needs to be updated to reflect some interaction. :param activity: activity sent from user. :param additional_properties: Additional properties to add to the event. Additional properties can override "stock" properties.

BotTelemetryClient.track_event method for the BotMessageUpdate event.

async fill_update_event_properties(activity: Activity, additional_properties: Dict[str, str] = None) -> Dict[str, str]

Parameters

Name Description
activity
Required
additional_properties
Default value: None

Returns

Type Description

A dictionary that is sent as "Properties" to the

on_delete_activity

Invoked when the bot deletes a message. Performs logging of telemetry data using the BotTelemetryClient.track_event() method. This event name used is "BotMessageDelete". :param activity: Current activity sent from user.

async on_delete_activity(activity: Activity) -> None

Parameters

Name Description
activity
Required

on_receive_activity

Invoked when a message is received from the user. Performs logging of telemetry data using the BotTelemetryClient.track_event() method. This event name used is "BotMessageReceived". :param activity: Current activity sent from user.

async on_receive_activity(activity: Activity) -> None

Parameters

Name Description
activity
Required

on_send_activity

Invoked when the bot sends a message to the user. Performs logging of telemetry data using the BotTelemetryClient.track_event() method. This event name used is "BotMessageSend". :param activity: Current activity sent from bot.

async on_send_activity(activity: Activity) -> None

Parameters

Name Description
activity
Required

on_turn

Logs events based on incoming and outgoing activities using BotTelemetryClient base class

async on_turn(context: TurnContext, logic_fn: Callable[[TurnContext], Awaitable]) -> None

Parameters

Name Description
turn_context
Required

The context object for this turn.

logic
Required

Callable to continue the bot middleware pipeline

context
Required
logic_fn
Required

Returns

Type Description

None

on_update_activity

Invoked when the bot updates a message. Performs logging of telemetry data using the BotTelemetryClient.track_event() method. This event name used is "BotMessageUpdate". :param activity: Current activity sent from user.

async on_update_activity(activity: Activity) -> None

Parameters

Name Description
activity
Required

Attributes

log_personal_information

Gets a value indicating whether determines whether to log personal information that came from the user.

telemetry_client

Gets the currently configured BotTelemetryClient.