Houlong66 opened a new pull request, #10239:
URL: https://github.com/apache/rocketmq/pull/10239

   ## What is the purpose of the change
   
   When high-cardinality metrics (e.g., consumer lag with consumer_group × 
topic combinations) are exported
   via OTLP gRPC, the payload can exceed the gRPC 32MB message size limit or 
the backend's per-RPC processing
   limit, causing **all metrics to fail to export**.
   
   The OpenTelemetry Java SDK does not support automatic batch splitting for 
metrics export
   (see 
[opentelemetry-java#5394](https://github.com/open-telemetry/opentelemetry-java/issues/5394)).
   
   This PR adds a `MetricExporter` decorator that:
   - Splits large batches of `MetricData` objects into smaller sub-batches by 
data point count
   - Splits single oversized `MetricData` objects by their internal data points 
into multiple
     smaller `MetricData` objects (supports all 7 `MetricDataType` variants)
   - Provides a fast path with zero overhead when data points are within the 
threshold
   - Is configurable via `BrokerConfig.metricsExportBatchMaxDataPoints` 
(default 1000)
   - Logs failed batch details for debugging
   
   ## Brief changelog
   
   - Add `BatchSplittingMetricExporter` implementing `MetricExporter` as a 
decorator
   - Integrate it in `BrokerMetricsManager` to wrap `OtlpGrpcMetricExporter`
   - Add `metricsExportBatchMaxDataPoints` config to `BrokerConfig` (default 
1000, dynamically updatable)
   - Add unit tests (18 test cases)
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - `mvn test -pl broker -Dtest=BatchSplittingMetricExporterTest`


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to