QnA Service doesn't log metadata into AppInsights
QnA Maker Service
QnA maker services doesn't log MetaData into AppInsight telemetry. Only below info is logged-

Can this be extended?
@peterinnesmsft Could you please take a look at this?
@ninggao @peterinnesmsft do you have any updates on this?
I'm not familiar with this issue - did you mean to contact someone else?
@petand123 Apologize, you are not assigned to this issue :)
@peterinnesmsft Could you please take a look at this?
Investigating this now. Will provide an update later today.
@peterinnesmsft any updates?
Hi @neetgupta7,
Apologies for the delayed response. In taking a look at your request, it appears that you are looking at the 'QnAMaker GenerateAnswer' trace event custom dimensions.
When a user creates a Virtual Assistant, the QnAMaker host that is created amongst your other Azure resources is configured to use the same Application Insights instance as your Virtual Assistant application. As a result, you may see logs which are produced by the QnA application instead of your bot application - the above log entry being one such instance.
If you look within the customEvents table, you can find an event with the name 'QnAMessage' - this is an event that is produced by the underlying QnAMaker service within the Bot Framework SDK, and produces more information beyond the trace event you identified. The corresponding class is Microsoft.Bot.Builder.AI.QnA.QnAMaker, located within the microsoft/botbuilder-dotnet repo.
With this class, it is possible to supply custom event properties and metrics that can be captured within Application Insights. To do this, the recommendation would be to create a custom dialog that inherits from QnAMakerDialog, and add logic as appropriate to supply any additional telemetry properties and metrics.
Let me know if you have any further questions.
@peterinnesmsft Can you pls direct me to content where this is present or some sample will be useful. Just FYI that I am making use of bot builder version 4.7.2-previewsso-103311
@peterinnesmsft Can you pls respond to my prev query.
@peterinnesmsft We are making use of QnAMakerDialog to access QnA service. Is it possible to log metadata through QnAMakerDialog?
Hi @neetgupta7 -- I'm still getting these comments and they need to go to @peterinnesmsft .
@neetgupta7, here are the relevant classes from the microsoft/botbuilder-dotnet repo:
https://github.com/microsoft/botbuilder-dotnet/blob/main/libraries/Microsoft.Bot.Builder.AI.QnA/Dialogs/QnAMakerDialog.cs https://github.com/microsoft/botbuilder-dotnet/blob/main/libraries/Microsoft.Bot.Builder.AI.QnA/QnAMaker.cs
QnAMaker::GetAnswersRawAsync takes in two parameters, telemetryProperties and telemetryMetrics, which I believe can be used to achieve what you are looking to accomplish. As this is currently invoked from the QnAMakerDialog class, which itself doesn't expose an easy way to supply these additional parameters, the recommendation as I made before would be to create a custom implementation over the base QnAMakerDialog that supplies the additional data you are looking for.
rEsolved.
Please let me know how to include metadata in the insight query for QnAMaker logs somthing as this, here the meatadata field comes empty
requests | where url endswith "generateAnswer" | project timestamp, id, url, resultCode, duration, performanceBucket | parse kind = regex url with *"(?i)knowledgebases/"KbId"/generateAnswer" | join kind= inner ( traces | extend id = operation_ParentId ) on id | extend question = tostring(customDimensions['traces']) | extend answer = tostring(customDimensions['Answer']) | extend score = tostring(customDimensions['Score']) | extend metadata = tostring(customDimensions['qnaMakerOptions']) | project answer,['metadata']
Can you please share the C# code of the below javascript class shared. for getting the metadata tags in insights @petand123 how to include metadata in the insight query for QnAMaker logs #3843
class CustomQnAMakerDialog extends QnAMakerDialog { async getQnaMakerClient(dialogContext) { const client = await super.getQnAMakerClient(dialogContext); const onQnaResults = client.onQnaResults.bind(client); client.onQnaResults = (qnaResults, turnContext, properties = {}, metrics = {}) => { properties = { ...properties, custom: 'property' }; metrics = { ...metrics, custom: 1.0 }; return onQnaResults(qnaResults, turnContext, properties, metrics); } } }