Class ExampleMasterObserverWithMetrics
java.lang.Object
org.apache.hadoop.hbase.coprocessor.example.ExampleMasterObserverWithMetrics
- All Implemented Interfaces:
- Coprocessor,- MasterCoprocessor,- MasterObserver
@Private
public class ExampleMasterObserverWithMetrics
extends Object
implements MasterCoprocessor, MasterObserver
An example coprocessor that collects some metrics to demonstrate the usage of exporting custom
 metrics from the coprocessor.
 
These metrics will be available through the regular Hadoop metrics2 sinks (ganglia, opentsdb, etc) as well as JMX output. You can view a snapshot of the metrics by going to the http web UI of the master page, something like http://mymasterhost:16010/jmx
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.hadoop.hbase.CoprocessorCoprocessor.State
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate longprivate TimerThis is the Timer metric object to keep track of the current count across invocationsprivate CounterThis is a Counter object to keep track of disableTable operationsprivate static final org.slf4j.LoggerFields inherited from interface org.apache.hadoop.hbase.CoprocessorPRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprivate longReturns the max memory of the process.private longReturns the total memory of the process.voidpostCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableDescriptor desc, RegionInfo[] regions) Called after the createTable operation has been requested.voidpreCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableDescriptor desc, RegionInfo[] regions) Called before a new table is created byHMaster.voidpreDisableTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) Called prior to disabling a table.voidCalled by theCoprocessorEnvironmentduring it's own startup to initialize the coprocessor.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.CoprocessorgetServices, stopMethods inherited from interface org.apache.hadoop.hbase.coprocessor.MasterObserverpostAbortProcedure, postAddReplicationPeer, postAddRSGroup, postAssign, postBalance, postBalanceRSGroup, postBalanceSwitch, postClearDeadServers, postCloneSnapshot, postCompletedCreateTableAction, postCompletedDeleteTableAction, postCompletedDisableTableAction, postCompletedEnableTableAction, postCompletedMergeRegionsAction, postCompletedModifyTableAction, postCompletedSnapshotAction, postCompletedSplitRegionAction, postCompletedTruncateTableAction, postCreateNamespace, postDecommissionRegionServers, postDeleteNamespace, postDeleteSnapshot, postDeleteTable, postDisableReplicationPeer, postDisableTable, postEnableReplicationPeer, postEnableTable, postGetClusterMetrics, postGetConfiguredNamespacesAndTablesInRSGroup, postGetLocks, postGetNamespaceDescriptor, postGetProcedures, postGetReplicationPeerConfig, postGetRSGroupInfo, postGetRSGroupInfoOfServer, postGetRSGroupInfoOfTable, postGetTableDescriptors, postGetTableNames, postGetUserPermissions, postGrant, postHasUserPermissions, postIsRpcThrottleEnabled, postListDecommissionedRegionServers, postListNamespaceDescriptors, postListNamespaces, postListReplicationPeers, postListRSGroups, postListSnapshot, postListTablesInRSGroup, postLockHeartbeat, postMasterStoreFlush, postMergeRegions, postMergeRegionsCommitAction, postModifyColumnFamilyStoreFileTracker, postModifyNamespace, postModifyTable, postModifyTableStoreFileTracker, postMove, postMoveServers, postMoveServersAndTables, postMoveTables, postRecommissionRegionServer, postRegionOffline, postRemoveReplicationPeer, postRemoveRSGroup, postRemoveServers, postRenameRSGroup, postRequestLock, postRestoreSnapshot, postRevoke, postRollBackMergeRegionsAction, postRollBackSplitRegionAction, postSetNamespaceQuota, postSetRegionServerQuota, postSetSplitOrMergeEnabled, postSetTableQuota, postSetUserQuota, postSetUserQuota, postSetUserQuota, postSnapshot, postStartMaster, postSwitchExceedThrottleQuota, postSwitchRpcThrottle, postTableFlush, postTransitReplicationPeerSyncReplicationState, postTruncateRegion, postTruncateRegionAction, postTruncateTable, postUnassign, postUpdateMasterConfiguration, postUpdateReplicationPeerConfig, postUpdateRSGroupConfig, preAbortProcedure, preAddReplicationPeer, preAddRSGroup, preAssign, preBalance, preBalanceRSGroup, preBalanceSwitch, preClearDeadServers, preCloneSnapshot, preCreateNamespace, preCreateTableAction, preCreateTableRegionsInfos, preDecommissionRegionServers, preDeleteNamespace, preDeleteSnapshot, preDeleteTable, preDeleteTableAction, preDisableReplicationPeer, preDisableTableAction, preEnableReplicationPeer, preEnableTable, preEnableTableAction, preGetClusterMetrics, preGetConfiguredNamespacesAndTablesInRSGroup, preGetLocks, preGetNamespaceDescriptor, preGetProcedures, preGetReplicationPeerConfig, preGetRSGroupInfo, preGetRSGroupInfoOfServer, preGetRSGroupInfoOfTable, preGetTableDescriptors, preGetTableNames, preGetUserPermissions, preGrant, preHasUserPermissions, preIsRpcThrottleEnabled, preListDecommissionedRegionServers, preListNamespaceDescriptors, preListNamespaces, preListReplicationPeers, preListRSGroups, preListSnapshot, preListTablesInRSGroup, preLockHeartbeat, preMasterInitialization, preMasterStoreFlush, preMergeRegions, preMergeRegionsAction, preMergeRegionsCommitAction, preModifyColumnFamilyStoreFileTracker, preModifyNamespace, preModifyTable, preModifyTableAction, preModifyTableStoreFileTracker, preMove, preMoveServers, preMoveServersAndTables, preMoveTables, preRecommissionRegionServer, preRegionOffline, preRemoveReplicationPeer, preRemoveRSGroup, preRemoveServers, preRenameRSGroup, preRequestLock, preRestoreSnapshot, preRevoke, preSetNamespaceQuota, preSetRegionServerQuota, preSetSplitOrMergeEnabled, preSetTableQuota, preSetUserQuota, preSetUserQuota, preSetUserQuota, preShutdown, preSnapshot, preSplitRegion, preSplitRegionAction, preSplitRegionAfterMETAAction, preSplitRegionBeforeMETAAction, preStopMaster, preSwitchExceedThrottleQuota, preSwitchRpcThrottle, preTableFlush, preTransitReplicationPeerSyncReplicationState, preTruncateRegion, preTruncateRegionAction, preTruncateTable, preTruncateTableAction, preUnassign, preUpdateMasterConfiguration, preUpdateReplicationPeerConfig, preUpdateRSGroupConfig
- 
Field Details- 
LOG
- 
createTableTimerThis is the Timer metric object to keep track of the current count across invocations
- 
createTableStartTime
- 
disableTableCounterThis is a Counter object to keep track of disableTable operations
 
- 
- 
Constructor Details- 
ExampleMasterObserverWithMetricspublic ExampleMasterObserverWithMetrics()
 
- 
- 
Method Details- 
getMasterObserver- Specified by:
- getMasterObserverin interface- MasterCoprocessor
 
- 
getTotalMemoryReturns the total memory of the process. We will use this to define a gauge metric
- 
getMaxMemoryReturns the max memory of the process. We will use this to define a gauge metric
- 
preCreateTablepublic void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableDescriptor desc, RegionInfo[] regions) throws IOException Description copied from interface:MasterObserverCalled before a new table is created byHMaster. Called as part of create table RPC call.- Specified by:
- preCreateTablein interface- MasterObserver
- Parameters:
- ctx- the environment to interact with the framework and master
- desc- the TableDescriptor for the table
- regions- the initial regions created for the table
- Throws:
- IOException
 
- 
postCreateTablepublic void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableDescriptor desc, RegionInfo[] regions) throws IOException Description copied from interface:MasterObserverCalled after the createTable operation has been requested. Called as part of create table RPC call.- Specified by:
- postCreateTablein interface- MasterObserver
- Parameters:
- ctx- the environment to interact with the framework and master
- desc- the TableDescriptor for the table
- regions- the initial regions created for the table
- Throws:
- IOException
 
- 
preDisableTablepublic void preDisableTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException Description copied from interface:MasterObserverCalled prior to disabling a table. Called as part of disable table RPC call.- Specified by:
- preDisableTablein interface- MasterObserver
- Parameters:
- ctx- the environment to interact with the framework and master
- tableName- the name of the table
- Throws:
- IOException
 
- 
startDescription copied from interface:CoprocessorCalled by theCoprocessorEnvironmentduring it's own startup to initialize the coprocessor.- Specified by:
- startin interface- Coprocessor
- Throws:
- IOException
 
 
-