[
https://issues.apache.org/jira/browse/HADOOP-18954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17782521#comment-17782521
]
ASF GitHub Bot commented on HADOOP-18954:
-----------------------------------------
K0K0V0K commented on code in PR #6229:
URL: https://github.com/apache/hadoop/pull/6229#discussion_r1381509417
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/jmx/TestJMXJsonServlet.java:
##########
@@ -62,10 +62,15 @@ public static void assertReFind(String re, String value) {
result = readOutput(new URL(baseUrl, "/jmx?qry=java.lang:type=Memory"));
assertReFind("\"name\"\\s*:\\s*\"java.lang:type=Memory\"", result);
assertReFind("\"modelerType\"", result);
-
+
+ System.setProperty("THE_TEST_OF_THE_NAN_VALUES",
String.valueOf(Float.NaN));
result = readOutput(new URL(baseUrl, "/jmx"));
assertReFind("\"name\"\\s*:\\s*\"java.lang:type=Memory\"", result);
-
+ assertReFind(
Review Comment:
Hi @Hexiaoqiao !
Thanks for the review!
Yes, I think it would be good to have a test like that, but that change just
won't be nice I am afraid.
The problem is that there is no nice way to connect the
**HttpServerFunctionalTest#createTestServer(Configuration conf)** to the
**JMXJsonServlet**, cause in the **HttpServlet2#addDefaultServlets** we just
provide class reference.
A possible solution is to create another JMX servlet class to do the trick.
I would prefer the previous code, cause that was less ugly, but I am open to
keeping this one, to have the the test.
> Filter NaN values from JMX json interface
> -----------------------------------------
>
> Key: HADOOP-18954
> URL: https://issues.apache.org/jira/browse/HADOOP-18954
> Project: Hadoop Common
> Issue Type: Improvement
> Components: common
> Reporter: Bence Kosztolnik
> Assignee: Bence Kosztolnik
> Priority: Major
> Labels: pull-request-available
>
> As we can see in this [Yarn
> documentation|https://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html]
> beans can represent Float values as NaN. These values will be represented in
> the JMX response JSON like:
> {noformat}
> ...
> "GuaranteedCapacity": NaN,
> ...
> {noformat}
> Based on the [JSON doc|https://www.json.org/] NaN is not a valid JSON token (
> however some of the parser libs can handle it ), so not every consumer can
> parse values like these.
> To be able to parse NaN values, a new feature flag should be created.
> The new feature will replace the NaN values with 0.0 values.
> The feature is default turned off. It can be enabled with the
> *hadoop.http.jmx.nan-filter.enabled* config.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]