mirror of https://github.com/apache/druid.git
DirectDruidClient: Fix division by zero. (#4206)
* DirectDruidClient: Fix division by zero. Introduced in #3954 when some floating math was changed to integer math. This patch restores the old math. * Added comment.
This commit is contained in:
parent
de815da942
commit
809112cd5f
|
@ -269,13 +269,14 @@ public class DirectDruidClient<T> implements QueryRunner<T>
|
|||
{
|
||||
long stopTimeNs = System.nanoTime();
|
||||
long nodeTimeNs = stopTimeNs - responseStartTimeNs;
|
||||
final long nodeTimeMs = TimeUnit.NANOSECONDS.toMillis(nodeTimeNs);
|
||||
log.debug(
|
||||
"Completed queryId[%s] request to url[%s] with %,d bytes returned in %,d millis [%,f b/s].",
|
||||
query.getId(),
|
||||
url,
|
||||
byteCount.get(),
|
||||
TimeUnit.NANOSECONDS.toMillis(nodeTimeNs),
|
||||
byteCount.get() / TimeUnit.NANOSECONDS.toSeconds(nodeTimeNs)
|
||||
nodeTimeMs,
|
||||
byteCount.get() / (0.001 * nodeTimeMs) // Floating math; division by zero will yield Inf, not exception
|
||||
);
|
||||
queryMetrics.reportNodeTime(nodeTimeNs);
|
||||
queryMetrics.reportNodeBytes(byteCount.get());
|
||||
|
|
Loading…
Reference in New Issue