Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B29D3175A8 for ; Fri, 10 Oct 2014 21:56:35 +0000 (UTC) Received: (qmail 66800 invoked by uid 500); 10 Oct 2014 21:56:35 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 66746 invoked by uid 500); 10 Oct 2014 21:56:35 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 66726 invoked by uid 99); 10 Oct 2014 21:56:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Oct 2014 21:56:35 +0000 Date: Fri, 10 Oct 2014 21:56:34 +0000 (UTC) From: "Ravi Prakash (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HADOOP-11182) GraphiteSink emits wrong timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-11182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ravi Prakash 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 > > > 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. > 093 int 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)