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

The following examples show how to use org.eclipse.microprofile.metrics.annotation.SimplyTimed. 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: InheritedSimplyTimedMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed
public void simplyTimedMethodOne() {
}
 
Example #9
Source File: SimplyTimedTagMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed(name = "simplyTimedMethod", tags= {"number=two"})
public void simplyTimedMethodTwo() {
}
 
Example #10
Source File: SimplyTimedTagMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed(name = "simplyTimedMethod", tags= {"number=one"})
public void simplyTimedMethodOne() {
}
 
Example #11
Source File: SimplyTimedConstructorBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed(name = "simplyTimedConstructor")
public SimplyTimedConstructorBean() {
}
 
Example #12
Source File: SimplyTimedMethodBean3.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed(name = "simplyTimedMethod")
public void simplyTimedMethod() throws InterruptedException {
    Thread.sleep(2000);
}
 
Example #13
Source File: SimplyTimedMethodBean2.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed(name = "simplyTimedMethod")
public void simplyTimedMethod() throws InterruptedException {
    Thread.sleep(2000);
}
 
Example #14
Source File: SimplyTimedMethodBean1.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed(name = "simplyTimedMethod")
public void simplyTimedMethod() throws InterruptedException {
    Thread.sleep(2000);
}
 
Example #15
Source File: SimpleTimerFunctionalBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed(name = "mySimplyTimed", absolute = true)
public void doSomething() {
}
 
Example #16
Source File: InheritedSimplyTimedMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed
void simplyTimedMethodPackagedPrivate() {
}
 
Example #17
Source File: InheritedSimplyTimedMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed
protected void simplyTimedMethodProtected() {
}
 
Example #18
Source File: InheritedSimplyTimedMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed
public void simplyTimedMethodTwo() {
}
 
Example #19
Source File: VisibilitySimplyTimedMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed
protected void protectedSimplyTimedMethod() {
}
 
Example #20
Source File: VisibilitySimplyTimedMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed
void packagePrivateSimplyTimedMethod() {
}
 
Example #21
Source File: VisibilitySimplyTimedMethodBean.java    From microprofile-metrics with Apache License 2.0 4 votes vote down vote up
@SimplyTimed
public void publicSimplyTimedMethod() {
}
 
Example #22
Source File: MetricsResource.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@GET
@Path("/simpletimer")
@SimplyTimed(name = "simple_timer_metric")
public String simpleTimer() {
    return "OK";
}
 
Example #23
Source File: MetricResolver.java    From smallrye-metrics with Apache License 2.0 4 votes vote down vote up
public Of<SimplyTimed> simplyTimed(BeanInfo bean, MemberInfo element) {
    return resolverOf(bean, element, SimplyTimed.class);
}
 
Example #24
Source File: Initialization_SimpleTimer_Method_Test.java    From smallrye-metrics with Apache License 2.0 2 votes vote down vote up
@SimplyTimed(name = "simplytimed_method", absolute = true)
public void timedMethod() {

}
 
Example #25
Source File: MetricAppBean2.java    From microprofile-metrics with Apache License 2.0 2 votes vote down vote up
@SimplyTimed(absolute = true, name = "simplyTimeMe2")
public void simplyTimeMeA() {

}
 
Example #26
Source File: MetricAppBean2.java    From microprofile-metrics with Apache License 2.0 2 votes vote down vote up
@SimplyTimed(absolute = true, name = "simplyTimeMe2")
public void simplyTimeMeB() {

}
 
Example #27
Source File: MetricAppBean.java    From microprofile-metrics with Apache License 2.0 2 votes vote down vote up
@SimplyTimed
public void simpleTimeMeA() {

}