Apache Software Foundation / SeaTunnel
Merged upstreamMaintenanceMerged Sep 1, 2026

Validate Prometheus batch size declaratively

Migrated the Prometheus sink's positive `batch_size` constraint from imperative configuration code into SeaTunnel's declarative `OptionRule` contract.

apache/seatunnel · #11738

Configuration quality improvement

Invalid Prometheus sink batch sizes now fail during structured option validation while omitted values retain the supported default.

Problem

Zero and negative batch sizes were rejected later by connector-specific code, so validation was not expressed consistently through the factory option model and its structured error reporting.

Approach

Declared the greater-than-zero rule in `PrometheusSinkFactory`, removed the redundant imperative check, retained optional/default behavior, and aligned option metadata plus English and Chinese documentation.

Impact and scope

  • Surfaces invalid configuration earlier through SeaTunnel's standard validation path.
  • Keeps accepted values and default behavior backward compatible while removing duplicate validation logic.
  • Aligns runtime validation, option metadata, tests, and connector documentation.

Validation

  • Added focused factory tests for omitted, positive, zero, and negative values with option-specific errors.
  • Passed the complete Prometheus connector package and final Apache Build.
  • The landed commits and GitHub-verified merge credit Goutam Adwant; the contribution received upstream approval.