cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andres de la Peña (Jira) <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-16938) Missed wait latencies in the output of `nodetool tpstats -F`
Date Fri, 10 Sep 2021 12:35:00 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-16938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andres de la Peña updated CASSANDRA-16938:
------------------------------------------
          Fix Version/s:     (was: 4.0.x)
                         4.0.2
          Since Version: 4.0-beta3
    Source Control Link: https://github.com/apache/cassandra/commit/636ab42bd5b2d2e55d37ce653daf23955f869a38
             Resolution: Fixed
                 Status: Resolved  (was: Ready to Commit)

> Missed wait latencies in the output of `nodetool tpstats -F`
> ------------------------------------------------------------
>
>                 Key: CASSANDRA-16938
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16938
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tool/nodetool
>            Reporter: Andres de la Peña
>            Assignee: Andres de la Peña
>            Priority: Normal
>             Fix For: 4.0.2, 4.1
>
>         Attachments: json-after.txt, json-before.txt
>
>
> The output of {{nodetool tpstats -F json}} always prints an empty map for {{WaitLatencies}}:
> {code:java}
> $ nodetool tpstats -F json
> (...)"WaitLatencies":{},(...)
> {code}
> The same happens with yaml output:
> {code:java}
> $ nodetool tpstats -F yaml
> (...)
> WaitLatencies: {}
> (...)
> {code}
> This happens because [this cast|https://github.com/apache/cassandra/blob/cassandra-4.0.1/src/java/org/apache/cassandra/tools/nodetool/stats/TpStatsHolder.java#L61-L63]
silently fails inside a try-catch with an empty catch block:
> {code:java}
> String[] strValues = (String[]) Arrays.stream(probe.metricPercentilesAsArray(probe.getMessagingQueueWaitMetrics(entry.getKey())))
>                                       .map(D -> D.toString())
>                                       .toArray();
> {code}
> When we would need something like:
> {code:java}
> String[] strValues = Arrays.stream(probe.metricPercentilesAsArray(probe.getMessagingQueueWaitMetrics(entry.getKey())))
>                            .map(Object::toString)
>                            .toArray(String[]::new);
> {code}
> This conversion from {{Double[]}} to {{String[]}} was introduced during CASSANDRA-16230.
My guess is that the conversion was done trying to work around a malformed JSON output detected
in [the new tests|https://github.com/apache/cassandra/blob/cassandra-4.0.1/test/unit/org/apache/cassandra/tools/NodeToolTPStatsTest.java#L158]
added by that ticket. Without the conversion the output would be something like:
> {code:java}
> $ nodetool tpstats -F json
> (...)"WaitLatencies":{"READ_RSP":[Ljava.lang.Double;@398dada8,(...)
> {code}
> That's because {{json-simple}} doesn't handle well arrays. I think that instead of converting
the array of doubles to an array of strings we can simply use {{jackson-mapper-asl}} to print
the proper array.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message