你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Query - Get
执行分析查询
对数据执行分析查询
GET https://api.applicationinsights.io/v1/apps/{appId}/query?query={query}
GET https://api.applicationinsights.io/v1/apps/{appId}/query?query={query}×pan={timespan}
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
app
|
path | True |
string |
应用程序的 ID。 这是 Azure 门户中“API 访问设置”边栏选项卡中的应用程序 ID。 |
query
|
query | True |
string |
Analytics 查询。 详细了解 Analytics 查询语法 |
timespan
|
query |
string |
可选。 要查询数据的时间跨度。 这是ISO8601时间段值。 除了在查询表达式中指定的任何时间跨度外,还会应用此时间跨度。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
成功的响应 |
|
Other Status Codes |
错误响应对象。 |
安全性
oauth2
连接到 Azure Application Insights API
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize?resource=https%3A%2F%2Fapi.applicationinsights.io
作用域
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
queryGet
示例请求
GET https://api.applicationinsights.io/v1/apps/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/query?query=requests | take 10×pan=PT12H
示例响应
x-ms-request-id: 58a37988-2c05-427a-891f-5e0e1266fcc5
x-ms-correlation-request-id: 58a37988-2c05-427a-891f-5e0e1266fcc5
{
"tables": [
{
"name": "PrimaryResult",
"columns": [
{
"name": "timestamp",
"type": "datetime"
},
{
"name": "id",
"type": "string"
},
{
"name": "source",
"type": "string"
},
{
"name": "name",
"type": "string"
},
{
"name": "url",
"type": "string"
},
{
"name": "success",
"type": "string"
},
{
"name": "resultCode",
"type": "string"
},
{
"name": "duration",
"type": "real"
},
{
"name": "performanceBucket",
"type": "string"
},
{
"name": "customDimensions",
"type": "dynamic"
},
{
"name": "customMeasurements",
"type": "dynamic"
},
{
"name": "operation_Name",
"type": "string"
},
{
"name": "operation_Id",
"type": "string"
},
{
"name": "operation_ParentId",
"type": "string"
},
{
"name": "operation_SyntheticSource",
"type": "string"
},
{
"name": "session_Id",
"type": "string"
},
{
"name": "user_Id",
"type": "string"
},
{
"name": "user_AuthenticatedId",
"type": "string"
},
{
"name": "user_AccountId",
"type": "string"
},
{
"name": "application_Version",
"type": "string"
},
{
"name": "client_Type",
"type": "string"
},
{
"name": "client_Model",
"type": "string"
},
{
"name": "client_OS",
"type": "string"
},
{
"name": "client_IP",
"type": "string"
},
{
"name": "client_City",
"type": "string"
},
{
"name": "client_StateOrProvince",
"type": "string"
},
{
"name": "client_CountryOrRegion",
"type": "string"
},
{
"name": "client_Browser",
"type": "string"
},
{
"name": "cloud_RoleName",
"type": "string"
},
{
"name": "cloud_RoleInstance",
"type": "string"
},
{
"name": "appId",
"type": "string"
},
{
"name": "appName",
"type": "string"
},
{
"name": "iKey",
"type": "string"
},
{
"name": "sdkVersion",
"type": "string"
},
{
"name": "itemId",
"type": "string"
},
{
"name": "itemType",
"type": "string"
},
{
"name": "itemCount",
"type": "int"
}
],
"rows": [
[
"2018-02-01T17:33:09.788Z",
"|0qRud6jz3k0=.c32c2659_",
null,
"GET Reports/Index",
"http://fabrikamfiberapp.azurewebsites.net/Reports",
"True",
"200",
"3.3833",
"<250ms",
"{\"_MS.ProcessedByMetricExtractors\":\"(Name:'Requests', Ver:'1.0')\"}",
null,
"GET Reports/Index",
"0qRud6jz3k0=",
"0qRud6jz3k0=",
"Application Insights Availability Monitoring",
"9fc6738d-7e26-44f0-b88e-6fae8ccb6b26",
"us-va-ash-azr_9fc6738d-7e26-44f0-b88e-6fae8ccb6b26",
null,
null,
"AutoGen_49c3aea0-4641-4675-93b5-55f7a62d22d3",
"PC",
null,
null,
"52.168.8.0",
"Boydton",
"Virginia",
"United States",
null,
"fabrikamfiberapp",
"RD00155D5053D1",
"cf58dcfd-0683-487c-bc84-048789bca8e5",
"fabrikamprod",
"5a2e4e0c-e136-4a15-9824-90ba859b0a89",
"web:2.5.0-33031",
"051ad4ef-0776-11e8-ac6e-e30599af6943",
"request",
"1"
],
[
"2018-02-01T17:33:15.786Z",
"|x/Ysh+M1TfU=.c32c265a_",
null,
"GET Home/Index",
"http://fabrikamfiberapp.azurewebsites.net/",
"True",
"200",
"716.2912",
"500ms-1sec",
"{\"_MS.ProcessedByMetricExtractors\":\"(Name:'Requests', Ver:'1.0')\"}",
null,
"GET Home/Index",
"x/Ysh+M1TfU=",
"x/Ysh+M1TfU=",
"Application Insights Availability Monitoring",
"58b15be6-d1e6-4d89-9919-52f63b840913",
"emea-se-sto-edge_58b15be6-d1e6-4d89-9919-52f63b840913",
null,
null,
"AutoGen_49c3aea0-4641-4675-93b5-55f7a62d22d3",
"PC",
null,
null,
"51.141.32.0",
"Cardiff",
"Cardiff",
"United Kingdom",
null,
"fabrikamfiberapp",
"RD00155D5053D1",
"cf58dcfd-0683-487c-bc84-048789bca8e5",
"fabrikamprod",
"5a2e4e0c-e136-4a15-9824-90ba859b0a89",
"web:2.5.0-33031",
"051ad4f0-0776-11e8-ac6e-e30599af6943",
"request",
"1"
]
]
}
]
}
定义
名称 | 说明 |
---|---|
column |
表列。 |
error |
错误详细信息。 |
error |
错误的代码和消息。 |
error |
错误详细信息。 |
query |
查询响应。 |
table |
查询响应表。 |
column
表列。
名称 | 类型 | 说明 |
---|---|---|
name |
string |
此列的名称。 |
type |
string |
此列的数据类型。 |
errorDetail
错误详细信息。
名称 | 类型 | 说明 |
---|---|---|
additionalProperties |
object |
|
code |
string |
错误的代码。 |
message |
string |
人工可读错误消息。 |
resources |
string[] |
指示对错误负责的资源。 |
target |
string |
指示请求中的哪个属性负责错误。 |
value |
string |
指示“target”中的哪个值负责错误。 |
errorInfo
错误的代码和消息。
名称 | 类型 | 说明 |
---|---|---|
additionalProperties |
object |
|
code |
string |
计算机可读错误代码。 |
details |
错误详细信息。 |
|
innererror |
错误的代码和消息。 |
|
message |
string |
人工可读错误消息。 |
errorResponse
错误详细信息。
名称 | 类型 | 说明 |
---|---|---|
error |
错误的代码和消息。 |
queryResults
查询响应。
名称 | 类型 | 说明 |
---|---|---|
tables |
table[] |
表、列和行的列表。 |
table
查询响应表。
名称 | 类型 | 说明 |
---|---|---|
columns |
column[] |
此表中的列列表。 |
name |
string |
表的名称。 |
rows |
string[] |
此查询生成的行。 |