Here are the examples of the java api org.apache.hadoop.metrics2.lib.DefaultMetricsSystem.instance() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
69 Examples
19
Source : TestResourceTrackerService.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
@After
public void tearDown() {
if (hostFile != null && hostFile.exists()) {
hostFile.delete();
}
ClusterMetrics.destroy();
if (rm != null) {
rm.stop();
}
MetricsSystem ms = DefaultMetricsSystem.instance();
if (ms.getSource("ClusterMetrics") != null) {
DefaultMetricsSystem.shutdown();
}
}
19
Source : QueueMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
public synchronized static QueueMetrics forQueue(String queueName, Queue parent, boolean enableUserMetrics, Configuration conf) {
return forQueue(DefaultMetricsSystem.instance(), queueName, parent, enableUserMetrics, conf);
}
19
Source : NodeManagerMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
public static NodeManagerMetrics create() {
return create(DefaultMetricsSystem.instance());
}
19
Source : MRAppMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
public static MRAppMetrics create() {
return create(DefaultMetricsSystem.instance());
}
19
Source : TestNameNodeMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
@After
public void tearDown() throws Exception {
MetricsSource source = DefaultMetricsSystem.instance().getSource("UgiMetrics");
if (source != null) {
// Run only once since the UGI metrics is cleaned up during teardown
MetricsRecordBuilder rb = getMetrics(source);
replacedertQuantileGauges("GetGroups1s", rb);
}
cluster.shutdown();
}
19
Source : JournalMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
public static JournalMetrics create(Journal j) {
JournalMetrics m = new JournalMetrics(j);
return DefaultMetricsSystem.instance().register(m.getName(), null, m);
}
19
Source : MetricsAsserts.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
public static MetricsRecordBuilder getMetrics(String name) {
return getMetrics(DefaultMetricsSystem.instance().getSource(name));
}
19
Source : ContainerMetrics.java
with Apache License 2.0
from naver
with Apache License 2.0
from naver
public static ContainerMetrics forContainer(ContainerId containerId, long flushPeriodMs) {
return forContainer(DefaultMetricsSystem.instance(), containerId, flushPeriodMs);
}
19
Source : QueryMetrics.java
with Apache License 2.0
from Kyligence
with Apache License 2.0
from Kyligence
public QueryMetrics registerWith(String name) {
return DefaultMetricsSystem.instance().register(name, "Query", this);
}
19
Source : ReplicationManager.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Stops Replication Monitor thread.
*/
public synchronized void stop() {
if (running) {
LOG.info("Stopping Replication Monitor Thread.");
inflightReplication.clear();
inflightDeletion.clear();
running = false;
DefaultMetricsSystem.instance().unregisterSource(METRICS_SOURCE_NAME);
notifyAll();
} else {
LOG.info("Replication Monitor Thread is not running.");
}
}
19
Source : ReplicationManager.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Starts Replication Monitor thread.
*/
public synchronized void start() {
if (!isRunning()) {
DefaultMetricsSystem.instance().register(METRICS_SOURCE_NAME, "SCM Replication manager (closed container replication) related " + "metrics", this);
LOG.info("Starting Replication Monitor Thread.");
running = true;
replicationMonitor = new Thread(this::run);
replicationMonitor.setName("ReplicationMonitor");
replicationMonitor.setDaemon(true);
replicationMonitor.start();
} else {
LOG.info("Replication Monitor Thread is already running.");
}
}
19
Source : RocksDBStoreMBean.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static RocksDBStoreMBean create(Statistics statistics, String contextName) {
RocksDBStoreMBean rocksDBStoreMBean = new RocksDBStoreMBean(statistics, contextName);
MetricsSystem ms = DefaultMetricsSystem.instance();
MetricsSource metricsSource = ms.getSource(rocksDBStoreMBean.contextName);
if (metricsSource != null) {
return (RocksDBStoreMBean) metricsSource;
} else {
return ms.register(rocksDBStoreMBean.contextName, "RocksDB Metrics", rocksDBStoreMBean);
}
}
19
Source : ProtocolMessageMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public void unregister() {
DefaultMetricsSystem.instance().unregisterSource(name);
}
19
Source : ProtocolMessageMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public void register() {
DefaultMetricsSystem.instance().register(name, description, this);
}
19
Source : BaseHttpServer.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public void start() throws IOException {
if (httpServer != null && isEnabled()) {
httpServer.start();
if (prometheusSupport) {
DefaultMetricsSystem.instance().register("prometheus", "Hadoop metrics prometheus exporter", prometheusMetricsSink);
}
updateConnectorAddress();
}
}
19
Source : MeasuredReplicator.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Override
public void close() throws Exception {
DefaultMetricsSystem.instance().unregisterSource(NAME);
}
18
Source : IPCLoggerChannelMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
static IPCLoggerChannelMetrics create(IPCLoggerChannel ch) {
String name = getName(ch);
synchronized (REGISTRY) {
IPCLoggerChannelMetrics m = REGISTRY.get(name);
if (m != null) {
m.setChannel(ch);
} else {
m = new IPCLoggerChannelMetrics(ch);
DefaultMetricsSystem.instance().register(name, null, m);
REGISTRY.put(name, m);
}
return m;
}
}
18
Source : RpcDetailedMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
public static RpcDetailedMetrics create(int port) {
RpcDetailedMetrics m = new RpcDetailedMetrics(port);
return DefaultMetricsSystem.instance().register(m.name, null, m);
}
18
Source : RetryCacheMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
public static RetryCacheMetrics create(RetryCache cache) {
RetryCacheMetrics m = new RetryCacheMetrics(cache);
return DefaultMetricsSystem.instance().register(m.name, null, m);
}
18
Source : SharedCacheUploaderMetrics.java
with Apache License 2.0
from naver
with Apache License 2.0
from naver
static SharedCacheUploaderMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
SharedCacheUploaderMetrics metrics = new SharedCacheUploaderMetrics();
ms.register("SharedCacheUploaderRequests", null, metrics);
return metrics;
}
18
Source : ClientSCMMetrics.java
with Apache License 2.0
from naver
with Apache License 2.0
from naver
static ClientSCMMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
ClientSCMMetrics metrics = new ClientSCMMetrics();
ms.register("clientRequests", null, metrics);
return metrics;
}
18
Source : OzoneManagerSyncMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static OzoneManagerSyncMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
return ms.register(SOURCE_NAME, "Recon Ozone Manager Sync Metrics", new OzoneManagerSyncMetrics());
}
18
Source : OzoneManagerDoubleBufferMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static synchronized OzoneManagerDoubleBufferMetrics create() {
if (instance != null) {
return instance;
} else {
MetricsSystem ms = DefaultMetricsSystem.instance();
OzoneManagerDoubleBufferMetrics omDoubleBufferMetrics = ms.register(SOURCE_NAME, "OzoneManager DoubleBuffer Metrics", new OzoneManagerDoubleBufferMetrics());
instance = omDoubleBufferMetrics;
return omDoubleBufferMetrics;
}
}
18
Source : OMMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static OMMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
return ms.register(SOURCE_NAME, "Ozone Manager Metrics", new OMMetrics());
}
18
Source : SCMContainerMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static SCMContainerMetrics create(SCMMXBean scmmxBean) {
MetricsSystem ms = DefaultMetricsSystem.instance();
return ms.register(SOURCE, "Storage " + "Container Manager Metrics", new SCMContainerMetrics(scmmxBean));
}
18
Source : SCMContainerMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public void unRegister() {
MetricsSystem ms = DefaultMetricsSystem.instance();
ms.unregisterSource(SOURCE);
}
18
Source : SafeModeMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static SafeModeMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
return ms.register(SOURCE_NAME, "SCM Safemode Metrics", new SafeModeMetrics());
}
18
Source : SCMPipelineMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Unregister the metrics instance.
*/
public static void unRegister() {
instance = null;
MetricsSystem ms = DefaultMetricsSystem.instance();
ms.unregisterSource(SOURCE_NAME);
}
18
Source : SCMPipelineMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Create and returns SCMPipelineMetrics instance.
*
* @return SCMPipelineMetrics
*/
public static synchronized SCMPipelineMetrics create() {
if (instance != null) {
return instance;
}
MetricsSystem ms = DefaultMetricsSystem.instance();
instance = ms.register(SOURCE_NAME, "SCM PipelineManager Metrics", new SCMPipelineMetrics());
return instance;
}
18
Source : SCMNodeMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Unregister the metrics instance.
*/
public void unRegister() {
MetricsSystem ms = DefaultMetricsSystem.instance();
ms.unregisterSource(SOURCE_NAME);
}
18
Source : SCMNodeMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Create and returns SCMNodeMetrics instance.
*
* @return SCMNodeMetrics
*/
public static SCMNodeMetrics create(NodeManagerMXBean managerMXBean) {
MetricsSystem ms = DefaultMetricsSystem.instance();
return ms.register(SOURCE_NAME, "SCM NodeManager Metrics", new SCMNodeMetrics(managerMXBean));
}
18
Source : SCMMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static SCMMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
return ms.register(SOURCE_NAME, "Storage Container Manager Metrics", new SCMMetrics());
}
18
Source : SCMContainerPlacementMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static SCMContainerPlacementMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
registry = new MetricsRegistry(RECORD_INFO);
return ms.register(SOURCE_NAME, "SCM Container Placement Metrics", new SCMContainerPlacementMetrics());
}
18
Source : SCMContainerManagerMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Create and return metrics instance.
* @return SCMContainerManagerMetrics
*/
public static SCMContainerManagerMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
return ms.register(SOURCE_NAME, "SCM ContainerManager Metrics", new SCMContainerManagerMetrics());
}
18
Source : TestEventWatcher.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void startLeaseManager() {
DefaultMetricsSystem.instance();
leaseManager = new LeaseManager<>("Test", 2000L);
leaseManager.start();
}
18
Source : DBCheckpointMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static DBCheckpointMetrics create(String parent) {
MetricsSystem ms = DefaultMetricsSystem.instance();
return ms.register(SOURCE_NAME, parent, new DBCheckpointMetrics());
}
18
Source : RDBMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static synchronized RDBMetrics create() {
if (instance != null) {
return instance;
}
MetricsSystem ms = DefaultMetricsSystem.instance();
instance = ms.register(SOURCE_NAME, "Rocks DB Metrics", new RDBMetrics());
return instance;
}
18
Source : EventWatcher.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public void start(EventQueue queue) {
queue.addHandler(startEvent, this::handleStartEvent);
queue.addHandler(completionEvent, (completionPayload, publisher) -> {
try {
handleCompletion(completionPayload, publisher);
} catch (LeaseNotFoundException e) {
// It's already done. Too late, we already retried it.
// Not a real problem.
LOG.warn("Completion event without active lease. Id={}", completionPayload.getId());
}
});
MetricsSystem ms = DefaultMetricsSystem.instance();
ms.register(name, "Evenreplacedcher metrics", metrics);
}
18
Source : TestContainerScrubberMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void testContainerMetaDataScrubberMetricsUnregisters() {
ContainerMetadataScanner subject = new ContainerMetadataScanner(conf, controller);
String name = subject.getMetrics().getName();
replacedertNotNull(DefaultMetricsSystem.instance().getSource(name));
subject.shutdown();
subject.run();
replacedertNull(DefaultMetricsSystem.instance().getSource(name));
}
18
Source : TestContainerScrubberMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void testContainerDataScrubberMetricsUnregisters() throws IOException {
HddsVolume volume = new HddsVolume.Builder("/").failedVolume(true).build();
ContainerDataScanner subject = new ContainerDataScanner(conf, controller, volume);
String name = subject.getMetrics().getName();
replacedertNotNull(DefaultMetricsSystem.instance().getSource(name));
subject.shutdown();
subject.run();
replacedertNull(DefaultMetricsSystem.instance().getSource(name));
}
18
Source : ContainerMetadataScrubberMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static ContainerMetadataScrubberMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
String name = "ContainerMetadataScrubberMetrics";
return ms.register(name, null, new ContainerMetadataScrubberMetrics(name, ms));
}
18
Source : ContainerDataScrubberMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static ContainerDataScrubberMetrics create(final String volumeName) {
MetricsSystem ms = DefaultMetricsSystem.instance();
String name = "ContainerDataScrubberMetrics-" + (volumeName.isEmpty() ? "UndefinedDataNodeVolume" + ThreadLocalRandom.current().nextInt() : volumeName.replace(':', '-'));
return ms.register(name, null, new ContainerDataScrubberMetrics(name, ms));
}
18
Source : VolumeIOStats.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public void init() {
MetricsSystem ms = DefaultMetricsSystem.instance();
ms.register(metricsSourceName, "Volume I/O Statistics", this);
}
18
Source : ContainerCacheMetrics.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static ContainerCacheMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
String name = "ContainerCacheMetrics";
return ms.register(name, "null", new ContainerCacheMetrics(name, ms));
}
17
Source : ClusterMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
private static void registerMetrics() {
registry = new MetricsRegistry(RECORD_INFO);
registry.tag(RECORD_INFO, "ResourceManager");
MetricsSystem ms = DefaultMetricsSystem.instance();
if (ms != null) {
ms.register("ClusterMetrics", "Metrics for the Yarn Cluster", INSTANCE);
}
}
17
Source : DataNodeMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
public static DataNodeMetrics create(Configuration conf, String dnName) {
String sessionId = conf.get(DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY);
MetricsSystem ms = DefaultMetricsSystem.instance();
JvmMetrics jm = JvmMetrics.create("DataNode", sessionId, ms);
String name = "DataNodeActivity-" + (dnName.isEmpty() ? "UndefinedDataNodeName" + DFSUtil.getRandom().nextInt() : dnName.replace(':', '-'));
// Percentile measurement is off by default, by watching no intervals
int[] intervals = conf.getInts(DFSConfigKeys.DFS_METRICS_PERCENTILES_INTERVALS_KEY);
return ms.register(name, null, new DataNodeMetrics(name, sessionId, intervals, jm));
}
17
Source : JournalNode.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
/**
* Start listening for edits via RPC.
*/
public void start() throws IOException {
Preconditions.checkState(!isStarted(), "JN already running");
validateAndCreateJournalDir(localDir);
DefaultMetricsSystem.initialize("JournalNode");
JvmMetrics.create("JournalNode", conf.get(DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY), DefaultMetricsSystem.instance());
InetSocketAddress socAddr = JournalNodeRpcServer.getAddress(conf);
SecurityUtil.login(conf, DFSConfigKeys.DFS_JOURNALNODE_KEYTAB_FILE_KEY, DFSConfigKeys.DFS_JOURNALNODE_KERBEROS_PRINCIPAL_KEY, socAddr.getHostName());
registerJNMXBean();
httpServer = new JournalNodeHttpServer(conf, this);
httpServer.start();
httpServerURI = httpServer.getServerURI().toString();
rpcServer = new JournalNodeRpcServer(conf, this);
rpcServer.start();
}
17
Source : RpcMetrics.java
with Apache License 2.0
from NJUJYB
with Apache License 2.0
from NJUJYB
public static RpcMetrics create(Server server, Configuration conf) {
RpcMetrics m = new RpcMetrics(server, conf);
return DefaultMetricsSystem.instance().register(m.name, null, m);
}
17
Source : CleanerMetrics.java
with Apache License 2.0
from naver
with Apache License 2.0
from naver
static CleanerMetrics create() {
MetricsSystem ms = DefaultMetricsSystem.instance();
CleanerMetrics metricObject = new CleanerMetrics();
MetricsSourceBuilder sb = MetricsAnnotations.newSourceBuilder(metricObject);
final MetricsSource s = sb.build();
ms.register("cleaner", "The cleaner service of truly shared cache", s);
metricObject.metricSource = s;
return metricObject;
}
17
Source : TestClusterMetrics.java
with Apache License 2.0
from naver
with Apache License 2.0
from naver
@After
public void tearDown() {
ClusterMetrics.destroy();
MetricsSystem ms = DefaultMetricsSystem.instance();
if (ms.getSource("ClusterMetrics") != null) {
DefaultMetricsSystem.shutdown();
}
}
See More Examples