timeabarna commented on a change in pull request #5673:
URL: https://github.com/apache/nifi/pull/5673#discussion_r788610509
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/TestFlowResource.java
##########
@@ -174,4 +291,79 @@ private String getResponseOutput(final Response response)
throws IOException {
final CollectorRegistry otherJvmCollectorRegistry =
PrometheusMetricsUtil.createJvmMetrics(jvmMetricsRegistry,
JmxJvmMetrics.getInstance(), OTHER_LABEL_VALUE);
return Arrays.asList(jvmCollectorRegistry, otherJvmCollectorRegistry);
}
+
+ private Map<String, List<Collector.MetricFamilySamples.Sample>>
convertJsonResponseToMap(final Response response) throws IOException {
+ final String json = getResponseOutput(response);
+ final Type type = new TypeToken<Map<String,
List<Collector.MetricFamilySamples.Sample>>>() {}.getType();
+ return new Gson().fromJson(json, type);
Review comment:
As Prometheus Sample has no default constructor and 2 argument
constructors so ObjectMapper was not able to deserialise. I needed to create a
custom deserialiser for Sample.
--
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]