[ 
https://issues.apache.org/jira/browse/KAFKA-4286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15562886#comment-15562886
 ] 

Jun Rao commented on KAFKA-4286:
--------------------------------

There are a few ways that we could fix this. One way is to obtain the 
KafkaMetric for "io-wait-ratio" once and cache it since this metric is only 
created once. This is also probably more efficient since we don't have to 
recompute the same metric name each time.

> metric reporter may hit NullPointerException during shutdown
> ------------------------------------------------------------
>
>                 Key: KAFKA-4286
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4286
>             Project: Kafka
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.10.0.0
>            Reporter: Jun Rao
>
> When we shut down a broker, our metric reporter could throw the following 
> exception.
> java.lang.NullPointerException
>       at kafka.network.Processor$$anon$2.value(SocketServer.scala:392)
>       at kafka.network.Processor$$anon$2.value(SocketServer.scala:390)
> This is because we report Yammer metric like the following and we de-register 
> the underlying Kafka metric when shutting down the socket server.
>   newGauge("IdlePercent",
>     new Gauge[Double] {
>       def value = {
>         metrics.metrics().get(metrics.metricName("io-wait-ratio", 
> "socket-server-metrics", metricTags)).value()
>       }
>     },
>     metricTags.asScala
>   )



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to