Skip to content

Commit

Permalink
MP-metrics 2.1.0 integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Porocnik committed Jan 14, 2020
1 parent 16e278b commit a6d56af
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public long getCount() {
}
};
} else {
return (Gauge<Object>) ((com.codahale.metrics.Gauge) metric)::getValue;
return (Gauge<Number>) ((com.codahale.metrics.Gauge<Number>) metric)::getValue;
}
} else {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @author Aljaž Blažej
* @since 1.0.0
*/
public class ForwardingGauge implements Gauge {
public class ForwardingGauge implements Gauge<Number> {

private final Method method;

Expand All @@ -45,8 +45,8 @@ public ForwardingGauge(Method method, Object object) {
}

@Override
public Object getValue() {
return invokeMethod(method, object);
public Number getValue() {
return (Number) invokeMethod(method, object);
}

private static Object invokeMethod(Method method, Object object) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Histogram produceHistogram(InjectionPoint injectionPoint) {

@SuppressWarnings("unchecked")
@Produces
public <T> Gauge<T> produceGauge(InjectionPoint injectionPoint) {
public <T extends Number> Gauge<T> produceGauge(InjectionPoint injectionPoint) {
MetadataWithTags metadataWithTags = AnnotationMetadata.buildProducerMetadata(injectionPoint, MetricType.GAUGE);

return () -> (T) applicationRegistry.getGauges().get(metadataWithTags.getMetricID()).getValue();
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<kumuluzee.version>3.6.0</kumuluzee.version>
<kumuluzee-config-mp.version>1.3.0</kumuluzee-config-mp.version>

<microprofile-metrics.version>2.2.1</microprofile-metrics.version>
<microprofile-metrics.version>2.1.0</microprofile-metrics.version>
<dropwizard-metrics.version>4.1.0</dropwizard-metrics.version>
<jackson.version>2.9.9</jackson.version>

Expand Down

0 comments on commit a6d56af

Please sign in to comment.