-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathExecutionTimeMetric.java
28 lines (22 loc) · 1.01 KB
/
ExecutionTimeMetric.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package software.amazon.cloudwatchlogs.emf.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This annotation is used to put a duration metric to CloudWatch Metrics. By default, when the
* annotated method is called, the duration (in milliseconds) will be published with the metric name
* "[ClassName].[methodName].Time". The metric name can be overridden, and the "applies" field can
* be used to only publish for invocations when failures are/aren't thrown by the annotated method.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Repeatable(ExecutionTimeMetrics.class)
public @interface ExecutionTimeMetric {
String name() default "";
boolean logSuccess() default true;
Class<? extends Throwable>[] logExceptions() default {Throwable.class};
String logger() default "_defaultLogger";
boolean flush() default false;
}