Не удается запросить журнал AppInsight - PullRequest
1 голос
/ 11 февраля 2020

Я пытаюсь создать запрос anAppInsight ...

Я хочу получить количество раз, которое приложение запускается, и разделить его на число срабатываний определенного события (проверка орфографии).

На самом деле у меня есть 3 приложения, которые все используют одинаковую функциональность проверки орфографии, и я хочу посмотреть, используется ли проверка орфографии одинаково в каждом приложении.

//First, let's get the count of hasBeenUsed (how many times the application has been used) 
let app1Starts =
customEvents
| where timestamp > ago(30d)
| where name == 'hasBeenUsed';
| where customDimensions['payload.appId] == 'app1'
| summarize count(); 
//Now, let's get the count of how many times spellchecking has happened for that specific application
let spellCheckEvents =
customEvents
| where timestamp > ago(30d)
| where name == 'spellchecked';
| where customDimensions['payload.appId] == 'app1'
| summarize count();
//this is where I struggle
customEvents
| summarize app1Starts / spellCheckEvents    //HELP ME PLEASE

Я получаю ошибку message

Оператор суммирования: не удалось разрешить скалярное выражение с именем app1Starts

То же самое происходит, если я изменю эту последнюю строку с summarize на extend

1 Ответ

1 голос
/ 12 февраля 2020

Вы можете использовать оператор toscalar () в операторе let.

В вашем случае запрос должен быть:

//First, let's get the count of hasBeenUsed (how many times the application has been used) 
let app1Starts =toscalar(
customEvents
| where timestamp > ago(30d)
| where name == 'hasBeenUsed'
| where customDimensions['payload.appId] == 'app1'
| summarize count()); 

//Now, let's get the count of how many times spellchecking has happened for that specific application
let spellCheckEvents =toscalar(
customEvents
| where timestamp > ago(30d)
| where name == 'spellchecked'
| where customDimensions['payload.appId] == 'app1'
| summarize count());

//then you can use the following statement
customEvents
| extend c1=app1Starts/spellCheckEvents 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...