ApplicationInsights V3 Java无代码Telemetry Processor的Include规则失效
问题
需要为所有包含属性toto且值为valuetoto的日志添加新属性opfacility,但配置后未生效。使用Application Insights Agent 3.4.15.jar,配置Telemetry Processor后出现以下现象:
- 移除
Include规则时,处理器可正常添加属性 - 添加
Include规则后失效 - 事务搜索结果中已确认存在
toto=valuetoto的自定义属性,但目标属性opfacility未被添加
当前配置JSON如下:
{ "connectionString": "secret", "role": { "name": "dev" }, "preview": { "processors": [ { "type": "attribute", "include": { "matchType": "strict", "attributes": [ { "key": "toto", "value": "valuetoto" } ] }, "actions": [ { "key": "opfacility", "value": "opcpf", "action": "insert" } ] } ] } }
分析与解决
问题出在include规则的格式错误:
- Application Insights Agent的
strict匹配类型要求直接将目标属性的键值对定义在include节点下,而非嵌套在attributes数组中,你的配置写法不符合处理器的预期解析逻辑
修正后的配置如下:
{ "connectionString": "secret", "role": { "name": "dev" }, "preview": { "processors": [ { "type": "attribute", "include": { "matchType": "strict", "toto": "valuetoto" }, "actions": [ { "key": "opfacility", "value": "opcpf", "action": "insert" } ] } ] } }
额外验证提示:
- 确认
toto属性是在Telemetry Processor执行阶段就已存在,避免部分自定义属性在处理器之后才被添加导致匹配失效 - 重启Application Insights Agent加载新配置,避免旧配置缓存影响
内容的提问来源于stack exchange,提问作者Marcel Pagnol
相关产品推荐
相关产品推荐

