如何通过Microsoft Application Insights的API *实时指标*进行检索 [英] How can I retrieve through an API *Live Metrics* of Microsoft Application Insights

本文介绍了如何通过Microsoft Application Insights的API *实时指标*进行检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Live Metrics Stream管理UI监视Azure函数的执行,如下所示:其中一些指标可以通过

2)使用 API参考来运行查询"

I monitor the execution of an Azure function using the Live Metrics Stream management UI as seen below: Some of these metrics can be retrieved through the Application Insights REST API. However, metrics concerning overall health data, or Servers data, return a null value. For example,the performanceCounters/processCpuPercentage endpoint produces the following output when probed:

HTTP/1.1 200
content-type: application/json; charset=utf-8
{
  "value": {
    "start": "2018-10-16T11:20:37.366Z",
    "end": "2018-10-16T12:20:37.366Z",
    "performanceCounters/processCpuPercentage": {
      "avg": null
    }
  }
}

Is there a way to get the information appearing under the overall health and servers rows in the UI, through the API?

解决方案

It is not possible to retrieve live data at the moment.

For retrieving historical data you need the following.

1) First to come up with a query which returns data you're interested in. Here is an example (shows Request Count, 95th CPU, 95th Request Duration by Server):

let start = ago(1d);
requests
| where timestamp > start
| summarize ["RequestCount"]=count(), ["Duration"]=percentile(duration, 95) by cloud_RoleInstance
| join (
    performanceCounters
    | where timestamp > start
    | where name == "% Processor Time Normalized"
    | where category == "Process"
    | summarize ["CPU"]=percentile(value, 95) by cloud_RoleInstance
) on cloud_RoleInstance
| project cloud_RoleInstance, RequestCount, Duration, CPU
| order by RequestCount 

You can adjust Analytics query the way you need.

Example output:

2) Use the API reference to run "Query"

这篇关于如何通过Microsoft Application Insights的API *实时指标*进行检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆