/// <summary>
        /// Fills event properties for the <see cref="TelemetryLoggerConstants.BotMsgDeleteEvent"/> event.
        /// </summary>
        /// <param name="activity">The Activity object deleted by bot.</param>
        /// <param name="additionalProperties">Additional properties to add to the event.</param>
        /// <returns>The properties and their values to log when the bot deletes a message it sent previously.</returns>
#pragma warning disable CA1822 // Mark members as static (can't change this without breaking binary compat)
        protected Task <Dictionary <string, string> > FillDeleteEventPropertiesAsync(IMessageDeleteActivity activity, Dictionary <string, string> additionalProperties = null)
#pragma warning restore CA1822 // Mark members as static
        {
            if (activity == null)
            {
                return(Task.FromResult(new Dictionary <string, string>()));
            }

            var properties = new Dictionary <string, string>()
            {
                { TelemetryConstants.RecipientIdProperty, activity.Recipient?.Id },
                { TelemetryConstants.ConversationIdProperty, activity.Conversation?.Id },
                { TelemetryConstants.ConversationNameProperty, activity.Conversation?.Name },
                { TelemetryConstants.ActivityTypeProperty, activity.Type },
            };

            // Additional Properties can override "stock" properties.
            if (additionalProperties != null)
            {
                return(Task.FromResult(additionalProperties.Concat(properties)
                                       .GroupBy(kv => kv.Key)
                                       .ToDictionary(g => g.Key, g => g.First().Value)));
            }

            return(Task.FromResult(properties));
        }
        /// <summary>
        /// Fills the Application Insights Custom Event properties for BotMessageDelete.
        /// These properties are logged in the custom event when an activity message is deleted by the Bot.  This is a relatively rare case.
        /// </summary>
        /// <param name="activity">Last activity sent from user.</param>
        /// <returns>A dictionary that is sent as "Properties" to Application Insights TrackEvent method for the BotMessageDelete Message.</returns>
        private Dictionary <string, string> FillDeleteEventProperties(IMessageDeleteActivity activity)
        {
            var properties = new Dictionary <string, string>()
            {
                { TelemetryConstants.RecipientIdProperty, activity.Recipient.Id },
                { TelemetryConstants.ConversationNameProperty, activity.Conversation.Name },
            };

            return(properties);
        }
Esempio n. 3
0
        /// <summary>
        /// Fills the Application Insights Custom Event properties for BotMessageDelete.
        /// These properties are logged in the custom event when an activity message is deleted by the Bot.  This is a relatively rare case.
        /// </summary>
        /// <param name="activity">The Delete activity to harvest properties to be placed into the Application Insights custom event.</param>
        /// <returns>A dictionary that is sent as "Properties" to Application Insights
        /// <see cref="TelemetryClient.TrackEvent(string, IDictionary{string, string}, IDictionary{string, double})"/>
        /// method for the BotMessageDelete Message.</returns>
        private Dictionary <string, string> FillDeleteEventProperties(IMessageDeleteActivity activity)
        {
            var properties = new Dictionary <string, string>()
            {
                { AppInsightsConstants.ActivityIDProperty, activity.Id },
                { AppInsightsConstants.ChannelProperty, activity.ChannelId },
                { AppInsightsConstants.RecipientIdProperty, activity.Recipient.Id },
                { AppInsightsConstants.ConversationIdProperty, activity.Conversation.Id },
                { AppInsightsConstants.ConversationNameProperty, activity.Conversation.Name },
            };

            return(properties);
        }
Esempio n. 4
0
        /// <summary>
        /// Fills the event properties for BotMessageDelete.
        /// These properties are logged when an activity message is deleted by the Bot.
        /// </summary>
        /// <param name="activity">The Activity object deleted by bot.</param>
        /// <param name="additionalProperties">Additional properties to add to the event.</param>
        /// <returns>A dictionary that is sent as "Properties" to IBotTelemetryClient.TrackEvent method for the BotMessageDelete event.</returns>
        protected Task <Dictionary <string, string> > FillDeleteEventPropertiesAsync(IMessageDeleteActivity activity, Dictionary <string, string> additionalProperties = null)
        {
            var properties = new Dictionary <string, string>()
            {
                { TelemetryConstants.RecipientIdProperty, activity.Recipient.Id },
                { TelemetryConstants.ConversationIdProperty, activity.Conversation.Id },
                { TelemetryConstants.ConversationNameProperty, activity.Conversation.Name },
            };

            // Additional Properties can override "stock" properties.
            if (additionalProperties != null)
            {
                return(Task.FromResult(additionalProperties.Concat(properties)
                                       .GroupBy(kv => kv.Key)
                                       .ToDictionary(g => g.Key, g => g.First().Value)));
            }

            return(Task.FromResult(properties));
        }
 Dictionary <string, string> ITelemetryLoggerMiddleware.FillDeleteEventProperties(IMessageDeleteActivity activity)
 {
     throw new NotImplementedException();
 }