Skip to content

Commit

Permalink
Removing Field Target for @Gauge, it is not supported by metrics-cdi :(
Browse files Browse the repository at this point in the history
Signed-off-by: Raymond Lam <lamr@ca.ibm.com>
  • Loading branch information
raymondlam committed Sep 11, 2017
1 parent 5323d51 commit f221225
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
Expand Up @@ -58,7 +58,7 @@
*/
@InterceptorBinding
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
public @interface Gauge {

/**
Expand Down
21 changes: 5 additions & 16 deletions spec/src/main/asciidoc/metrics_spec.adoc
Expand Up @@ -1079,7 +1079,7 @@ The following Annotations exist, see below for common fields:
|Annotation | Applies to | Description | Default Unit

|@Counted | M, C, T | Denotes a counter, which counts the invocations of the annotated object. | MetricUnits.NONE
|@Gauge | M, F | Denotes a gauge, which samples the value of the annotated object. | _none_ Must be supplied by the user
|@Gauge | M | Denotes a gauge, which samples the value of the annotated object. | _none_ Must be supplied by the user
|@Metered | M, C, T | Denotes a meter, which tracks the frequency of invocations of the annotated object. | MetricUnits.PER_SECOND
|@Metric | M, F, P | An annotation requesting that a metric should be injected. This annotation can be used on the fields
of type `Meter`, `Timer`, `Counter`, and `Histogram`. | MetricUnits.NONE
Expand Down Expand Up @@ -1207,27 +1207,15 @@ public class CounterBean {
----

==== @Gauge
An annotation for marking a method or field as a gauge.
An annotation for marking a method as a gauge.

The implementation must support the following annotation targets:
The implementation must support the following annotation target:

* `FIELD`
* `METHOD`


The following lists the behavior for each annotation target.

===== FIELD

When a field is annotated, the implementation must register a gauge for the field using the <<annotated-naming-convention>>. The gauge value and type is equal to the annotated field value and type.

.Example of an annotated field
[source, java]
----
@Gauge
long value;
----

===== METHOD

When a method is annotated, the implementation must register a gauge for the method using the <<annotated-naming-convention>>. The gauge value and type is equal to the annotated method return value and type.
Expand Down Expand Up @@ -1346,7 +1334,7 @@ public class TimedBean {

==== @Metric

An annotation requesting that a metric should be injected or registered. This annotation can be used on the fields of type `Meter`, `Timer`, `Counter`, and `Histogram`.
An annotation requesting that a metric should be injected or registered.

The implementation must support the following annotation targets:

Expand Down Expand Up @@ -1375,6 +1363,7 @@ Gauge<Double> hitPercentage = new Gauge<Double>() {
----

When a metric injected field is annotated, the implementation must provide the registered metric with the given name (using the <<annotated-naming-convention>>) if the metric already exist. If no metric exists with the given name then the implementation must produce and register the requested metric.
`@Metric` can only be used on injected fields of type `Meter`, `Timer`, `Counter`, and `Histogram`.

.Example of an injected field
[source, java]
Expand Down

0 comments on commit f221225

Please sign in to comment.