You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法在Hygieia构建组件加载Jenkins构建信息,遇MongoDB文档超限错误

Hygieia Jenkins Collector: "data not found" despite seeing job list, BsonSerializationException (document size exceeds 16MB)

Let's break down your problem and walk through actionable fixes step by step:

The Root Cause

That error org.bson.BsonSerializationException: Payload document size of is larger than maximum of 16777216 is a hard default limit from MongoDB: single BSON documents can't exceed 16MB.

Here's why you see the job list but no build data:

  • The Jenkins collector first pulls basic job metadata (names, URLs, etc.)—this data is tiny, so it saves to MongoDB without issues, which is why the dropdown menu works.
  • When you select a job, the collector tries to fetch detailed build data (historical builds, logs, artifacts, etc.) for that job. If the job has hundreds of builds, massive build logs, or lots of artifacts, the combined data exceeds MongoDB's 16MB limit, so the write to the database fails. No stored data means the UI shows "data not found".

Troubleshooting & Fixes

1. Identify the problematic Jenkins Job

First, pinpoint which job is causing the oversized document:

  • Crank up the Jenkins collector's log level to DEBUG in its config file and restart the service. The debug logs will show exactly which job it's processing when the error triggers.
  • Look for jobs with an unusually high number of historical builds, or builds with large logs/artifacts.

2. Reduce the data collected per job (Recommended Fix)

Adjust your Jenkins collector's configuration (usually application.properties or application.yml) to cut down on the data it tries to save:

  • Limit historical builds: Add jenkins.collector.buildsLimit=50 (replace 50 with your preferred number of recent builds to retain). This caps the number of builds stored per job, drastically reducing document size.
  • Skip build logs: If you don't need build log data in Hygieia, set jenkins.collector.skipBuildLogs=true—logs are often the biggest contributor to large documents.
  • Skip artifacts: Disable artifact collection with jenkins.collector.skipArtifacts=true if you don't require that data.

3. Verify MongoDB's document size limit (Not Recommended)

While you can increase MongoDB's maximum document size via the storage.bsonFileSize configuration, this is not a best practice. MongoDB is optimized for small, frequent queries; oversized documents will slow down queries and can destabilize your database cluster. Only consider this if you absolutely need all the build data and the above fixes aren't sufficient.

4. Validate the Jenkins API response size

Manually call the Jenkins API for the suspect job to confirm its data size:

GET <your-jenkins-url>/job/<problem-job-name>/api/json?depth=2

Save the response and check its file size. If it's close to or over 16MB, that confirms the issue—your collector is trying to save this entire payload as a single MongoDB document.

5. Test the fix

After adjusting the collector's config, restart the Jenkins collector service. Check the logs to ensure the BsonSerializationException is gone, then reconfigure the Hygieia dashboard component. The build data should load successfully now.


内容的提问来源于stack exchange,提问作者Decoder

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 18:52:47