在 customDimensions 中扩展来自 json 的数据
Extending data from json in customDimensions
我正在使用以下代码将数据发送到 application insights
appInsights.trackEvent({
name:'EventName',
proprties:{'keys1':'value1' , 'key2':JSON.stringify({'nestedKey':'someValue'})}
});
在数据资源管理器中查询相同内容时
customEvents
| extend key2_1 = parse_json(customDimensions.key2)
| extend key1_1 = tostring(customDimensions.key1)
| extend nestedKey1 = tostring(key2_1.nestedKey)
| extend nestedKey2 = tostring(customDimensions.key2.nestedKey)
nestedKey1
和nestedKey2
都是空的,但是key1_1
和key2_1
都有数据
只需替换 2 行:
| extend nestedKey1 = tostring(key2_1.nestedKey)
| extend nestedKey2 = tostring(customDimensions.key2.nestedKey)
包含以下 2 行:
| extend nestedKey1 = parse_json(tostring(key2_1)).nestedKey
| extend nestedKey2 = parse_json(tostring(parse_json(customDimensions.key2))).nestedKey
这是我这边的测试结果:
我正在使用以下代码将数据发送到 application insights
appInsights.trackEvent({
name:'EventName',
proprties:{'keys1':'value1' , 'key2':JSON.stringify({'nestedKey':'someValue'})}
});
在数据资源管理器中查询相同内容时
customEvents
| extend key2_1 = parse_json(customDimensions.key2)
| extend key1_1 = tostring(customDimensions.key1)
| extend nestedKey1 = tostring(key2_1.nestedKey)
| extend nestedKey2 = tostring(customDimensions.key2.nestedKey)
nestedKey1
和nestedKey2
都是空的,但是key1_1
和key2_1
都有数据
只需替换 2 行:
| extend nestedKey1 = tostring(key2_1.nestedKey)
| extend nestedKey2 = tostring(customDimensions.key2.nestedKey)
包含以下 2 行:
| extend nestedKey1 = parse_json(tostring(key2_1)).nestedKey
| extend nestedKey2 = parse_json(tostring(parse_json(customDimensions.key2))).nestedKey
这是我这边的测试结果: