com.codahale.metrics.annotation.Gauge.name()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(225)

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

Gauge.name介绍

暂无

代码示例

代码示例来源:origin: stagemonitor/stagemonitor

public static void monitorGauges(Object object) {
  for (final Method method : object.getClass().getDeclaredMethods()) {
    final Gauge gaugeAnnotation = method.getAnnotation(Gauge.class);
    // only create gauge, if method takes no parameters and is non-void
    if (gaugeAnnotation != null && methodTakesNoParamsAndIsNonVoid(method)) {
      method.setAccessible(true);
      final String signature = SignatureUtils.getSignature(object.getClass().getName(), method.getName(),
          gaugeAnnotation.name(), gaugeAnnotation.absolute());
      registerGauge(object, method, signature);
    }
  }
}

代码示例来源:origin: ryantenney/metrics-spring

static String forGauge(Class<?> klass, Member member, Gauge annotation) {
  return chooseName(annotation.name(), annotation.absolute(), klass, member);
}

代码示例来源:origin: palominolabs/metrics-guice

@Nonnull
  @Override
  public String getNameForGauge(@Nonnull Class<?> instanceClass, @Nonnull Method method, @Nonnull Gauge gauge) {
    if (gauge.absolute()) {
      return gauge.name();
    }

    if (gauge.name().isEmpty()) {
      return name(instanceClass, method.getName(), GAUGE_SUFFIX);
    }

    return name(instanceClass, gauge.name());
  }
}

代码示例来源:origin: com.palominolabs.metrics/metrics-guice

@Nonnull
@Override
public String getNameForGauge(@Nonnull Method method, @Nonnull Gauge gauge) {
  if (gauge.absolute()) {
    return gauge.name();
  }
  if (gauge.name().isEmpty()) {
    return name(method.getDeclaringClass(), method.getName(), GAUGE_SUFFIX);
  }
  return name(method.getDeclaringClass(), gauge.name());
}

代码示例来源:origin: palominolabs/metrics-guice

@Nonnull
@Override
public String getNameForGauge(@Nonnull Class<?> instanceClass, @Nonnull Method method, @Nonnull Gauge gauge) {
  if (gauge.absolute()) {
    return gauge.name();
  }
  if (gauge.name().isEmpty()) {
    return name(method.getDeclaringClass(), method.getName(), GAUGE_SUFFIX);
  }
  return name(method.getDeclaringClass(), gauge.name());
}

代码示例来源:origin: org.sonatype.goodies.dropwizard/dropwizard-support-core

@Nonnull
@Override
public String getNameForGauge(@Nonnull final Class<?> instanceClass,
               @Nonnull final Method method,
               @Nonnull final Gauge gauge)
{
 if (gauge.absolute()) {
  return gauge.name();
 }
 else {
  return metricName(method, gauge.name());
 }
}

代码示例来源:origin: io.astefanutti.metrics.cdi/metrics-cdi

private String metricName(Annotation annotation) {
  if (CachedGauge.class.isInstance(annotation))
    return ((CachedGauge) annotation).name();
  else if (Counted.class.isInstance(annotation))
    return ((Counted) annotation).name();
  else if (ExceptionMetered.class.isInstance(annotation))
    return ((ExceptionMetered) annotation).name();
  else if (Gauge.class.isInstance(annotation))
    return ((Gauge) annotation).name();
  else if (Metered.class.isInstance(annotation))
    return ((Metered) annotation).name();
  else if (Timed.class.isInstance(annotation))
    return ((Timed) annotation).name();
  else
    throw new IllegalArgumentException("Unsupported Metrics forMethod [" + annotation.getClass().getName() + "]");
}

代码示例来源:origin: astefanutti/metrics-cdi

private String metricName(Annotation annotation) {
  if (CachedGauge.class.isInstance(annotation))
    return ((CachedGauge) annotation).name();
  else if (Counted.class.isInstance(annotation))
    return ((Counted) annotation).name();
  else if (ExceptionMetered.class.isInstance(annotation))
    return ((ExceptionMetered) annotation).name();
  else if (Gauge.class.isInstance(annotation))
    return ((Gauge) annotation).name();
  else if (Metered.class.isInstance(annotation))
    return ((Metered) annotation).name();
  else if (Timed.class.isInstance(annotation))
    return ((Timed) annotation).name();
  else
    throw new IllegalArgumentException("Unsupported Metrics forMethod [" + annotation.getClass().getName() + "]");
}

相关文章