com.codahale.metrics.annotation.Gauge类的使用及代码示例

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

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

Gauge介绍

暂无

代码示例

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

@Gauge(name = "myGaugeNameAbsolute", absolute = true)
  public void gaugeNameAbsolute() {
  }
}

代码示例来源: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: 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 boolean isMetricAbsolute(Annotation annotation) {
  if (extension.<Boolean>getParameter(UseAbsoluteName).orElse(false))
    return true;
  if (CachedGauge.class.isInstance(annotation))
    return ((CachedGauge) annotation).absolute();
  else if (Counted.class.isInstance(annotation))
    return ((Counted) annotation).absolute();
  else if (ExceptionMetered.class.isInstance(annotation))
    return ((ExceptionMetered) annotation).absolute();
  else if (Gauge.class.isInstance(annotation))
    return ((Gauge) annotation).absolute();
  else if (Metered.class.isInstance(annotation))
    return ((Metered) annotation).absolute();
  else if (Timed.class.isInstance(annotation))
    return ((Timed) annotation).absolute();
  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() + "]");
}

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

private boolean isMetricAbsolute(Annotation annotation) {
  if (extension.<Boolean>getParameter(UseAbsoluteName).orElse(false))
    return true;
  if (CachedGauge.class.isInstance(annotation))
    return ((CachedGauge) annotation).absolute();
  else if (Counted.class.isInstance(annotation))
    return ((Counted) annotation).absolute();
  else if (ExceptionMetered.class.isInstance(annotation))
    return ((ExceptionMetered) annotation).absolute();
  else if (Gauge.class.isInstance(annotation))
    return ((Gauge) annotation).absolute();
  else if (Metered.class.isInstance(annotation))
    return ((Metered) annotation).absolute();
  else if (Timed.class.isInstance(annotation))
    return ((Timed) annotation).absolute();
  else
    throw new IllegalArgumentException("Unsupported Metrics forMethod [" + annotation.getClass().getName() + "]");
}

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

@Gauge
public static int staticGaugeDefault() {
  return 1;
}

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

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

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

@Gauge(absolute = true)
public void gaugeAbsolute() {
}

代码示例来源: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: stagemonitor/stagemonitor

@Gauge
private int gaugeDefault() {
  return 1;
}

代码示例来源: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: stagemonitor/stagemonitor

@Gauge(name = "myGaugeName")
public void gaugeName() {
}

代码示例来源: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: io.astefanutti.metrics.aspectj/metrics-aspectj-se

@Gauge(name = "publicGaugeMethod")
public long getPublicGaugeMethod() {
  return publicGauge;
}

代码示例来源: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: org.stefanutti.metrics.aspectj/metrics-aspectj-se

@Gauge(name = "protectedGaugeMethod")
protected long getProtectedGauge() {
  return protectedGauge;
}

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

@Gauge(name = "singleGaugeMethod")
public long getSingleGauge() {
  return singleGauge;
}

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

@Gauge(name = "packagePrivateGaugeMethod")
long getPackagePrivateGauge() {
  return packagePrivateGauge;
}

代码示例来源:origin: org.stefanutti.metrics.aspectj/metrics-aspectj-se

@Gauge(name = "packagePrivateGaugeMethod")
long getPackagePrivateGauge() {
  return packagePrivateGauge;
}

相关文章