swhelan091 commented on a change in pull request #12138:
URL: https://github.com/apache/flink/pull/12138#discussion_r426019442
##########
File path:
flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporter.java
##########
@@ -157,6 +181,11 @@ private void addGaugesAndUnregisterOnException(DSeries
request) {
// Flink uses Gauge to store many types other
than Number
g.getMetricValue();
request.addGauge(g);
+ ++currentCount;
+ if (currentCount % maxMetricsPerRequestValue ==
0 || currentCount >= totalGauges) {
+ client.send(request);
Review comment:
I do like the sublist approach although `DatadogHttpClient` serializes a
`DSeries` not a `List`.
maybe something like:
```
List<DMetric> metrics = new ArrayList();
addGaugesAndUnregisterOnException(metrics);
metrics.addAll(counters.values());
metrics.addAll(meters.values());
int fromIndex = 0;
while (fromIndex < metrics.size()) {
int toIndex = Math.Min(fromIndex + maxMetricsPerRequestValue,
metrics.size());
client.send(new DSeries(metrics.subList(fromIndex, toIndex)));
fromIndex = toIndex;
}
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]