Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4586#discussion_r144807031
  
    --- Diff: 
flink-metrics/flink-metrics-prometheus/src/main/java/org/apache/flink/metrics/prometheus/PrometheusReporter.java
 ---
    @@ -194,66 +239,46 @@ private static Collector newGauge(String name, String 
identifier, List<String> l
                        .setChild(child, toArray(labelValues));
        }
     
    -   private static HistogramSummaryProxy createSummary(final Histogram 
histogram, final String name, final String identifier, final List<String> 
dimensionKeys, final List<String> dimensionValues) {
    -           return new HistogramSummaryProxy(histogram, name, identifier, 
dimensionKeys, dimensionValues);
    -   }
    -
    -   static class PrometheusEndpoint extends NanoHTTPD {
    -           static final String MIME_TYPE = "plain/text";
    -
    -           PrometheusEndpoint(int port) {
    -                   super(port);
    -           }
    -
    -           @Override
    -           public Response serve(IHTTPSession session) {
    -                   if (session.getUri().equals("/metrics")) {
    -                           StringWriter writer = new StringWriter();
    -                           try {
    -                                   TextFormat.write004(writer, 
CollectorRegistry.defaultRegistry.metricFamilySamples());
    -                           } catch (IOException e) {
    -                                   return 
newFixedLengthResponse(Response.Status.INTERNAL_ERROR, MIME_TYPE, "Unable to 
output metrics");
    -                           }
    -                           return 
newFixedLengthResponse(Response.Status.OK, TextFormat.CONTENT_TYPE_004, 
writer.toString());
    -                   } else {
    -                           return 
newFixedLengthResponse(Response.Status.NOT_FOUND, MIME_TYPE, "Not found");
    -                   }
    -           }
    -   }
    -
    -   private static class HistogramSummaryProxy extends Collector {
    -           private static final List<Double> QUANTILES = Arrays.asList(.5, 
.75, .95, .98, .99, .999);
    +   static class HistogramSummaryProxy extends Collector {
    --- End diff --
    
    `@VisibleForTesting`?


---

Reply via email to