azure - Azure ApplicationInsights 指标语法?- 内部服务器故障
问题描述
我正在使用 ApplicationInsights API Explorer 来测试过滤器子句。但这会导致错误。
我发现了我从中派生过滤器的语法 (startswith(request/name, 'GET')) 的罕见示例。
在 API Explorer 上: https ://dev.applicationinsights.io/apiexplorer/metrics 我输入了我的帐户凭据。
我的参数是:
指标 ID:
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"
}
但我预计从“开发”开始的任何 cloud_RoleInstance 到达 AppInsights 的请求数量。
文档链接通常指向https://dev.applicationinsights.io/ 但我似乎找不到任何有关过滤器语法的有用信息。不支持属性 cloud_RoleInstance 吗?
解决方案
根据规范,过滤器查询是一个OData 查询“其中每个子句的键应该是您正在检索的指标的适用维度”。如果我将您的过滤器查询稍微更改为,cloud_RoleInstance eq 'development'
那么我会收到一个更有用的错误:“以下维度在此指标的过滤器子句中无效:cloud_RoleInstance”。我将与产品团队联系,以首先返回更有用的错误消息。
执行此操作的正确方法是查询 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
并返回您正在寻找的结果。
推荐阅读
- spring - Spring boot 运行错误 bootRun 工作正常,但应用程序运行不工作
- android - 检测当前是否正在显示最近的应用程序(又名概览屏幕)
- java - 将文件从目录复制到手机内部存储的另一个目录时出错?
- google-bigquery - bigquery 嵌套对象:没有这样的字段
- java - XWPF 删除第一页
- java - 带属性的弹簧单例
- unit-testing - 等价分区
- ruby-on-rails - 如何通过发布请求防止 ruby on rails 中的 SQL 注入
- spring - GET 类型的 REST 服务的 DTO 映射
- php - Laravel 5.6 使用 Ajax 登录后无法访问用户详细信息