Java Code Examples for org.apache.hadoop.metrics2.lib.DefaultMetricsSystem#instance()

The following examples show how to use org.apache.hadoop.metrics2.lib.DefaultMetricsSystem#instance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestResourceTrackerService.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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();
  }
}
 
Example 2
Source File: SharedCacheUploaderMetrics.java    From big-c with Apache License 2.0 5 votes vote down vote up
static SharedCacheUploaderMetrics create() {
  MetricsSystem ms = DefaultMetricsSystem.instance();

  SharedCacheUploaderMetrics metrics =
      new SharedCacheUploaderMetrics();
  ms.register("SharedCacheUploaderRequests", null, metrics);
  return metrics;
}
 
Example 3
Source File: ContainerMetrics.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
public static ContainerMetrics create(ConfigurationSource conf) {
  MetricsSystem ms = DefaultMetricsSystem.instance();
  // Percentile measurement is off by default, by watching no intervals
  int[] intervals =
      conf.getInts(DFSConfigKeysLegacy.DFS_METRICS_PERCENTILES_INTERVALS_KEY);
  return ms.register(STORAGE_CONTAINER_METRICS,
                     "Storage Container Node Metrics",
                     new ContainerMetrics(intervals));
}
 
Example 4
Source File: CleanerMetrics.java    From hadoop with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: TestClusterMetrics.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@After
public void tearDown() {
  ClusterMetrics.destroy();

  MetricsSystem ms = DefaultMetricsSystem.instance();
  if (ms.getSource("ClusterMetrics") != null) {
    DefaultMetricsSystem.shutdown();
  }
}
 
Example 6
Source File: ClientSCMMetrics.java    From big-c with Apache License 2.0 5 votes vote down vote up
static ClientSCMMetrics create() {
  MetricsSystem ms = DefaultMetricsSystem.instance();

  ClientSCMMetrics metrics = new ClientSCMMetrics();
  ms.register("clientRequests", null, metrics);
  return metrics;
}
 
Example 7
Source File: StandaloneExample.java    From kylin with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final MetricRegistry metrics = new MetricRegistry();

    final HadoopMetrics2Reporter metrics2Reporter = HadoopMetrics2Reporter.forRegistry(metrics).build(
            DefaultMetricsSystem.initialize("StandaloneTest"), // The application-level name
            "Test", // Component name
            "Test", // Component description
            "Test"); // Name for each metric record
    final ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(metrics).build();

    MetricsSystem metrics2 = DefaultMetricsSystem.instance();
    // Writes to stdout without a filename configuration
    // Will be invoked every 10seconds by default
    FileSink sink = new FileSink();
    metrics2.register("filesink", "filesink", sink);
    sink.init(new SubsetConfiguration(null, null) {
        public String getString(String key) {
            if (key.equals("filename")) {
                return null;
            }
            return super.getString(key);
        }
    });

    // How often should the dropwizard reporter be invoked
    metrics2Reporter.start(500, TimeUnit.MILLISECONDS);
    // How often will the dropwziard metrics be logged to the console
    consoleReporter.start(2, TimeUnit.SECONDS);

    generateMetrics(metrics, 5000, 25, TimeUnit.MILLISECONDS, metrics2Reporter, 10);
}
 
Example 8
Source File: ProxyMetrics.java    From nnproxy with Apache License 2.0 5 votes vote down vote up
public static ProxyMetrics create(Configuration conf) {
    String sessionId = conf.get(DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY);
    String processName = "NNPROXY";
    MetricsSystem ms = DefaultMetricsSystem.instance();
    JvmMetrics jm = JvmMetrics.create(processName, sessionId, ms);

    return ms.register(new ProxyMetrics(processName, sessionId, jm));
}
 
Example 9
Source File: CleanerMetrics.java    From big-c with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: FSOpDurations.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private FSOpDurations() {
  registry = new MetricsRegistry(RECORD_INFO);
  registry.tag(RECORD_INFO, "FSOpDurations");

  MetricsSystem ms = DefaultMetricsSystem.instance();
  if (ms != null) {
    ms.register(RECORD_INFO.name(), RECORD_INFO.description(), this);
  }
}
 
Example 11
Source File: NameNodeMetrics.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public static NameNodeMetrics create(Configuration conf, NamenodeRole r) {
  String sessionId = conf.get(DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY);
  String processName = r.toString();
  MetricsSystem ms = DefaultMetricsSystem.instance();
  JvmMetrics jm = JvmMetrics.create(processName, sessionId, ms);
  
  // Percentile measurement is off by default, by watching no intervals
  int[] intervals = 
      conf.getInts(DFSConfigKeys.DFS_METRICS_PERCENTILES_INTERVALS_KEY);
  return ms.register(new NameNodeMetrics(processName, sessionId,
      intervals, jm));
}
 
Example 12
Source File: SCMContainerMetrics.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
public static SCMContainerMetrics create(SCMMXBean scmmxBean) {
  MetricsSystem ms = DefaultMetricsSystem.instance();
  return ms.register(SOURCE, "Storage " +
      "Container Manager Metrics", new SCMContainerMetrics(scmmxBean));
}
 
Example 13
Source File: SCMNodeMetrics.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
/**
 * 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));
}
 
Example 14
Source File: ShuffleHandler.java    From big-c with Apache License 2.0 4 votes vote down vote up
public ShuffleHandler() {
  this(DefaultMetricsSystem.instance());
}
 
Example 15
Source File: SCMContainerManagerMetrics.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
/**
 * Unregister metrics.
 */
public void unRegister() {
  MetricsSystem ms = DefaultMetricsSystem.instance();
  ms.unregisterSource(SOURCE_NAME);
}
 
Example 16
Source File: SCMContainerMetrics.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
public void unRegister() {
  MetricsSystem ms = DefaultMetricsSystem.instance();
  ms.unregisterSource(SOURCE);
}
 
Example 17
Source File: TajoPullServerService.java    From incubator-tajo with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("UnusedDeclaration")
public TajoPullServerService() {
  this(DefaultMetricsSystem.instance());
}
 
Example 18
Source File: SafeModeMetrics.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
public static SafeModeMetrics create() {
  MetricsSystem ms = DefaultMetricsSystem.instance();
  return ms.register(SOURCE_NAME,
      "SCM Safemode Metrics",
      new SafeModeMetrics());
}
 
Example 19
Source File: CSMMetrics.java    From hadoop-ozone with Apache License 2.0 4 votes vote down vote up
public void unRegister() {
  MetricsSystem ms = DefaultMetricsSystem.instance();
  ms.unregisterSource(SOURCE_NAME);
}
 
Example 20
Source File: TajoPullServerService.java    From tajo with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("UnusedDeclaration")
public TajoPullServerService() {
  this(DefaultMetricsSystem.instance());
}