[ https://issues.apache.org/jira/browse/FLINK-7502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16205659#comment-16205659 ]
ASF GitHub Bot commented on FLINK-7502: --------------------------------------- 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`? > PrometheusReporter improvements > ------------------------------- > > Key: FLINK-7502 > URL: https://issues.apache.org/jira/browse/FLINK-7502 > Project: Flink > Issue Type: Improvement > Components: Metrics > Affects Versions: 1.4.0 > Reporter: Maximilian Bode > Assignee: Maximilian Bode > Priority: Minor > Fix For: 1.4.0 > > > * do not throw exceptions on metrics being registered for second time > * allow port ranges for setups where multiple reporters are on same host > (e.g. one TaskManager and one JobManager) > * do not use nanohttpd anymore, there is now a minimal http server included > in [Prometheus JVM client|https://github.com/prometheus/client_java] -- This message was sent by Atlassian JIRA (v6.4.14#64029)