You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/15 20:00:32 UTC

[GitHub] [flink] swhelan091 commented on a change in pull request #12138: [FLINK-16611] [datadog-metrics] Make number of metrics per request configurable

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:
users@infra.apache.org