Запросы для таблицы ApiManagementGatewayLogs

Число запросов

Подсчитайте общее количество вызовов во всех API за последние 24 часа.

//Total number of call per resource
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize count(CorrelationId) by _ResourceId 

Журналы последних 100 вызовов

Получите журналы последних 100 вызовов за последние 24 часа.

ApiManagementGatewayLogs
| top 100 by TimeGenerated desc 

Количество вызовов API

Просмотр количества вызовов на API за последние 24 часа.

//Calls by API ID
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize count(CorrelationId) by ApiId

Используемая пропускная способность

Общая пропускная способность, используемая за последние 24 часа.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| extend bandwidth = RequestSize + ResponseSize 
| summarize sum(bandwidth) by bin(TimeGenerated, 15m), _ResourceId 
| render timechart 

Размеры запросов

Статистика размеров запросов за последние 24 часа.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(RequestSize), Median=percentile(RequestSize, 50), 90th_Percentile=percentile(RequestSize, 90) by bin(TimeGenerated, 5m) 
| render timechart 

Размеры ответов

Статистика размеров ответов за последние 24 часа.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(ResponseSize), Median=percentile(ResponseSize, 50), 90th_Percentile=percentile(ResponseSize, 90) by bin(TimeGenerated, 5m) 
| render timechart 

Версии TLS клиента

Разбивка версий TLS клиента за последние 24 часа.

ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize count(CorrelationId) by ClientTlsVersion, _ResourceId 

Разбивка по причинам ошибок

Разбивка всех причин ошибок за последние 24 часа.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| where IsRequestSuccess == false
| summarize count(CorrelationId) by LastErrorReason, _ResourceId

Последние 100 неудачных запросов

Получение журналов последних 100 неудачных запросов.

ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| where IsRequestSuccess == false
| top 100 by TimeGenerated desc| where ResponseCode >= 400

Получение журналов неудачных запросов из-за проблем с серверной частью.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| where IsRequestSuccess == false
| where BackendResponseCode >= 400

Получение журналов неудачных запросов из-за проблем, не связанных с серверной частью (например, конфигурация политик управления API, превышено ограничение скорости, отключение клиента).

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| where IsRequestSuccess == false
| where isnull(BackendResponseCode) or BackendResponseCode < 400
| where ResponseCode >= 400

Общая задержка

Статистика общей задержки (в миллисекундах) между временем, когда управление API начинает получать запрос, и временем, когда Управление API завершает отправку ответа клиенту.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(TotalTime), Median=percentile(TotalTime, 50), 90th_Percentile=percentile(TotalTime, 90) by bin(TimeGenerated, 15m) 
| render timechart 

Задержка серверной части

Статистика времени (в миллисекундах), затраченного на серверные операции ввода-вывода.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(BackendTime), Median=percentile(BackendTime, 50), 90th_Percentile=percentile(BackendTime, 90) by bin(TimeGenerated, 15m) 
| render timechart 

Задержка клиента

Статистика времени (в миллисекундах), затраченного на операции ввода-вывода клиента.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Average=avg(ClientTime), Median=percentile(ClientTime, 50), 90th_Percentile=percentile(ClientTime, 90) by bin(TimeGenerated, 15m) 
| render timechart 

Коэффициент попаданий в кэш

Статистика соотношения попаданий и промахов в кэше.

// To create an alert for this query, click '+ New alert rule'
ApiManagementGatewayLogs
| where TimeGenerated > ago(1d)
| summarize Cache_Miss=countif(Cache  == "miss"), Cache_Hit=countif(Cache == "hit") by bin(TimeGenerated, 15m)
| extend Ratio=Cache_Hit / (Cache_Hit + Cache_Miss)
| project-away Cache_Hit , Cache_Miss 
| render timechart