org.eclipse.microprofile.metrics.annotation.ConcurrentGauge Java Examples

The following examples show how to use org.eclipse.microprofile.metrics.annotation.ConcurrentGauge. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CDIAnnotationInfo.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
@Override
public String name() {
    if (annotation instanceof Counted) {
        return ((Counted) annotation).name();
    } else if (annotation instanceof ConcurrentGauge) {
        return ((ConcurrentGauge) annotation).name();
    } else if (annotation instanceof Gauge) {
        return ((Gauge) annotation).name();
    } else if (annotation instanceof Metered) {
        return ((Metered) annotation).name();
    } else if (annotation instanceof Timed) {
        return ((Timed) annotation).name();
    } else if (annotation instanceof SimplyTimed) {
        return ((SimplyTimed) annotation).name();
    } else {
        throw new IllegalArgumentException("Unknown metric annotation type " + annotation.annotationType());
    }
}
 
Example #2
Source File: CDIAnnotationInfo.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
@Override
public boolean absolute() {
    if (annotation instanceof Counted) {
        return ((Counted) annotation).absolute();
    } else if (annotation instanceof ConcurrentGauge) {
        return ((ConcurrentGauge) annotation).absolute();
    } else if (annotation instanceof Gauge) {
        return ((Gauge) annotation).absolute();
    } else if (annotation instanceof Metered) {
        return ((Metered) annotation).absolute();
    } else if (annotation instanceof Timed) {
        return ((Timed) annotation).absolute();
    } else if (annotation instanceof SimplyTimed) {
        return ((SimplyTimed) annotation).absolute();
    } else {
        throw SmallRyeMetricsMessages.msg.unknownMetricAnnotationType(annotation.annotationType());
    }
}
 
Example #3
Source File: CDIAnnotationInfo.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
@Override
public String[] tags() {
    if (annotation instanceof Counted) {
        return ((Counted) annotation).tags();
    } else if (annotation instanceof ConcurrentGauge) {
        return ((ConcurrentGauge) annotation).tags();
    } else if (annotation instanceof Gauge) {
        return ((Gauge) annotation).tags();
    } else if (annotation instanceof Metered) {
        return ((Metered) annotation).tags();
    } else if (annotation instanceof Timed) {
        return ((Timed) annotation).tags();
    } else if (annotation instanceof SimplyTimed) {
        return ((SimplyTimed) annotation).tags();
    } else {
        throw SmallRyeMetricsMessages.msg.unknownMetricAnnotationType(annotation.annotationType());
    }
}
 
Example #4
Source File: CDIAnnotationInfo.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
@Override
public String unit() {
    if (annotation instanceof Counted) {
        return ((Counted) annotation).unit();
    } else if (annotation instanceof ConcurrentGauge) {
        return ((ConcurrentGauge) annotation).unit();
    } else if (annotation instanceof Gauge) {
        return ((Gauge) annotation).unit();
    } else if (annotation instanceof Metered) {
        return ((Metered) annotation).unit();
    } else if (annotation instanceof Timed) {
        return ((Timed) annotation).unit();
    } else if (annotation instanceof SimplyTimed) {
        return ((SimplyTimed) annotation).unit();
    } else {
        throw SmallRyeMetricsMessages.msg.unknownMetricAnnotationType(annotation.annotationType());
    }
}
 
Example #5
Source File: CDIAnnotationInfo.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
@Override
public String description() {
    if (annotation instanceof Counted) {
        return ((Counted) annotation).description();
    } else if (annotation instanceof ConcurrentGauge) {
        return ((ConcurrentGauge) annotation).description();
    } else if (annotation instanceof Gauge) {
        return ((Gauge) annotation).description();
    } else if (annotation instanceof Metered) {
        return ((Metered) annotation).description();
    } else if (annotation instanceof Timed) {
        return ((Timed) annotation).description();
    } else if (annotation instanceof SimplyTimed) {
        return ((SimplyTimed) annotation).description();
    } else {
        throw SmallRyeMetricsMessages.msg.unknownMetricAnnotationType(annotation.annotationType());
    }
}
 
Example #6
Source File: CDIAnnotationInfo.java    From smallrye-metrics with Apache License 2.0 6 votes vote down vote up
@Override
public String displayName() {
    if (annotation instanceof Counted) {
        return ((Counted) annotation).displayName();
    } else if (annotation instanceof ConcurrentGauge) {
        return ((ConcurrentGauge) annotation).displayName();
    } else if (annotation instanceof Gauge) {
        return ((Gauge) annotation).displayName();
    } else if (annotation instanceof Metered) {
        return ((Metered) annotation).displayName();
    } else if (annotation instanceof Timed) {
        return ((Timed) annotation).displayName();
    } else if (annotation instanceof SimplyTimed) {
        return ((SimplyTimed) annotation).displayName();
    } else {
        throw SmallRyeMetricsMessages.msg.unknownMetricAnnotationType(annotation.annotationType());
    }
}
 
Example #7
Source File: MetricCdiInjectionExtension.java    From smallrye-metrics with Apache License 2.0 5 votes vote down vote up
private <X> void findAnnotatedInterfaces(@Observes @WithAnnotations({ Counted.class, Gauge.class, Metered.class,
        SimplyTimed.class, Timed.class, ConcurrentGauge.class }) ProcessAnnotatedType<X> pat) {
    Class<X> clazz = pat.getAnnotatedType().getJavaClass();
    Package pack = clazz.getPackage();
    if (pack != null && pack.getName().equals(GaugeRegistrationInterceptor.class.getPackage().getName())) {
        return;
    }
    if (clazz.isInterface()) {
        // All declared metrics of an annotated interface are registered during AfterDeploymentValidation
        metricsInterfaces.add(clazz);
    }
}
 
Example #8
Source File: MetricsResource.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@ConcurrentGauge(name = "cgauge")
String cGaugedMethod() {
    try {
        latch.await(20, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "OK";
}
 
Example #9
Source File: ConcurrentGaugeFunctionalBean.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@Override
@ConcurrentGauge(name = "mygauge", absolute = true)
public void controlledMethod(CountDownLatch startMarker, CountDownLatch endCommand) {
    startMarker.countDown();
    try {
        endCommand.await();
    }
    catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
}
 
Example #10
Source File: ConcurrentGaugedMethodBean.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@ConcurrentGauge(name = "cGaugedMethod", absolute = true)
public T countedMethod(Callable<T> callable) {
    try {
        return callable.call();
    }
    catch (Exception cause) {
        throw new RuntimeException(cause);
    }
}
 
Example #11
Source File: MetricResolver.java    From smallrye-metrics with Apache License 2.0 4 votes vote down vote up
public Of<ConcurrentGauge> concurrentGauge(BeanInfo topClass, MemberInfo element) {
    return resolverOf(topClass, element, ConcurrentGauge.class);
}
 
Example #12
Source File: ConcurrentGaugedConstructorBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@ConcurrentGauge(name = "cGaugedConstructor")
public ConcurrentGaugedConstructorBean() {
}
 
Example #13
Source File: MetricAppBean.java    From microprofile-metrics with Apache License 2.0 2 votes vote down vote up
@ConcurrentGauge(name = TAGGED_CONCURRENTGAUGE, absolute = true, tags= {"number=two"})
public void concurrentGaugeMeTaggedTwo() {

}
 
Example #14
Source File: Initialization_ConcurrentGauge_Method_Test.java    From smallrye-metrics with Apache License 2.0 2 votes vote down vote up
@ConcurrentGauge(name = "cgauged_method", absolute = true)
public void cGaugedMethod() {

}
 
Example #15
Source File: MetricAppBean.java    From microprofile-metrics with Apache License 2.0 2 votes vote down vote up
@ConcurrentGauge(name = TAGGED_CONCURRENTGAUGE, absolute = true, tags= {"number=one"})
public void concurrentGaugeMeTaggedOne() {

}
 
Example #16
Source File: MetricAppBean.java    From microprofile-metrics with Apache License 2.0 2 votes vote down vote up
@ConcurrentGauge(absolute = true)
public void concGaugeMeA() {

}
 
Example #17
Source File: DependentScopedBeanWithMetrics.java    From smallrye-metrics with Apache License 2.0 2 votes vote down vote up
@ConcurrentGauge(name = "cgauge", absolute = true)
public void cGaugedMethod() {

}