Skip to content

Commit

Permalink
improve MetricNode: fix metric missing in Union children (#832)
Browse files Browse the repository at this point in the history
Co-authored-by: zhangli20 <zhangli20@kuaishou.com>
  • Loading branch information
richox and zhangli20 authored Feb 18, 2025
1 parent 3e14226 commit 6cf2894
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ case class MetricNode(
metricValueHandler: Option[(String, Long) => Unit] = None)
extends Logging {

def getChild(i: Int): MetricNode =
children(i)
def getChild(i: Int): MetricNode = {
if (i < children.length) {
children(i)
} else {
null
}
}

def add(metricName: String, v: Long): Unit = {
metricValueHandler.foreach(_.apply(metricName, v))
Expand Down

0 comments on commit 6cf2894

Please sign in to comment.