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

Steve Loughran commented on HADOOP-12360:
-----------------------------------------

Patch looks pretty good —Final things needed:

h3. better error reporting/diagnostics on the socket exceptions than the JRE 
gives you; this is done in {{NetUtils.wrapException()}}

Could you wrap the code which creates the DatagramSocket or writes to it with 
something like:
{code}
 try {
  // network operation
 } catch(IOException ioe) {
  throw NetUtils.wrapException(destHost, destPort, localHost, 0, ioe)
}

It's not quite so important/useful for datagrams, but it will still report 
better outcomes binding to the local host, looking up the hostname of the 
destination, etc, etc.

h2. {{writeMetric}} loses the exception raised on a write failure.

It logs it at error, then it attempts a statsd.close(), which will raise an 
error if it fails, but the original exception gets lost.

Better:
# catch IOException only.
# assuming the inner StatsD class has done the exception wrapping, no more 
needs to be done except convert to a MetricsException through something like 
{{throw new MetricsException(ioe.toString(), ioe)}}

h3. Use "." instead of "_" in keys. 

This is just because its the convention in the hadoop config options; makes it 
more consistent with the others.

h3. in the {{StatsD.close()}} operation, have {{socket=null}} in a finally 
clause. That way even if the inner {{socket.close()}} failed, the socket 
reference would be released & the code not reused.

> Create StatsD metrics2 sink
> ---------------------------
>
>                 Key: HADOOP-12360
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12360
>             Project: Hadoop Common
>          Issue Type: New Feature
>          Components: metrics
>    Affects Versions: 2.7.1
>            Reporter: Dave Marion
>            Assignee: Dave Marion
>            Priority: Minor
>         Attachments: HADOOP-12360.001.patch, HADOOP-12360.002.patch, 
> HADOOP-12360.003.patch, HADOOP-12360.004.patch, HADOOP-12360.005.patch, 
> HADOOP-12360.006.patch
>
>
> Create a metrics sink that pushes to a StatsD daemon.



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

Reply via email to