[jira] [Commented] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-16 Thread Sascha Coenen (JIRA)

[ 
https://issues.apache.org/jira/browse/HADOOP-11182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14173538#comment-14173538
 ] 

Sascha Coenen commented on HADOOP-11182:


Awesome! Thanks so much Ravi for your continued support. I will definitely try 
to spend time on getting the setup right and commit more often in the future. 
Thank you so so much. ;)

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.0, 2.5.1
Reporter: Sascha Coenen
 Fix For: 2.6.0

 Attachments: HADOOP-11182-GraphiteSink-v1.patch, 
 HADOOP-11182-v2.patch, HADOOP-11182-v3.patch, 
 newPatchFindbugsWarningshadoop-common.html


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Commented] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-15 Thread Sascha Coenen (JIRA)

[ 
https://issues.apache.org/jira/browse/HADOOP-11182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14172137#comment-14172137
 ] 

Sascha Coenen commented on HADOOP-11182:


Hi Ravi, Thanks for your help. I will try to make progress.
I can't find an existing TestGraphiteSink file in the trunk 
here 
http://svn.apache.org/repos/asf/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/
or here 
https://github.com/apache/hadoop/tree/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink
Can you advise?
Thanks


 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.0, 2.5.1
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch, HADOOP-11182-v2.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Updated] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-15 Thread Sascha Coenen (JIRA)

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

Sascha Coenen updated HADOOP-11182:
---
Status: Open  (was: Patch Available)

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.1, 2.5.0
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch, HADOOP-11182-v2.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Updated] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-15 Thread Sascha Coenen (JIRA)

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

Sascha Coenen updated HADOOP-11182:
---
Status: Patch Available  (was: Open)

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.1, 2.5.0
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch, 
 HADOOP-11182-v2.patch, HADOOP-11182-v3.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Updated] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-15 Thread Sascha Coenen (JIRA)

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

Sascha Coenen updated HADOOP-11182:
---
Attachment: HADOOP-11182-v3.patch

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.0, 2.5.1
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch, 
 HADOOP-11182-v2.patch, HADOOP-11182-v3.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Commented] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-15 Thread Sascha Coenen (JIRA)

[ 
https://issues.apache.org/jira/browse/HADOOP-11182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14172668#comment-14172668
 ] 

Sascha Coenen commented on HADOOP-11182:


Ah. I found the right Unit test class now and moved the new test into that one. 
Resubmitting the patch and keeping my fingers crossed. 
BTW:
I'm still unable to make use of any local patch testing. The run test-patch 
takes like forever and outputs many tests failures but nothing that would 
resemble the QA report. The Jenkins console output doesn't contain any findbug 
warnings. It just says in there that the findbug report got stored as a local 
file on Jenkins which I cannot access.

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.0, 2.5.1
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch, 
 HADOOP-11182-v2.patch, HADOOP-11182-v3.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Updated] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-13 Thread Sascha Coenen (JIRA)

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

Sascha Coenen updated HADOOP-11182:
---
Status: Open  (was: Patch Available)

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.1, 2.5.0
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Updated] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-13 Thread Sascha Coenen (JIRA)

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

Sascha Coenen updated HADOOP-11182:
---
Attachment: HADOOP-11182-v2.patch

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.0, 2.5.1
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch, HADOOP-11182-v2.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Updated] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-13 Thread Sascha Coenen (JIRA)

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

Sascha Coenen updated HADOOP-11182:
---
Status: Patch Available  (was: Open)

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.1, 2.5.0
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch, HADOOP-11182-v2.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Commented] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-13 Thread Sascha Coenen (JIRA)

[ 
https://issues.apache.org/jira/browse/HADOOP-11182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14169378#comment-14169378
 ] 

Sascha Coenen commented on HADOOP-11182:


Thanks Ravi for pointing me to the repository to use.

I resubmitted another path against the trunk of the git repo this time.
Also added a new unit test class as the GraphiteSink class didn't have a unit 
test class yet.
Added one test which fails if the fix is not applied but succeeds under the fix.

I was not able to go through with all HowToContribute suggestions though. 
Some strange things happened on my system like timeouts during test executions.
However, these failures seem to be unrelated to my patch. I also get a The 
patch does not appear to apply with p0 to p2 from the dev-support script. No 
idea what this is supposed to mean, nor do I find anything on googling for that 
message.

I hope that this patch will do. I've spent about a day on it. If the patch 
still does not go through, it would be nice if someone more familiar with the 
workflow could make the modification on my behalf as it is just a single line 
of code that needs to be replaced in the code.

Thanks

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.0, 2.5.1
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch, HADOOP-11182-v2.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Commented] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-13 Thread Sascha Coenen (JIRA)

[ 
https://issues.apache.org/jira/browse/HADOOP-11182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14169525#comment-14169525
 ] 

Sascha Coenen commented on HADOOP-11182:


the links contained in the above QA output all lead to HTTP 404 errors while a 
local execution of the dev-support script gives me a The patch does not 
appear to apply with p0 to p2 error and then aborts. 

I guess that means I'm stuck. ;)

I also have no idea what a release audit warning is.

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.0, 2.5.1
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch, HADOOP-11182-v2.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Updated] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-10 Thread Sascha Coenen (JIRA)

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

Sascha Coenen updated HADOOP-11182:
---
Attachment: HADOOP-11182-GraphiteSink-v1.patch

 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.0, 2.5.1
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Commented] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-10 Thread Sascha Coenen (JIRA)

[ 
https://issues.apache.org/jira/browse/HADOOP-11182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14166704#comment-14166704
 ] 

Sascha Coenen commented on HADOOP-11182:


Thanks Ravi. I have attached a patch but it's been the first time for me. I'm 
insecure as to whether I have done the right thing.
I created the patch relative to the trunk of the following SVN repository  
(http://svn.apache.org/repos/asf/hadoop/common/trunk), which was linked to from 
the official hadoop website. However, the most recent commits in there seem to 
be 6 weeks old.


 GraphiteSink emits wrong timestamps
 ---

 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.0, 2.5.1
Reporter: Sascha Coenen
 Attachments: HADOOP-11182-GraphiteSink-v1.patch


 the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
 configured time period, but the timestamps written only change every 128 
 seconds, even it the configured time period in the configuration file is much 
 shorter.
 This is due to a bug in line 93:
 {code:java}
 092// Round the timestamp to second as Graphite accepts it in 
 such format.
 093int timestamp = Math.round(record.timestamp() / 1000.0f);
 {code}
 The timestamp property is a long and is divided by a float which yields a 
 result that is not precise enough and yields same valued results for 
 timestamps that lie up to 128 seconds apart. Also, the result is then written 
 into an int variable.
 One solution would be to divide by 1000.0d, but the best fix would be to not 
 even convert to a decimal format in the first place. Instead one could 
 replace the line with the following:
 {code:java}
long timestamp = record.timestamp() / 1000L;
 {code}



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


[jira] [Created] (HADOOP-11182) GraphiteSink emits wrong timestamps

2014-10-09 Thread Sascha Coenen (JIRA)
Sascha Coenen created HADOOP-11182:
--

 Summary: GraphiteSink emits wrong timestamps
 Key: HADOOP-11182
 URL: https://issues.apache.org/jira/browse/HADOOP-11182
 Project: Hadoop Common
  Issue Type: Bug
Affects Versions: 2.5.1, 2.5.0
Reporter: Sascha Coenen


the org.apache.hadoop.metrics2.sink.GraphiteSink class emits metrics at the 
configured time period, but the timestamps written only change every 128 
seconds, even it the configured time period in the configuration file is much 
shorter.

This is due to a bug in line 93:

{code:java}
092// Round the timestamp to second as Graphite accepts it in such 
format.
093int timestamp = Math.round(record.timestamp() / 1000.0f);
{code}

The timestamp property is a long and is divided by a float which yields a 
result that is not precise enough and yields same valued results for timestamps 
that lie up to 128 seconds apart. Also, the result is then written into an int 
variable.

One solution would be to divide by 1000.0d, but the best fix would be to not 
even convert to a decimal format in the first place. Instead one could replace 
the line with the following:

{code:java}
   long timestamp = record.timestamp() / 1000L;
{code}



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