exceptionfactory commented on a change in pull request #5582:
URL: https://github.com/apache/nifi/pull/5582#discussion_r765091931



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java
##########
@@ -420,7 +422,10 @@ public Response getFlowMetrics(
                     value = "The producer for flow file metrics. Each producer 
may have its own output format.",
                     required = true
             )
-            @PathParam("producer") final String producer) throws 
InterruptedException {
+            @PathParam("producer") final String producer,
+            @QueryParam("sampleName") final String sampleName,
+            @QueryParam("sampleLabelValues") final String sampleLabelValues,
+            @QueryParam("firstFieldName") @DefaultValue("samples") final 
String firstFieldName) throws InterruptedException {

Review comment:
       These new parameters are helpful, but they appear to be applied only to 
the JSON format.  Instead, they should apply to all output formats, which might 
require a bit more refactoring to reduce potential duplication.

##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java
##########
@@ -442,6 +447,26 @@ public Response getFlowMetrics(
             return generateOkResponse(response)
                     .type(MediaType.TEXT_PLAIN_TYPE)
                     .build();
+        } else if ("json".equalsIgnoreCase(producer)) {
+            final Collection<CollectorRegistry> allRegistries = 
serviceFacade.generateFlowMetrics();
+            final Map<String, List<Collector.MetricFamilySamples.Sample>> 
response = new HashMap<>();

Review comment:
       Did you consider writing out the response using `StreamingOutput` 
analogous to the current Prometheus approach?




-- 
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