在 Application Insights Agent 中禁用 JDBC 屏蔽

问题描述 投票:0回答:1

我正在我的 SpringBoot 应用程序 (v3.1.3) 中以编程方式附加最新的 Application Insight Java 代理 (v3.4.16),如此处所述。

我确实有

applicationinsights.json
,我的配置位于
src/main/resources
下。它看起来像这样(参见文档):

{
  "selfDiagnostics": {
    "destination": "console",
    "level": "TRACE"
  },
  "instrumentation": {
    "jdbc": {
      "masking": {
        "enabled": false
      }
    }
  }
}

日志记录级别被正确识别,因此代理会拾取配置文件。在提供有效的连接字符串后,我什至可以看到从本地实例向 Azure 报告的内容。

但是我仍然没有在跟踪中得到任何 SQL 参数解析。这些语句仍然像这样被屏蔽(来自我的本地客户端日志):

...
{"ver":2,"id":"3ce417f010b210df","name":"INSERT bubu.user_tbl",
"data":"insert into user_tbl (age,name,id) values (?,?,?)","type":"SQL",
"target":"localhost | bubu","duration":"00:00:00.005135","success":true}}}
...

On Azure it looks exactly same。知道为了在跟踪中获取 SQL 参数我缺少什么吗?任何帮助或建议表示赞赏。

java spring-boot azure azure-application-insights
1个回答
0
投票

我尝试了与上面相同的配置,下面是结果。

enter image description here

在这里,我的应用程序能够访问数据库,因此我会看到这些交互的依赖项遥测,但看不到跟踪数据。

enter image description here

这里,我在配置文件中做了一些更改。

{
  "selfDiagnostics": {
    "destination": "console",
    "level": "TRACE"
  },
  "instrumentation": {
    "jdbc": {
      "masking": {
        "enabled": false
      },
      "trackPreparedStatement": {
        "enabled": true
      },
      "parameterCollectionEnabled": true
    }
  }
}

然后我就可以通过带有 SQL 参数的依赖事务获取 Trace 事务。

结果:

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.