当前位置: 首页>>代码示例>>Java>>正文


Java DefaultMetricsSystem类代码示例

本文整理汇总了Java中org.apache.hadoop.metrics2.lib.DefaultMetricsSystem的典型用法代码示例。如果您正苦于以下问题:Java DefaultMetricsSystem类的具体用法?Java DefaultMetricsSystem怎么用?Java DefaultMetricsSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultMetricsSystem类属于org.apache.hadoop.metrics2.lib包,在下文中一共展示了DefaultMetricsSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: register

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
@Override public synchronized <T>
T register(String name, String desc, T source) {
  MetricsSourceBuilder sb = MetricsAnnotations.newSourceBuilder(source);
  final MetricsSource s = sb.build();
  MetricsInfo si = sb.info();
  String name2 = name == null ? si.name() : name;
  final String finalDesc = desc == null ? si.description() : desc;
  final String finalName = // be friendly to non-metrics tests
      DefaultMetricsSystem.sourceName(name2, !monitoring);
  allSources.put(finalName, s);
  LOG.debug(finalName +", "+ finalDesc);
  if (monitoring) {
    registerSource(finalName, finalDesc, s);
  }
  // We want to re-register the source to pick up new config when the
  // metrics system restarts.
  register(finalName, new AbstractCallback() {
    @Override public void postStart() {
      registerSource(finalName, finalDesc, s);
    }
  });
  return source;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:24,代码来源:MetricsSystemImpl.java

示例2: testStartStopStart

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
@Test public void testStartStopStart() {
  DefaultMetricsSystem.shutdown(); // Clear pre-existing source names.
  MetricsSystemImpl ms = new MetricsSystemImpl("test");
  TestSource ts = new TestSource("ts");
  ms.start();
  ms.register("ts", "", ts);
  MetricsSourceAdapter sa = ms.getSourceAdapter("ts");
  assertNotNull(sa);
  assertNotNull(sa.getMBeanName());
  ms.stop();
  ms.shutdown();
  ms.start();
  sa = ms.getSourceAdapter("ts");
  assertNotNull(sa);
  assertNotNull(sa.getMBeanName());
  ms.stop();
  ms.shutdown();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:19,代码来源:TestMetricsSystemImpl.java

示例3: serviceStop

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
@Override
protected void serviceStop() throws Exception {

  DefaultMetricsSystem.shutdown();

  if (rmContext != null) {
    RMStateStore store = rmContext.getStateStore();
    try {
      store.close();
    } catch (Exception e) {
      LOG.error("Error closing store.", e);
    }
  }

  super.serviceStop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:ResourceManager.java

示例4: forQueue

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
public synchronized 
static FSQueueMetrics forQueue(String queueName, Queue parent,
    boolean enableUserMetrics, Configuration conf) {
  MetricsSystem ms = DefaultMetricsSystem.instance();
  QueueMetrics metrics = queueMetrics.get(queueName);
  if (metrics == null) {
    metrics = new FSQueueMetrics(ms, queueName, parent, enableUserMetrics, conf)
        .tag(QUEUE_INFO, queueName);
    
    // Register with the MetricsSystems
    if (ms != null) {
      metrics = ms.register(
              sourceName(queueName).toString(), 
              "Metrics for queue: " + queueName, metrics);
    }
    queueMetrics.put(queueName, metrics);
  }

  return (FSQueueMetrics)metrics;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:FSQueueMetrics.java

示例5: setUp

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  configuration = new Configuration();
  UserGroupInformation.setConfiguration(configuration);
  configuration.setBoolean(YarnConfiguration.RM_HA_ENABLED, true);
  configuration.set(YarnConfiguration.RM_HA_IDS, RM1_NODE_ID + ","
      + RM2_NODE_ID);
  for (String confKey : YarnConfiguration
      .getServiceAddressConfKeys(configuration)) {
    configuration.set(HAUtil.addSuffix(confKey, RM1_NODE_ID), RM1_ADDRESS);
    configuration.set(HAUtil.addSuffix(confKey, RM2_NODE_ID), RM2_ADDRESS);
    configuration.set(HAUtil.addSuffix(confKey, RM3_NODE_ID), RM3_ADDRESS);
  }

  // Enable webapp to test web-services also
  configuration.setBoolean(MockRM.ENABLE_WEBAPP, true);
  configuration.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  ClusterMetrics.destroy();
  QueueMetrics.clearQueueMetrics();
  DefaultMetricsSystem.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestRMHA.java

示例6: tearDown

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
@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();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestResourceTrackerService.java

示例7: serviceInit

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
@Override
protected void serviceInit(Configuration conf) throws Exception {
  // init timeline services first
  timelineStore = createTimelineStore(conf);
  addIfService(timelineStore);
  secretManagerService = createTimelineDelegationTokenSecretManagerService(conf);
  addService(secretManagerService);
  timelineDataManager = createTimelineDataManager(conf);
  addService(timelineDataManager);

  // init generic history service afterwards
  aclsManager = createApplicationACLsManager(conf);
  historyManager = createApplicationHistoryManager(conf);
  ahsClientService = createApplicationHistoryClientService(historyManager);
  addService(ahsClientService);
  addService((Service) historyManager);

  DefaultMetricsSystem.initialize("ApplicationHistoryServer");
  JvmMetrics.initSingleton("ApplicationHistoryServer", null);
  super.serviceInit(conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ApplicationHistoryServer.java

示例8: start

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:JournalNode.java

示例9: run

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
@Override
public void run() {
  if (LOG.isTraceEnabled()) {
    LOG.trace("Clearing JMX mbean cache.");
  }

  // This is pretty extreme but it's the best way that
  // I could find to get metrics to be removed.
  try {
    if (DefaultMetricsSystem.instance() != null) {
      DefaultMetricsSystem.instance().stop();
      // Sleep some time so that the rest of the hadoop metrics
      // system knows that things are done
      Thread.sleep(500);
      DefaultMetricsSystem.instance().start();
    }
  }  catch (Exception exception)  {
    LOG.debug("error clearing the jmx it appears the metrics system hasn't been started",
        exception);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:22,代码来源:JmxCacheBuster.java

示例10: BaseSourceImpl

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
public BaseSourceImpl(
    String metricsName,
    String metricsDescription,
    String metricsContext,
    String metricsJmxContext) {

  this.metricsName = metricsName;
  this.metricsDescription = metricsDescription;
  this.metricsContext = metricsContext;
  this.metricsJmxContext = metricsJmxContext;

  metricsRegistry = new DynamicMetricsRegistry(metricsName).setContext(metricsContext);
  DefaultMetricsSystemInitializer.INSTANCE.init(metricsName);

  //Register this instance.
  DefaultMetricsSystem.instance().register(metricsJmxContext, metricsDescription, this);
  init();

}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:BaseSourceImpl.java

示例11: forQueue

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
public synchronized static CSQueueMetrics forQueue(String queueName,
    Queue parent, boolean enableUserMetrics, Configuration conf) {
  MetricsSystem ms = DefaultMetricsSystem.instance();
  QueueMetrics metrics = queueMetrics.get(queueName);
  if (metrics == null) {
    metrics =
        new CSQueueMetrics(ms, queueName, parent, enableUserMetrics, conf)
            .tag(QUEUE_INFO, queueName);

    // Register with the MetricsSystems
    if (ms != null) {
      metrics =
          ms.register(sourceName(queueName).toString(), "Metrics for queue: "
              + queueName, metrics);
    }
    queueMetrics.put(queueName, metrics);
  }

  return (CSQueueMetrics) metrics;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:21,代码来源:CSQueueMetrics.java

示例12: serviceInit

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
@Override
protected void serviceInit(Configuration conf) throws Exception {
  // init timeline services first
  timelineStore = createTimelineStore(conf);
  addIfService(timelineStore);
  secretManagerService = createTimelineDelegationTokenSecretManagerService(conf);
  addService(secretManagerService);
  timelineDataManager = createTimelineDataManager(conf);
  addService(timelineDataManager);

  // init generic history service afterwards
  aclsManager = createApplicationACLsManager(conf);
  historyManager = createApplicationHistoryManager(conf);
  ahsClientService = createApplicationHistoryClientService(historyManager);
  addService(ahsClientService);
  addService((Service) historyManager);

  DefaultMetricsSystem.initialize("ApplicationHistoryServer");
  JvmMetrics jm = JvmMetrics.initSingleton("ApplicationHistoryServer", null);
  pauseMonitor = new JvmPauseMonitor();
  addService(pauseMonitor);
  jm.setPauseMonitor(pauseMonitor);
  super.serviceInit(conf);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:25,代码来源:ApplicationHistoryServer.java

示例13: unregister

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
static public void unregister(ObjectName mbeanName) {
  LOG.debug("Unregistering "+ mbeanName);
  final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
  if (mbeanName == null) {
    LOG.debug("Stacktrace: ", new Throwable());
    return;
  }
  try {
    mbs.unregisterMBean(mbeanName);
  } catch (Exception e) {
    LOG.warn("Error unregistering "+ mbeanName, e);
  }
  DefaultMetricsSystem.removeMBeanName(mbeanName);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:15,代码来源:MBeans.java

示例14: getMBeanName

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
static private ObjectName getMBeanName(String serviceName, String nameName) {
  String nameStr = DOMAIN_PREFIX + SERVICE_PREFIX + serviceName + "," +
      NAME_PREFIX + nameName;
  try {
    return DefaultMetricsSystem.newMBeanName(nameStr);
  } catch (Exception e) {
    LOG.warn("Error creating MBean object name: "+ nameStr, e);
    return null;
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:11,代码来源:MBeans.java

示例15: init

import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; //导入依赖的package包/类
/**
 * Initialized the metrics system with a prefix.
 * @param prefix  the system will look for configs with the prefix
 * @return the metrics system object itself
 */
@Override
public synchronized MetricsSystem init(String prefix) {
  if (monitoring && !DefaultMetricsSystem.inMiniClusterMode()) {
    LOG.warn(this.prefix +" metrics system already initialized!");
    return this;
  }
  this.prefix = checkNotNull(prefix, "prefix");
  ++refCount;
  if (monitoring) {
    // in mini cluster mode
    LOG.info(this.prefix +" metrics system started (again)");
    return this;
  }
  switch (initMode()) {
    case NORMAL:
      try { start(); }
      catch (MetricsConfigException e) {
        // Configuration errors (e.g., typos) should not be fatal.
        // We can always start the metrics system later via JMX.
        LOG.warn("Metrics system not started: "+ e.getMessage());
        LOG.debug("Stacktrace: ", e);
      }
      break;
    case STANDBY:
      LOG.info(prefix +" metrics system started in standby mode");
  }
  initSystemMBean();
  return this;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:35,代码来源:MetricsSystemImpl.java


注:本文中的org.apache.hadoop.metrics2.lib.DefaultMetricsSystem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。