org.apache.hadoop.metrics2.lib.MetricsRegistry.newStat()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(13.8k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中org.apache.hadoop.metrics2.lib.MetricsRegistry.newStat()方法的一些代码示例,展示了MetricsRegistry.newStat()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetricsRegistry.newStat()方法的具体详情如下:
包路径:org.apache.hadoop.metrics2.lib.MetricsRegistry
类名称:MetricsRegistry
方法名:newStat

MetricsRegistry.newStat介绍

[英]Create a mutable metric with stats
[中]创建一个具有统计信息的可变指标

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Create a mutable metric with stats
 * @param name  of the metric
 * @param desc  metric description
 * @param sampleName  of the metric (e.g., "Ops")
 * @param valueName   of the metric (e.g., "Time" or "Latency")
 * @return a new mutable metric object
 */
public MutableStat newStat(String name, String desc,
              String sampleName, String valueName) {
 return newStat(name, desc, sampleName, valueName, false);
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

return registry.newStat(info.name(), info.description(),
            annotation.sampleName(), annotation.valueName(),
            annotation.always());

代码示例来源:origin: apache/accumulo

Metrics2TabletServerScanMetrics(MetricsSystem system) {
 this.system = system;
 this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 this.registry.tag(MsInfo.ProcessName, MetricsSystemHelper.getProcessName());
 scans = registry.newStat(SCAN, "Scans", "Ops", "Count", true);
 resultsPerScan = registry.newStat(RESULT_SIZE, "Results per scan", "Ops", "Count", true);
 yields = registry.newStat(YIELD, "Yields", "Ops", "Count", true);
}

代码示例来源:origin: apache/accumulo

Metrics2TabletServerMinCMetrics(MetricsSystem system) {
 this.system = system;
 this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 this.registry.tag(MsInfo.ProcessName, MetricsSystemHelper.getProcessName());
 activeMinc = registry.newStat(MINC, "Minor compactions", "Ops", "Count", true);
 queuedMinc = registry.newStat(QUEUE, "Queued minor compactions", "Ops", "Count", true);
}

代码示例来源:origin: apache/accumulo

Metrics2TabletServerUpdateMetrics(MetricsSystem system) {
 this.system = system;
 this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 this.registry.tag(MsInfo.ProcessName, MetricsSystemHelper.getProcessName());
 permissionErrorsCounter = registry
   .newCounter(Interns.info(PERMISSION_ERRORS, "Permission Errors"), 0L);
 unknownTabletErrorsCounter = registry
   .newCounter(Interns.info(UNKNOWN_TABLET_ERRORS, "Unknown Tablet Errors"), 0L);
 constraintViolationsCounter = registry
   .newCounter(Interns.info(CONSTRAINT_VIOLATIONS, "Table Constraint Violations"), 0L);
 commitPrepStat = registry.newStat(COMMIT_PREP, "preparing to commit mutations", "Ops", "Time",
   true);
 walogWriteTimeStat = registry.newStat(WALOG_WRITE_TIME, "writing mutations to WAL", "Ops",
   "Time", true);
 commitTimeStat = registry.newStat(COMMIT_TIME, "committing mutations", "Ops", "Time", true);
 mutationArraySizeStat = registry.newStat(MUTATION_ARRAY_SIZE, "mutation array", "ops", "Size",
   true);
}

代码示例来源:origin: apache/accumulo

Metrics2ReplicationMetrics(Master master, MetricsSystem system) {
 this.master = master;
 this.system = system;
 pathModTimes = new HashMap<>();
 this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 this.registry.tag(MsInfo.ProcessName, MetricsSystemHelper.getProcessName());
 replicationUtil = new ReplicationUtil(master.getContext());
 replicationQueueTimeQuantiles = registry.newQuantiles(REPLICATION_QUEUE_TIME_QUANTILES,
   "Replication queue time quantiles in milliseconds", "ops", "latency", 600);
 replicationQueueTimeStat = registry.newStat(REPLICATION_QUEUE_TIME,
   "Replication queue time statistics in milliseconds", "ops", "latency", true);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
 * Create a mutable metric with stats
 * @param name  of the metric
 * @param desc  metric description
 * @param sampleName  of the metric (e.g., "Ops")
 * @param valueName   of the metric (e.g., "Time" or "Latency")
 * @return a new mutable metric object
 */
public MutableStat newStat(String name, String desc,
              String sampleName, String valueName) {
 return newStat(name, desc, sampleName, valueName, false);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
 * Create a mutable metric with stats
 * @param name  of the metric
 * @param desc  metric description
 * @param sampleName  of the metric (e.g., "Ops")
 * @param valueName   of the metric (e.g., "Time" or "Latency")
 * @return a new mutable metric object
 */
public MutableStat newStat(String name, String desc,
              String sampleName, String valueName) {
 return newStat(name, desc, sampleName, valueName, false);
}

代码示例来源:origin: io.hops/hadoop-common

/**
 * Create a mutable metric with stats
 * @param name  of the metric
 * @param desc  metric description
 * @param sampleName  of the metric (e.g., "Ops")
 * @param valueName   of the metric (e.g., "Time" or "Latency")
 * @return a new mutable metric object
 */
public MutableStat newStat(String name, String desc,
              String sampleName, String valueName) {
 return newStat(name, desc, sampleName, valueName, false);
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Create a mutable metric with stats
 * @param name  of the metric
 * @param desc  metric description
 * @param sampleName  of the metric (e.g., "Ops")
 * @param valueName   of the metric (e.g., "Time" or "Latency")
 * @return a new mutable metric object
 */
public MutableStat newStat(String name, String desc,
              String sampleName, String valueName) {
 return newStat(name, desc, sampleName, valueName, false);
}

代码示例来源:origin: org.apache.accumulo/accumulo-tserver

Metrics2TabletServerScanMetrics(MetricsSystem system) {
 this.system = system;
 this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 this.registry.tag(MsInfo.ProcessName, MetricsSystemHelper.getProcessName());
 scans = registry.newStat(SCAN, "Scans", "Ops", "Count", true);
 resultsPerScan = registry.newStat(RESULT_SIZE, "Results per scan", "Ops", "Count", true);
 yields = registry.newStat(YIELD, "Yields", "Ops", "Count", true);
}

代码示例来源:origin: org.apache.accumulo/accumulo-tserver

Metrics2TabletServerMinCMetrics(MetricsSystem system) {
 this.system = system;
 this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 this.registry.tag(MsInfo.ProcessName, MetricsSystemHelper.getProcessName());
 activeMinc = registry.newStat(MINC, "Minor compactions", "Ops", "Count", true);
 queuedMinc = registry.newStat(QUEUE, "Queued minor compactions", "Ops", "Count", true);
}

代码示例来源:origin: org.apache.accumulo/accumulo-tserver

Metrics2TabletServerUpdateMetrics(MetricsSystem system) {
 this.system = system;
 this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 this.registry.tag(MsInfo.ProcessName, MetricsSystemHelper.getProcessName());
 permissionErrorsCounter = registry
   .newCounter(Interns.info(PERMISSION_ERRORS, "Permission Errors"), 0l);
 unknownTabletErrorsCounter = registry
   .newCounter(Interns.info(UNKNOWN_TABLET_ERRORS, "Unknown Tablet Errors"), 0l);
 constraintViolationsCounter = registry
   .newCounter(Interns.info(CONSTRAINT_VIOLATIONS, "Table Constraint Violations"), 0l);
 commitPrepStat = registry.newStat(COMMIT_PREP, "preparing to commit mutations", "Ops", "Time",
   true);
 walogWriteTimeStat = registry.newStat(WALOG_WRITE_TIME, "writing mutations to WAL", "Ops",
   "Time", true);
 commitTimeStat = registry.newStat(COMMIT_TIME, "committing mutations", "Ops", "Time", true);
 mutationArraySizeStat = registry.newStat(MUTATION_ARRAY_SIZE, "mutation array", "ops", "Size",
   true);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-nodemanager

ContainerMetrics(
  MetricsSystem ms, ContainerId containerId, long flushPeriodMs,
  long delayMs) {
 this.recordInfo =
   info(sourceName(containerId), RECORD_INFO.description());
 this.registry = new MetricsRegistry(recordInfo);
 this.metricsSystem = ms;
 this.containerId = containerId;
 this.flushPeriodMs = flushPeriodMs;
 this.unregisterDelayMs = delayMs < 0 ? 0 : delayMs;
 scheduleTimerTaskIfRequired();
 this.pMemMBsStat = registry.newStat(
   PMEM_USAGE_METRIC_NAME, "Physical memory stats", "Usage", "MBs", true);
 this.cpuCoreUsagePercent = registry.newStat(
   PHY_CPU_USAGE_METRIC_NAME, "Physical Cpu core percent usage stats",
   "Usage", "Percents", true);
 this.milliVcoresUsed = registry.newStat(
   VCORE_USAGE_METRIC_NAME, "1000 times Vcore usage", "Usage",
   "MilliVcores", true);
 this.pMemLimitMbs = registry.newGauge(
   PMEM_LIMIT_METRIC_NAME, "Physical memory limit in MBs", 0);
 this.vMemLimitMbs = registry.newGauge(
   VMEM_LIMIT_METRIC_NAME, "Virtual memory limit in MBs", 0);
 this.cpuVcoreLimit = registry.newGauge(
   VCORE_LIMIT_METRIC_NAME, "CPU limit in number of vcores", 0);
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-nodemanager

ContainerMetrics(
  MetricsSystem ms, ContainerId containerId, long flushPeriodMs,
  long delayMs) {
 this.recordInfo =
   info(sourceName(containerId), RECORD_INFO.description());
 this.registry = new MetricsRegistry(recordInfo);
 this.metricsSystem = ms;
 this.containerId = containerId;
 this.flushPeriodMs = flushPeriodMs;
 this.unregisterDelayMs = delayMs < 0 ? 0 : delayMs;
 scheduleTimerTaskIfRequired();
 this.pMemMBsStat = registry.newStat(
   PMEM_USAGE_METRIC_NAME, "Physical memory stats", "Usage", "MBs", true);
 this.cpuCoreUsagePercent = registry.newStat(
   PHY_CPU_USAGE_METRIC_NAME, "Physical Cpu core percent usage stats",
   "Usage", "Percents", true);
 this.milliVcoresUsed = registry.newStat(
   VCORE_USAGE_METRIC_NAME, "1000 times Vcore usage", "Usage",
   "MilliVcores", true);
 this.pMemLimitMbs = registry.newGauge(
   PMEM_LIMIT_METRIC_NAME, "Physical memory limit in MBs", 0);
 this.vMemLimitMbs = registry.newGauge(
   VMEM_LIMIT_METRIC_NAME, "Virtual memory limit in MBs", 0);
 this.cpuVcoreLimit = registry.newGauge(
   VCORE_LIMIT_METRIC_NAME, "CPU limit in number of vcores", 0);
}

代码示例来源:origin: org.apache.accumulo/accumulo-master

Metrics2ReplicationMetrics(Master master, MetricsSystem system) {
 this.master = master;
 this.system = system;
 pathModTimes = new HashMap<>();
 this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 this.registry.tag(MsInfo.ProcessName, MetricsSystemHelper.getProcessName());
 replicationUtil = new ReplicationUtil(master);
 replicationQueueTimeQuantiles = registry.newQuantiles(REPLICATION_QUEUE_TIME_QUANTILES,
   "Replication queue time quantiles in milliseconds", "ops", "latency", 600);
 replicationQueueTimeStat = registry.newStat(REPLICATION_QUEUE_TIME,
   "Replication queue time statistics in milliseconds", "ops", "latency", true);
}

代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager

scheduleTimerTaskIfRequired();
this.pMemMBsStat = registry.newStat(
  PMEM_USAGE_METRIC_NAME, "Physical memory stats", "Usage", "MBs", true);
this.cpuCoreUsagePercent = registry.newStat(
  PHY_CPU_USAGE_METRIC_NAME, "Physical Cpu core percent usage stats",
  "Usage", "Percents", true);
this.milliVcoresUsed = registry.newStat(
  VCORE_USAGE_METRIC_NAME, "1000 times Vcore usage", "Usage",
  "MilliVcores", true);

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
 * Tests that when using {@link MutableStat#add(long, long)}, even with a high
 * sample count, the mean does not lose accuracy.
 */
@Test public void testMutableStatWithBulkAdd() {
 MetricsRecordBuilder rb = mockMetricsRecordBuilder();
 MetricsRegistry registry = new MetricsRegistry("test");
 MutableStat stat = registry.newStat("Test", "Test", "Ops", "Val", false);
 stat.add(1000, 1000);
 stat.add(1000, 2000);
 registry.snapshot(rb, false);
 assertCounter("TestNumOps", 2000L, rb);
 assertGauge("TestAvgVal", 1.5, rb);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
 * Test various factory methods
 */
@Test public void testNewMetrics() {
 final MetricsRegistry r = new MetricsRegistry("test");
 r.newCounter("c1", "c1 desc", 1);
 r.newCounter("c2", "c2 desc", 2L);
 r.newGauge("g1", "g1 desc", 3);
 r.newGauge("g2", "g2 desc", 4L);
 r.newStat("s1", "s1 desc", "ops", "time");
 assertEquals("num metrics in registry", 5, r.metrics().size());
 assertTrue("c1 found", r.get("c1") instanceof MutableCounterInt);
 assertTrue("c2 found", r.get("c2") instanceof MutableCounterLong);
 assertTrue("g1 found", r.get("g1") instanceof MutableGaugeInt);
 assertTrue("g2 found", r.get("g2") instanceof MutableGaugeLong);
 assertTrue("s1 found", r.get("s1") instanceof MutableStat);
 expectMetricsException("Metric name c1 already exists", new Runnable() {
  @Override
  public void run() { r.newCounter("c1", "test dup", 0); }
 });
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
 * Test various factory methods
 */
@Test public void testNewMetrics() {
 final MetricsRegistry r = new MetricsRegistry("test");
 r.newCounter("c1", "c1 desc", 1);
 r.newCounter("c2", "c2 desc", 2L);
 r.newGauge("g1", "g1 desc", 3);
 r.newGauge("g2", "g2 desc", 4L);
 r.newStat("s1", "s1 desc", "ops", "time");
 assertEquals("num metrics in registry", 5, r.metrics().size());
 assertTrue("c1 found", r.get("c1") instanceof MutableCounterInt);
 assertTrue("c2 found", r.get("c2") instanceof MutableCounterLong);
 assertTrue("g1 found", r.get("g1") instanceof MutableGaugeInt);
 assertTrue("g2 found", r.get("g2") instanceof MutableGaugeLong);
 assertTrue("s1 found", r.get("s1") instanceof MutableStat);
 expectMetricsException("Metric name c1 already exists", new Runnable() {
  @Override
  public void run() { r.newCounter("c1", "test dup", 0); }
 });
}

相关文章