How to get the Qna Maker "Q" from Analytics Application Insights?

1.5k views Asked by At

I have created my chatbot's knowledge base with Qna Maker and I am trying to visualize some statistics with Analytics Application Insights.

What I want to do

I would like to create a chart with the most requested Qna Maker questions.

My problem

I can't find the Qna Maker questions in the customDimensions traces on Analytics but only their Id :

enter image description here

My question

Is their a way to get the Qna Maker Question linked to this Id directly from the Analytics Application Insights tool ?

Thank you.

PS : I had to use "Q" instead of "Question" in the title due to Stackoverflow rules.

3

There are 3 answers

2
John Gardner On

Not directly.

the only info you have in appinsights is whatever was submitted with the data. so if they aren't sending the question (odd that they send the answer but not the question?) then you're out of luck.

As a workaround, you could create a custom table in your application insights instance: https://learn.microsoft.com/en-us/azure/application-insights/app-insights-analytics-import and populate that table with the id and question.

then you could join those two things in analytics queries in the analytics tool or in workbooks.

0
Matt On

Here is a query that I came up with that will pull in the id of the knowlegebase question, the question the user typed, and the knowlegebase anwer. It also ties multiple questions together if they are from the same session.

I have not yet been able to find a way to identify a way to get the knowlegebase question associated to the id though.

requests
| where url endswith 'generateAnswer'
| project id, url, sessionId = extract('^[a-z0-9]{7}', 0, itemId)
| parse kind = regex url with *'(?i)knowledgebases/'knowlegeBaseId'/generateAnswer'
| join kind= inner
(
    traces
    | extend id = operation_ParentId
    | where message == 'QnAMaker GenerateAnswer'
    | extend userQuestion = tostring(customDimensions['Question'])
    | extend knowlegeBaseQuestionId = tostring(customDimensions['Id'])
    | extend knowlegeBaseAnswer = tostring(customDimensions['Answer'])
    | extend score = tostring(customDimensions['Score'])
)
on id
| where timestamp >= ago(10d)
| project knowlegeBaseId, timestamp, userQuestion, knowlegeBaseQuestionId, knowlegeBaseAnswer, score, sessionId
| order by timestamp asc
0
Sebastian Zolg On

if you're looking for a query with question and answer linked through id, here is your answer:

requests
| where url endswith "generateAnswer"
| project timestamp, id, name, resultCode, duration
| parse name with *"/knowledgebases/"KbId"/generateAnswer"
| join kind= inner (
traces | extend id = operation_ParentId
) on id
| extend question = tostring(customDimensions['Question'])
| extend answer = tostring(customDimensions['Answer'])
| project KbId, timestamp, resultCode, duration, question, answer

This doesn't necessarily solve your issue but might be of help for other people looking for a simple report of question/answer to improve their QnA maker.

The sample could be found in the official documentation: https://learn.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/get-analytics-knowledge-base