Azure 流分析 GetRecordPropertyValue 难题
Azure Stream Analytics GetRecordPropertyValue puzzle
任何人都可以轻松地发现我在这里做错了什么吗?
我正在使用以下查询:
SELECT
GetArrayElement(Requests.context.custom.dimensions, 0),
GetType( GetArrayElement(Requests.context.custom.dimensions, 0)),
GetRecordPropertyValue(GetArrayElement(Requests.context.custom.dimensions, 0), "Response-Body")
INTO
PowerBICreateScheduleDurations
FROM
AppInsightsIncomingRequests AS Requests
要解析此输入文件:
{
"request":[{
"id": "dff22190-ecc8-44d2-aa3f-453c3d533c4d",
"name": "",
"count": 1,
"responseCode": 401,
"success":错误,
"url": "",
"urlData":{
"base": "",
"host": "",
"hashTag": "",
"protocol": "https"
},
"durationMetric":{
"value": 4786.0,
"count": 1.0,
"min": 4786.0,
"max": 4786.0,
"stdDev": 0.0,
"sampledValue":4786.0
}
}
],
"internal":{
"data":{
"id": "f0b0f800-ab16-11e8-89c8-ed6412963258",
"documentVersion":“1.61”
}
},
"context":{
"data":{
"eventTime": "2018-08-28T23:05:54.8884157Z",
"isSynthetic":错误,
"samplingRate": 100.0
},
"cloud":{},
"device":{
"type": "PC",
"roleName": "",
"roleInstance": "",
"screenResolution":{}
},
"session":{
"isFirst": 错误
},
"operation":{
"id": "dff22190-ecc8-44d2-aa3f-453c3d533c4d",
"parentId": "dff22190-ecc8-44d2-aa3f-453c3d533c4d",
"name":“”
},
"location":{
"clientip": "0.0.0.0",
"continent": "North America",
"country": "United States"
},
"custom":{
"dimensions": [{
"Response-Body": "response 0"
}, {
"Operation Name":“”
}, {
"ApimanagementRegion":“”
}, {
"ApimanagementServiceName":“”
}, {
"Cache": "None"
}, {
"API Name":“”
}, {
"HTTP Method": "GET"
}
],
"metrics":[{
"Response Size":{
"count": 1.0,
"max": 343.0,
"min": 343.0,
"sampledValue": 343.0,
"stdDev": 0.0,
"sum": 343.0,
"value": 343.0
}
}, {
"Request Size":{
"count": 1.0,
"max": 0.0,
"min": 0.0,
"sampledValue": 0.0,
"stdDev": 0.0,
"sum": 0.0,
"value":0.0
}
}, {
"Client Time (in ms)":{
"count": 1.0,
"max": 0.0,
"min": 0.0,
"sampledValue": 0.0,
"stdDev": 0.0,
"sum": 0.0,
"value":0.0
}
}
]
}
}
}
期望的行为是 GetRecordPropertyValue...
行提取 "response 0" 字符串,但它 returns 为空。下载的输出如下:
[{
"getarrayelement": {
"Response-Body": "response 0"
},
"gettype": "record",
"getrecordpropertyvalue": null
}
]
请将您的查询更改为在 'Response-Body' 周围使用单引号。在 SQL 中,双引号用于转义列名(类似于 []),因此您的查询被解释为名称为 "Response-Body" 的列,而不是字符串常量 "Response-Body"
SELECT
GetArrayElement(Requests.context.custom.dimensions, 0),
GetType( GetArrayElement(Requests.context.custom.dimensions, 0)),
GetRecordPropertyValue(GetArrayElement(Requests.context.custom.dimensions, 0), 'Response-Body')
进入
PowerBICreateScheduleDurations
从
AppInsightsIncomingRequests AS 请求
任何人都可以轻松地发现我在这里做错了什么吗?
我正在使用以下查询:
SELECT
GetArrayElement(Requests.context.custom.dimensions, 0),
GetType( GetArrayElement(Requests.context.custom.dimensions, 0)),
GetRecordPropertyValue(GetArrayElement(Requests.context.custom.dimensions, 0), "Response-Body")
INTO
PowerBICreateScheduleDurations
FROM
AppInsightsIncomingRequests AS Requests
要解析此输入文件:
{ "request":[{ "id": "dff22190-ecc8-44d2-aa3f-453c3d533c4d", "name": "", "count": 1, "responseCode": 401, "success":错误, "url": "", "urlData":{ "base": "", "host": "", "hashTag": "", "protocol": "https" }, "durationMetric":{ "value": 4786.0, "count": 1.0, "min": 4786.0, "max": 4786.0, "stdDev": 0.0, "sampledValue":4786.0 } } ], "internal":{ "data":{ "id": "f0b0f800-ab16-11e8-89c8-ed6412963258", "documentVersion":“1.61” } }, "context":{ "data":{ "eventTime": "2018-08-28T23:05:54.8884157Z", "isSynthetic":错误, "samplingRate": 100.0 }, "cloud":{}, "device":{ "type": "PC", "roleName": "", "roleInstance": "", "screenResolution":{} }, "session":{ "isFirst": 错误 }, "operation":{ "id": "dff22190-ecc8-44d2-aa3f-453c3d533c4d", "parentId": "dff22190-ecc8-44d2-aa3f-453c3d533c4d", "name":“” }, "location":{ "clientip": "0.0.0.0", "continent": "North America", "country": "United States" }, "custom":{ "dimensions": [{ "Response-Body": "response 0" }, { "Operation Name":“” }, { "ApimanagementRegion":“” }, { "ApimanagementServiceName":“” }, { "Cache": "None" }, { "API Name":“” }, { "HTTP Method": "GET" } ], "metrics":[{ "Response Size":{ "count": 1.0, "max": 343.0, "min": 343.0, "sampledValue": 343.0, "stdDev": 0.0, "sum": 343.0, "value": 343.0 } }, { "Request Size":{ "count": 1.0, "max": 0.0, "min": 0.0, "sampledValue": 0.0, "stdDev": 0.0, "sum": 0.0, "value":0.0 } }, { "Client Time (in ms)":{ "count": 1.0, "max": 0.0, "min": 0.0, "sampledValue": 0.0, "stdDev": 0.0, "sum": 0.0, "value":0.0 } } ] } } }
期望的行为是 GetRecordPropertyValue...
行提取 "response 0" 字符串,但它 returns 为空。下载的输出如下:
[{
"getarrayelement": {
"Response-Body": "response 0"
},
"gettype": "record",
"getrecordpropertyvalue": null
}
]
请将您的查询更改为在 'Response-Body' 周围使用单引号。在 SQL 中,双引号用于转义列名(类似于 []),因此您的查询被解释为名称为 "Response-Body" 的列,而不是字符串常量 "Response-Body"
SELECT GetArrayElement(Requests.context.custom.dimensions, 0), GetType( GetArrayElement(Requests.context.custom.dimensions, 0)), GetRecordPropertyValue(GetArrayElement(Requests.context.custom.dimensions, 0), 'Response-Body') 进入 PowerBICreateScheduleDurations 从 AppInsightsIncomingRequests AS 请求