取得知識庫的分析

如果您在建立 QnA Maker 服務期間啟用了 Application Insights,QnA Maker 會儲存所有聊天記錄和其他遙測。 執行範例查詢,以便從 Application Insights 取得您的聊天記錄。

注意

QnA Maker 服務即將於 2025 年 3 月 31 日淘汰。 現在,Azure AI 語言提供較新版本的問題和答案功能。 如需瞭解語言服務內的問題解答功能,請參閱問題解答。 從 2022 年 10 月 1 日開始,您將無法建立新的 QnA Maker 資源。 如需將現有的 QnA Maker 知識庫移轉至問題解答的相關資訊,請參閱移轉指南

  1. 移至您的 Application Insights 資源。

    選取您的 Application Insights 資源

  2. 選取 [Log Analytics]。 您可以查詢 QnA Maker 遙測的新視窗隨即開啟。

  3. 貼上並執行下列查詢。

    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
    | where message == "QnAMaker GenerateAnswer"
    | extend question = tostring(customDimensions['Question'])
    | extend answer = tostring(customDimensions['Answer'])
    | extend score = tostring(customDimensions['Score'])
    | project timestamp, resultCode, duration, id, question, answer, score, performanceBucket,KbId
    

    選取 [執行] 執行查詢。

    執行查詢以確定問題、答案和使用者的分數

對於 QnA Maker 知識庫執行其他分析的查詢

90 天總流量

//Total Traffic
requests
| where url endswith "generateAnswer" and name startswith "POST"
| parse kind = regex url with *"(?i)knowledgebases/"KbId"/generateAnswer"
| summarize ChatCount=count() by bin(timestamp, 1d), KbId

指定期間內的問題流量總計

//Total Question Traffic in a given time period
let startDate = todatetime('2019-01-01');
let endDate = todatetime('2020-12-31');
requests
| where timestamp <= endDate and timestamp >=startDate
| where url endswith "generateAnswer" and name startswith "POST"
| parse kind = regex url with *"(?i)knowledgebases/"KbId"/generateAnswer"
| summarize ChatCount=count() by KbId

使用者流量

//User Traffic
requests
| where url endswith "generateAnswer"
| project timestamp, id, url, resultCode, duration
| parse kind = regex url with *"(?i)knowledgebases/"KbId"/generateAnswer"
| join kind= inner (
traces | extend id = operation_ParentId
) on id
| extend UserId = tostring(customDimensions['UserId'])
| summarize ChatCount=count() by bin(timestamp, 1d), UserId, KbId

延遲的問題散發

//Latency distribution of questions
requests
| where url endswith "generateAnswer" and name startswith "POST"
| parse kind = regex url with *"(?i)knowledgebases/"KbId"/generateAnswer"
| project timestamp, id, name, resultCode, performanceBucket, KbId
| summarize count() by performanceBucket, KbId

未回答的問題

// Unanswered questions
requests
| where url endswith "generateAnswer"
| project timestamp, id, url
| parse kind = regex url with *"(?i)knowledgebases/"KbId"/generateAnswer"
| join kind= inner (
traces | extend id = operation_ParentId
) on id
| extend question = tostring(customDimensions['Question'])
| extend answer = tostring(customDimensions['Answer'])
| extend score = tostring(customDimensions['Score'])
| where  score  == "0" and message == "QnAMaker GenerateAnswer"
| project timestamp, KbId, question, answer, score
| order  by timestamp  desc

注意
如果您無法使用 Application Insight 正確地取得記錄,請確認 App Service 資源上的 Application Insights 設定。 開啟 App Service 資源,然後移至 Application Insights。 然後,請檢查其為 [已啟用] 還是 [已停用]。 如果已停用,請將其啟用,然後套用。

下一步