值共享路径的一部分时,Application Insights API $ select不会返回所有结果 [英] Application Insights API $select not returning all results when values share part of path
问题描述
我不确定这是OData问题还是Application Insights问题,但是App Insights API并没有提供我选择的所有值.它通常在大多数时间都能正常工作,但是当我要求两个共享其路径起点的值时,它只会为我提供我要求的第二个值.
I'm not sure if this is an OData issue or an Application Insights issue, but the App Insights API is not giving me all of the values I selected. It works normally most of the time, but when I ask for two values that share the beginning of their path, it only gives me the second value I asked for.
这是我的问题的一个示例:
Here's an example of my issue:
数据:
{
"count": 1,
"type": "customEvent",
"customDimensions": {
"success": "true",
"version": "ver-1"
},
"other": {
"key": "val-1"
}
},
{
"count": 2,
"type": "customEvent",
"customDimensions": {
"success": "false",
"version": "ver-2"
},
"other": {
"key": "val-2"
}
}
所有这些都返回我期望的结果:
These all return the results that I'm expecting:
查询:$ select = count,type
Query: $select=count,type
{
"count": 1,
"type": "customEvent"
},
{
"count": 2,
"type": "customEvent"
}
查询:select = customDimensions/成功,其他/关键字
Query: select=customDimensions/success,other/key
{
"customDimensions": {
"success":"true"
},
"other": {
"key":"ver-1"
}
},
{
"customDimensions": {
"success":"false"
},
"other": {
"key":"ver-2"
}
}
但是,如果我尝试获取以相同路径开头的两个值,则只会显示第二个值.
However, if I try to get two values that start with the same path, it only shows me the second one.
查询:select = customDimensions/成功,customDimensions/版本
Query: select=customDimensions/success,customDimensions/version
{
"customDimensions": {
"version":"ver-1"
}
},
{
"customDimensions": {
"version":"ver-2"
}
}
这是OData还是Application Insights的问题,还是我可以通过其他方式格式化查询以提供所需的信息?谢谢!
Is this an issue with either OData or Application Insights, or is there some other way I can format my query to give me the information I want? Thanks!
推荐答案
更新: 您可以按以下方式使用查询api来获取数据:
Update: You can use the query api as following to fetch the data:
https://api.applicationinsights.io/v1/apps/Your_application_id/query?query=requests
| where timestamp >ago(5h)
| project customDimensions.UsersNamed, customDimensions.TenantsCoded
我在邮递员中对其进行了测试,请参见以下屏幕截图:
I test it in postman, see screenshot below:
似乎您的App Insights查询正常,我使用此.
Seems that your App Insights query is ok, I tested it using this .
我获取操作/名称和操作/id(以相同的路径开头),原始是这样的:
I fetch the operation/name and operation/id(which starts with same path), original like this:
然后输入一些必要条件,如以下屏幕截图所示:
Then input some necessary condition, as screenshot below:
单击获取"按钮后,您可以看到操作/名称和操作/id均已返回.
After click "Fetch" button, you can see the operation/name and operation/id are both returned.
这篇关于值共享路径的一部分时,Application Insights API $ select不会返回所有结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!