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

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

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

MetricsRegistry.newGauge介绍

[英]Create a mutable float gauge
[中]创建一个可变浮标

代码示例

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

/**
 * Create a mutable float gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeFloat newGauge(String name, String desc, float iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}

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

/**
 * Create a mutable integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeInt newGauge(String name, String desc, int iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}

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

/**
 * Create a mutable long integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeLong newGauge(String name, String desc, long iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}

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

dropped = registry.newCounter("Sink_"+ name +"Dropped",
               "Dropped updates per sink", 0);
qsize = registry.newGauge("Sink_"+ name + "Qsize", "Queue size", 0);

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

this.cpuMetricsInfoMap.put(i, mic);
this.userMetricsInfoMap.put(i, miu);
this.executorThreadCpuTime[i] = registry.newGauge(mic, 0L);
this.executorThreadUserTime[i] = registry.newGauge(miu, 0L);
this.executorNames.put(ContainerRunnerImpl.THREAD_NAME_FORMAT_PREFIX + i, i);

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

return registry.newGauge(info, 0);
return registry.newGauge(info, 0L);
return registry.newGauge(info, 0f);

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

Metrics2TabletServerMetrics(TabletServer tserver, MetricsSystem system) {
 util = new TabletServerMetricsUtil(tserver);
 this.system = system;
 this.registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION));
 this.registry.tag(MsInfo.ProcessName, MetricsSystemHelper.getProcessName());
 entries = registry.newGauge(Interns.info(ENTRIES, "Number of entries"), 0L);
 entriesInMemory = registry.newGauge(Interns.info(ENTRIES_IN_MEM, "Number of entries in memory"),
   0L);
 activeMajcs = registry
   .newGauge(Interns.info(ACTIVE_MAJCS, "Number of active major compactions"), 0L);
 queuedMajcs = registry
   .newGauge(Interns.info(QUEUED_MAJCS, "Number of queued major compactions"), 0L);
 activeMincs = registry
   .newGauge(Interns.info(ACTIVE_MINCS, "Number of active minor compactions"), 0L);
 queuedMincs = registry
   .newGauge(Interns.info(QUEUED_MINCS, "Number of queued minor compactions"), 0L);
 onlineTablets = registry.newGauge(Interns.info(ONLINE_TABLETS, "Number of online tablets"), 0L);
 openingTablets = registry.newGauge(Interns.info(OPENING_TABLETS, "Number of opening tablets"),
   0L);
 unopenedTablets = registry
   .newGauge(Interns.info(UNOPENED_TABLETS, "Number of unopened tablets"), 0L);
 queries = registry.newGauge(Interns.info(QUERIES, "Number of queries"), 0L);
 totalMincs = registry
   .newGauge(Interns.info(TOTAL_MINCS, "Total number of minor compactions performed"), 0L);
}

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

/**
 * Create a gauge in the registry.
 * @param name name gauge name
 * @param desc description
 * @return the gauge
 */
protected final MutableGaugeLong gauge(String name, String desc) {
 return registry.newGauge(name, desc, 0L);
}

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

/**
 * Create a mutable long integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeLong newGauge(String name, String desc, long iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}

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

/**
 * Create a mutable integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeInt newGauge(String name, String desc, int iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}
/**

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

/**
 * Create a mutable integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeInt newGauge(String name, String desc, int iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}
/**

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

/**
 * Create a mutable integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeInt newGauge(String name, String desc, int iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}
/**

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

/**
 * Create a mutable integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeInt newGauge(String name, String desc, int iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}
/**

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

/**
 * Create a mutable long integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeLong newGauge(String name, String desc, long iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}

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

/**
 * Create a mutable long integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeLong newGauge(String name, String desc, long iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}

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

/**
 * Create a mutable long integer gauge
 * @param name  of the metric
 * @param desc  metric description
 * @param iVal  initial value
 * @return a new gauge object
 */
public MutableGaugeLong newGauge(String name, String desc, long iVal) {
 return newGauge(Interns.info(name, desc), iVal);
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private MutableGaugeInt[] buildBuckets(Configuration conf) {
 ArrayList<Integer> buckets = 
  parseInts(conf.get(YarnConfiguration.RM_METRICS_RUNTIME_BUCKETS,
       YarnConfiguration.DEFAULT_RM_METRICS_RUNTIME_BUCKETS));
 MutableGaugeInt[] result = new MutableGaugeInt[buckets.size() + 1];
 result[0] = registry.newGauge("running_0", "", 0);
 long[] cuts = new long[buckets.size()];
 for(int i=0; i < buckets.size(); ++i) {
  result[i+1] = registry.newGauge("running_" + buckets.get(i), "", 0);
  cuts[i] = buckets.get(i) * 1000L * 60; // covert from min to ms
 }
 this.runBuckets = new TimeBucketMetrics<ApplicationId>(cuts);
 return result;
}

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

private MutableGaugeInt[] buildBuckets(Configuration conf) {
 ArrayList<Integer> buckets = 
  parseInts(conf.get(YarnConfiguration.RM_METRICS_RUNTIME_BUCKETS,
       YarnConfiguration.DEFAULT_RM_METRICS_RUNTIME_BUCKETS));
 MutableGaugeInt[] result = new MutableGaugeInt[buckets.size() + 1];
 result[0] = registry.newGauge("running_0", "", 0);
 long[] cuts = new long[buckets.size()];
 for(int i=0; i < buckets.size(); ++i) {
  result[i+1] = registry.newGauge("running_" + buckets.get(i), "", 0);
  cuts[i] = buckets.get(i) * 1000L * 60; // covert from min to ms
 }
 this.runBuckets = new TimeBucketMetrics<ApplicationId>(cuts);
 return result;
}

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

private MutableGaugeInt[] buildBuckets(Configuration conf) {
 ArrayList<Integer> buckets = 
  parseInts(conf.get(YarnConfiguration.RM_METRICS_RUNTIME_BUCKETS,
       YarnConfiguration.DEFAULT_RM_METRICS_RUNTIME_BUCKETS));
 MutableGaugeInt[] result = new MutableGaugeInt[buckets.size() + 1];
 result[0] = registry.newGauge("running_0", "", 0);
 long[] cuts = new long[buckets.size()];
 for(int i=0; i < buckets.size(); ++i) {
  result[i+1] = registry.newGauge("running_" + buckets.get(i), "", 0);
  cuts[i] = buckets.get(i) * 1000L * 60; // covert from min to ms
 }
 this.runBuckets = new TimeBucketMetrics<ApplicationId>(cuts);
 return result;
}

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

/**
 * Test the add by name method
 */
@Test public void testAddByName() {
 MetricsRecordBuilder rb = mockMetricsRecordBuilder();
 final MetricsRegistry r = new MetricsRegistry("test");
 r.add("s1", 42);
 r.get("s1").snapshot(rb);
 verify(rb).addCounter(info("S1NumOps", "Number of ops for s1"), 1L);
 verify(rb).addGauge(info("S1AvgTime", "Average time for s1"), 42.0);
 r.newCounter("c1", "test add", 1);
 r.newGauge("g1", "test add", 1);
 expectMetricsException("Unsupported add", new Runnable() {
  @Override
  public void run() { r.add("c1", 42); }
 });
 expectMetricsException("Unsupported add", new Runnable() {
  @Override
  public void run() { r.add("g1", 42); }
 });
}

相关文章