You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "surafel58 (via GitHub)" <gi...@apache.org> on 2026/08/13 16:42:22 UTC

[PR] [Bug][Connector-V2][Prometheus] Apply batch_size default in loadConfig [seatunnel]

surafel58 opened a new pull request, #11797:
URL: https://github.com/apache/seatunnel/pull/11797

   ### Purpose of this pull request
   
   Follow-up to the review discussion on #11778 (raised by @nzw921rx and @DanielLeens).
   
   `PrometheusSinkConfig.loadConfig()` set `batch_size` only when the key was present, guarded by
   `getOptional(BATCH_SIZE).isPresent()`. `ReadonlyConfig.getOptional()` does not fall back to the
   option's declared default (only `get()` does, via `getOptional(option).orElseGet(option::defaultValue)`).
   So a job that omits `batch_size` ended up with `batchSize = 0`, and the size-based flush trigger in
   the writer (`batchSize > 0 && batchList.size() >= batchSize`) never fired. The declared default of
   `1024` in `PrometheusSinkOptions.BATCH_SIZE` was effectively ignored.
   
   This PR uses `get()` so the declared default is applied when `batch_size` is not configured.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, a bug fix. A `Prometheus` sink that does not set `batch_size` now buffers up to the documented
   default of `1024` rows before a size-based flush, instead of never flushing by size (`batchSize = 0`).
   Jobs that explicitly set `batch_size` are unaffected.
   
   ### How was this patch tested?
   
   Added `PrometheusSinkConfigTest` with three cases:
   
   - `batch_size` not configured -> `loadConfig` returns the declared default (`1024`);
   - `batch_size` configured -> that value is used;
   - `batch_size` non-positive -> rejected by the existing `checkArgument` guard.
   
   ```
   ./mvnw -pl seatunnel-connectors-v2/connector-prometheus test
   => Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   ### Check list
   
   * [x] Code changed are covered with tests.
   * [ ] If any new Jar binary package adding in your PR, please add License Notice — N/A.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Bug][Connector-V2][Prometheus] Apply batch_size default in loadConfig [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #11797:
URL: https://github.com/apache/seatunnel/pull/11797#issuecomment-5288500682

   Thanks for your contribution! This is a solid addition to the project, and your attention to detail really shows. Contributors like you are what keep this community moving forward. Feel free to keep the PRs coming — we're always glad to have you here!
   
   Please ignore the following message if you have joined in the Slack~
   ```
   To facilitate focused communication among contributors, we’ve created a brand-new dedicated #contributors channel in official Slack workspace.
   Slack workspace link: https://s.apache.org/seatunnel-slack
   
   This channel is designed for technical discussions, feature design brainstorming, roadmap sync and direct communication with project core Contributors. Everyone who contributes code, docs, test cases or community ideas is warmly invited to join, share thoughts and collaborate together under The Apache Way. Welcome to join 😄
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Bug][Connector-V2][Prometheus] Apply batch_size default in loadConfig [seatunnel]

Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #11797:
URL: https://github.com/apache/seatunnel/pull/11797


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org