begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1
begin_comment
comment|/*  * Licensed under the Apache License, Version 2.0 (the "License");  * you may not use this file except in compliance with the License.  * You may obtain a copy of the License at  *  *     http://www.apache.org/licenses/LICENSE-2.0  *  * Unless required by applicable law or agreed to in writing, software  * distributed under the License is distributed on an "AS IS" BASIS,  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  * See the License for the specific language governing permissions and  * limitations under the License.  */
end_comment

begin_package
package|package
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|hive
operator|.
name|llap
operator|.
name|daemon
operator|.
name|impl
package|;
end_package

begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|metrics2
operator|.
name|AbstractMetric
import|;
end_import

begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|metrics2
operator|.
name|MetricsCollector
import|;
end_import

begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|metrics2
operator|.
name|MetricsInfo
import|;
end_import

begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|metrics2
operator|.
name|MetricsRecordBuilder
import|;
end_import

begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|metrics2
operator|.
name|MetricsTag
import|;
end_import

begin_import
import|import
name|java
operator|.
name|util
operator|.
name|Map
import|;
end_import

begin_class
specifier|public
specifier|final
class|class
name|DumpingMetricsCollector
implements|implements
name|MetricsCollector
block|{
specifier|private
name|MetricsRecordBuilder
name|mrb
decl_stmt|;
specifier|public
name|DumpingMetricsCollector
parameter_list|(
name|Map
argument_list|<
name|String
argument_list|,
name|Long
argument_list|>
name|data
parameter_list|)
block|{
name|mrb
operator|=
operator|new
name|DumpingMetricsRecordBuilder
argument_list|(
name|data
argument_list|)
expr_stmt|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|addRecord
parameter_list|(
name|String
name|s
parameter_list|)
block|{
return|return
name|mrb
return|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|addRecord
parameter_list|(
name|MetricsInfo
name|metricsInfo
parameter_list|)
block|{
return|return
name|mrb
return|;
block|}
specifier|private
specifier|final
class|class
name|DumpingMetricsRecordBuilder
extends|extends
name|MetricsRecordBuilder
block|{
specifier|private
name|Map
argument_list|<
name|String
argument_list|,
name|Long
argument_list|>
name|data
decl_stmt|;
specifier|private
name|DumpingMetricsRecordBuilder
parameter_list|(
name|Map
argument_list|<
name|String
argument_list|,
name|Long
argument_list|>
name|data
parameter_list|)
block|{
name|this
operator|.
name|data
operator|=
name|data
expr_stmt|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsCollector
name|parent
parameter_list|()
block|{
throw|throw
operator|new
name|UnsupportedOperationException
argument_list|()
throw|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|tag
parameter_list|(
name|MetricsInfo
name|metricsInfo
parameter_list|,
name|String
name|s
parameter_list|)
block|{
return|return
name|this
return|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|add
parameter_list|(
name|MetricsTag
name|metricsTag
parameter_list|)
block|{
return|return
name|this
return|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|add
parameter_list|(
name|AbstractMetric
name|abstractMetric
parameter_list|)
block|{
throw|throw
operator|new
name|UnsupportedOperationException
argument_list|()
throw|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|setContext
parameter_list|(
name|String
name|s
parameter_list|)
block|{
return|return
name|this
return|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|addCounter
parameter_list|(
name|MetricsInfo
name|metricsInfo
parameter_list|,
name|int
name|i
parameter_list|)
block|{
name|data
operator|.
name|put
argument_list|(
name|metricsInfo
operator|.
name|name
argument_list|()
argument_list|,
name|Long
operator|.
name|valueOf
argument_list|(
name|i
argument_list|)
argument_list|)
expr_stmt|;
return|return
name|this
return|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|addCounter
parameter_list|(
name|MetricsInfo
name|metricsInfo
parameter_list|,
name|long
name|l
parameter_list|)
block|{
name|data
operator|.
name|put
argument_list|(
name|metricsInfo
operator|.
name|name
argument_list|()
argument_list|,
name|l
argument_list|)
expr_stmt|;
return|return
name|this
return|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|addGauge
parameter_list|(
name|MetricsInfo
name|metricsInfo
parameter_list|,
name|int
name|i
parameter_list|)
block|{
name|data
operator|.
name|put
argument_list|(
name|metricsInfo
operator|.
name|name
argument_list|()
argument_list|,
name|Long
operator|.
name|valueOf
argument_list|(
name|i
argument_list|)
argument_list|)
expr_stmt|;
return|return
name|this
return|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|addGauge
parameter_list|(
name|MetricsInfo
name|metricsInfo
parameter_list|,
name|long
name|l
parameter_list|)
block|{
name|data
operator|.
name|put
argument_list|(
name|metricsInfo
operator|.
name|name
argument_list|()
argument_list|,
name|l
argument_list|)
expr_stmt|;
return|return
name|this
return|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|addGauge
parameter_list|(
name|MetricsInfo
name|metricsInfo
parameter_list|,
name|float
name|v
parameter_list|)
block|{
name|data
operator|.
name|put
argument_list|(
name|metricsInfo
operator|.
name|name
argument_list|()
argument_list|,
name|Long
operator|.
name|valueOf
argument_list|(
name|Math
operator|.
name|round
argument_list|(
name|v
argument_list|)
argument_list|)
argument_list|)
expr_stmt|;
return|return
name|this
return|;
block|}
annotation|@
name|Override
specifier|public
name|MetricsRecordBuilder
name|addGauge
parameter_list|(
name|MetricsInfo
name|metricsInfo
parameter_list|,
name|double
name|v
parameter_list|)
block|{
name|data
operator|.
name|put
argument_list|(
name|metricsInfo
operator|.
name|name
argument_list|()
argument_list|,
name|Math
operator|.
name|round
argument_list|(
name|v
argument_list|)
argument_list|)
expr_stmt|;
return|return
name|this
return|;
block|}
block|}
block|}
end_class

end_unit

