我正在使用ApplicationInsights API资源管理器测试一个过滤器子句。但它会导致一个错误。
我发现了用于语法(startswith(request.name,‘GET“)的罕见示例,我的过滤器就是从语法派生出来的。
在API:https://dev.applicationinsights.io/apiexplorer/metrics上,我输入了我的帐户凭据。
我的参数是:
MetricID:
requests/count过滤器:
startswith(request/cloud_RoleInstance, 'development')在Kusto语言中,查询应该是:
requests
| where cloud_RoleInstance startswith "development"
| count 并且工作正常:结果:~ 47,000
我的查询结果是:
"error": {
"message": "Unexpected error occurred",
"code": "InternalServerFault",
"innererror": {
"code": "QueryCompilationError"
}但是,我希望从任何以“开发”开始的AppInsights请求的数量。
文档链接通常指向https://dev.applicationinsights.io/,但我似乎找不到关于过滤器语法的任何有用信息。属性cloud_RoleInstance不受支持吗?
发布于 2019-08-19 20:45:26
根据规格,过滤器查询是一个OData查询,其中每个子句的键应该是您正在检索的度量的适用维度。如果将筛选器查询稍微更改为cloud_RoleInstance eq 'development',则会得到一个更有用的错误:“对于此度量:cloud_RoleInstance,以下维度在filter子句中无效”。我将与产品团队联系,首先返回一个更有用的错误消息。
正确的方法是查询API。与将查询转换为OData不同,您可以对Kusto查询进行编码并按原样发送。
requests
| where cloud_RoleInstance startswith "development"
| count 编码为:
GET /v1/apps/{YOUR_APP}/query?query=requests%7C%20where%20cloud_RoleInstance%20startswith%20%22development%22%20%7C%20count%20 并返回您正在寻找的结果。
https://stackoverflow.com/questions/57525608
复制相似问题