| /* |
| * Druid - a distributed column store. |
| * Copyright (C) 2012 Metamarkets Group Inc. |
| * |
| * This program is free software; you can redistribute it and/or |
| * modify it under the terms of the GNU General Public License |
| * as published by the Free Software Foundation; either version 2 |
| * of the License, or (at your option) any later version. |
| * |
| * This program is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| * |
| * You should have received a copy of the GNU General Public License |
| * along with this program; if not, write to the Free Software |
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| */ |
| |
| package com.metamx.druid.realtime; |
| |
| import java.util.concurrent.atomic.AtomicLong; |
| |
| /** |
| */ |
| public class FireDepartmentMetrics |
| { |
| private final AtomicLong processedCount = new AtomicLong(0); |
| private final AtomicLong thrownAwayCount = new AtomicLong(0); |
| private final AtomicLong unparseableCount = new AtomicLong(0); |
| private final AtomicLong rowOutputCount = new AtomicLong(0); |
| |
| public void incrementProcessed() |
| { |
| processedCount.incrementAndGet(); |
| } |
| |
| public void incrementThrownAway() |
| { |
| thrownAwayCount.incrementAndGet(); |
| } |
| |
| public void incrementUnparseable() |
| { |
| unparseableCount.incrementAndGet(); |
| } |
| |
| public void incrementRowOutputCount(long numRows) |
| { |
| rowOutputCount.addAndGet(numRows); |
| } |
| |
| public long processed() |
| { |
| return processedCount.get(); |
| } |
| |
| public long thrownAway() |
| { |
| return thrownAwayCount.get(); |
| } |
| |
| public long unparseable() |
| { |
| return unparseableCount.get(); |
| } |
| |
| public long rowOutput() |
| { |
| return rowOutputCount.get(); |
| } |
| |
| public FireDepartmentMetrics snapshot() |
| { |
| final FireDepartmentMetrics retVal = new FireDepartmentMetrics(); |
| retVal.processedCount.set(processedCount.get()); |
| retVal.thrownAwayCount.set(thrownAwayCount.get()); |
| retVal.unparseableCount.set(unparseableCount.get()); |
| retVal.rowOutputCount.set(rowOutputCount.get()); |
| return retVal; |
| } |
| } |