Skip to content

Commit fb76ba2

Browse files
committed
Add tags to annotations
1 parent b98d707 commit fb76ba2

File tree

7 files changed

+48
-6
lines changed

7 files changed

+48
-6
lines changed

metrics-annotation/src/main/java/io/dropwizard/metrics/annotation/CachedGauge.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,15 @@
3030
public @interface CachedGauge {
3131

3232
/**
33-
* @return The name of the counter.
33+
* @return The gauge's name.
3434
*/
3535
String name() default "";
3636

37+
/**
38+
* @return The gauge's tags.
39+
*/
40+
String[] tags() default {};
41+
3742
/**
3843
* @return If {@code true}, use the given name as an absolute name. If {@code false}, use the given name
3944
* relative to the annotated class.

metrics-annotation/src/main/java/io/dropwizard/metrics/annotation/Counted.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@
3131
public @interface Counted {
3232

3333
/**
34-
* @return The name of the counter.
34+
* @return The counter's name.
3535
*/
3636
String name() default "";
3737

38+
/**
39+
* @return The counter's tags.
40+
*/
41+
String[] tags() default {};
42+
3843
/**
3944
* @return If {@code true}, use the given name as an absolute name. If {@code false}, use the given name
4045
* relative to the annotated class. When annotating a class, this must be {@code false}.

metrics-annotation/src/main/java/io/dropwizard/metrics/annotation/ExceptionMetered.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@
4747
String DEFAULT_NAME_SUFFIX = "exceptions";
4848

4949
/**
50-
* @return The name of the meter. If not specified, the meter will be given a name based on the method
50+
* @return The meter's name. If not specified, the meter will be given a name based on the method
5151
* it decorates and the suffix "Exceptions".
5252
*/
5353
String name() default "";
5454

55+
/**
56+
* @return The meter's tags.
57+
*/
58+
String[] tags() default {};
59+
5560
/**
5661
* @return If {@code true}, use the given name as an absolute name. If {@code false}, use the given name
5762
* relative to the annotated class. When annotating a class, this must be {@code false}.
@@ -62,4 +67,5 @@
6267
* @return The type of exceptions that the meter will catch and count.
6368
*/
6469
Class<? extends Throwable> cause() default Exception.class;
70+
6571
}

metrics-annotation/src/main/java/io/dropwizard/metrics/annotation/Gauge.java

+7
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,21 @@
2222
@Retention(RetentionPolicy.RUNTIME)
2323
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
2424
public @interface Gauge {
25+
2526
/**
2627
* @return The gauge's name.
2728
*/
2829
String name() default "";
2930

31+
/**
32+
* @return The gauge's tags.
33+
*/
34+
String[] tags() default {};
35+
3036
/**
3137
* @return If {@code true}, use the given name as an absolute name. If {@code false}, use the given name
3238
* relative to the annotated class.
3339
*/
3440
boolean absolute() default false;
41+
3542
}

metrics-annotation/src/main/java/io/dropwizard/metrics/annotation/Metered.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,21 @@
2626
@Retention(RetentionPolicy.RUNTIME)
2727
@Target({ ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
2828
public @interface Metered {
29+
2930
/**
30-
* @return The name of the meter.
31+
* @return The meter's name.
3132
*/
3233
String name() default "";
3334

35+
/**
36+
* @return The meter's tags.
37+
*/
38+
String[] tags() default {};
39+
3440
/**
3541
* @return If {@code true}, use the given name as an absolute name. If {@code false}, use the given name
3642
* relative to the annotated class. When annotating a class, this must be {@code false}.
3743
*/
3844
boolean absolute() default false;
45+
3946
}

metrics-annotation/src/main/java/io/dropwizard/metrics/annotation/Metric.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,15 @@
5050
public @interface Metric {
5151

5252
/**
53-
* @return The name of the metric.
53+
* @return The metric's name.
5454
*/
5555
String name() default "";
5656

57+
/**
58+
* @return The metric's tags.
59+
*/
60+
String[] tags() default {};
61+
5762
/**
5863
* @return If {@code true}, use the given name as an absolute name. If {@code false},
5964
* use the given name relative to the annotated class.

metrics-annotation/src/main/java/io/dropwizard/metrics/annotation/Timed.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,21 @@
2626
@Retention(RetentionPolicy.RUNTIME)
2727
@Target({ ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
2828
public @interface Timed {
29+
2930
/**
30-
* @return The name of the timer.
31+
* @return The timer's name.
3132
*/
3233
String name() default "";
3334

35+
/**
36+
* @return The timer's tags.
37+
*/
38+
String[] tags() default {};
39+
3440
/**
3541
* @return If {@code true}, use the given name as an absolute name. If {@code false}, use the given name
3642
* relative to the annotated class. When annotating a class, this must be {@code false}.
3743
*/
3844
boolean absolute() default false;
45+
3946
}

0 commit comments

Comments
 (0)