Examples of MetricsInfo


Examples of org.apache.hadoop.metrics2.MetricsInfo

    return description;
  }

  @Override public boolean equals(Object obj) {
    if (obj instanceof MetricsInfo) {
      MetricsInfo other = (MetricsInfo) obj;
      return Objects.equal(name, other.name()) &&
             Objects.equal(description, other.description());
    }
    return false;
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsInfo

  MutableMetric newForField(Field field, Metric annotation,
                            MetricsRegistry registry) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("field "+ field +" with annotation "+ annotation);
    }
    MetricsInfo info = getInfo(annotation, field);
    MutableMetric metric = newForField(field, annotation);
    if (metric != null) {
      registry.add(info.name(), metric);
      return metric;
    }
    final Class<?> cls = field.getType();
    if (cls == MutableCounterInt.class) {
      return registry.newCounter(info, 0);
    }
    if (cls == MutableCounterLong.class) {
      return registry.newCounter(info, 0L);
    }
    if (cls == MutableGaugeInt.class) {
      return registry.newGauge(info, 0);
    }
    if (cls == MutableGaugeLong.class) {
      return registry.newGauge(info, 0L);
    }
    if (cls == MutableRate.class) {
      return registry.newRate(info.name(), info.description(),
                              annotation.always());
    }
    if (cls == MutableRates.class) {
      return new MutableRates(registry);
    }
    if (cls == MutableStat.class) {
      return registry.newStat(info.name(), info.description(),
                              annotation.sampleName(), annotation.valueName(),
                              annotation.always());
    }
    throw new MetricsException("Unsupported metric field "+ field.getName() +
                               " of type "+ field.getType().getName());
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsInfo

  MutableMetric newForMethod(Object source, Method method, Metric annotation,
                             MetricsRegistry registry) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("method "+ method +" with annotation "+ annotation);
    }
    MetricsInfo info = getInfo(annotation, method);
    MutableMetric metric = newForMethod(source, method, annotation);
    metric = metric != null ? metric :
        new MethodMetric(source, method, info, annotation.type());
    registry.add(info.name(), metric);
    return metric;
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsInfo

  @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) {
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsInfo

   * @param descSuffix String suffix of metric description
   * @param value long counter value
   */
  private static void addCounter(MetricsRecordBuilder builder, Phase phase,
      String nameSuffix, String descSuffix, long value) {
    MetricsInfo metricsInfo = info(phase.getName() + nameSuffix,
      phase.getDescription() + descSuffix);
    builder.addCounter(metricsInfo, value);
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsInfo

   * @param descSuffix String suffix of metric description
   * @param value float gauge value
   */
  private static void addGauge(MetricsRecordBuilder builder, Phase phase,
      String nameSuffix, String descSuffix, float value) {
    MetricsInfo metricsInfo = info(phase.getName() + nameSuffix,
      phase.getDescription() + descSuffix);
    builder.addGauge(metricsInfo, value);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.