diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/Counter.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/Counter.java index f63b74b1f0..410b9edec6 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/Counter.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/Counter.java @@ -48,7 +48,7 @@ default Iterable measure() { } @Override - default Type getType() { + default Type type() { return Type.Counter; } diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/FunctionCounter.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/FunctionCounter.java index 40a93fd0d5..74511f28b3 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/FunctionCounter.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/FunctionCounter.java @@ -37,7 +37,7 @@ default Iterable measure() { } @Override - default Meter.Type getType() { + default Meter.Type type() { return Meter.Type.Counter; } diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/Gauge.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/Gauge.java index 47b546f1f7..af55bd5488 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/Gauge.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/Gauge.java @@ -33,7 +33,7 @@ default Iterable measure() { } @Override - default Type getType() { + default Type type() { return Type.Gauge; } diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/LongTaskTimer.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/LongTaskTimer.java index 34ef329a45..b66e4871a3 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/LongTaskTimer.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/LongTaskTimer.java @@ -126,7 +126,7 @@ default Iterable measure() { } @Override - default Type getType() { + default Type type() { return Type.LongTaskTimer; } diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/Meter.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/Meter.java index 93ec0d73c8..241e8fdf1a 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/Meter.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/Meter.java @@ -39,7 +39,7 @@ public interface Meter { */ Iterable measure(); - default Type getType() { + default Type type() { return Type.Other; } @@ -63,11 +63,6 @@ class Id { private final List tags; private String baseUnit; private final String description; - - /** - * Set after this id has been bound to a specific meter, effectively precluding it from use by a meter of a - * different type. - */ private Type type; public Id(String name, Iterable tags, String baseUnit, String description, Type type) { @@ -144,15 +139,6 @@ public int hashCode() { return Objects.hash(name, tags); } - /** - * Associate this id with a specific type, sometimes used in the determination of a - * convention name. This association is 1-1 since an id can only be used once per registry - * across all types. - */ - public void setType(Meter.Type type) { - this.type = type; - } - public Type getType() { return type; } diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java index 43ba28ba8b..0834f13866 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java @@ -97,7 +97,7 @@ public double value() { } @Override - public TimeUnit getBaseTimeUnit() { + public TimeUnit baseTimeUnit() { return baseTimeUnit; } }; @@ -162,7 +162,7 @@ public Id getId() { } @Override - public Type getType() { + public Type type() { return type; } diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/TimeGauge.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/TimeGauge.java index 4086905d92..063f4b4595 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/TimeGauge.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/TimeGauge.java @@ -26,10 +26,10 @@ * @author Jon Schneider */ public interface TimeGauge extends Gauge { - TimeUnit getBaseTimeUnit(); + TimeUnit baseTimeUnit(); default double value(TimeUnit unit) { - return TimeUtils.convert(value(), getBaseTimeUnit(), unit); + return TimeUtils.convert(value(), baseTimeUnit(), unit); } static Builder builder(String name, T obj, TimeUnit fUnits, ToDoubleFunction f) { diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/Timer.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/Timer.java index 4ddd84981e..5455b2acf8 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/Timer.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/Timer.java @@ -129,7 +129,7 @@ default Iterable measure() { } @Override - default Type getType() { + default Type type() { return Type.Timer; } diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/composite/CompositeTimeGauge.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/composite/CompositeTimeGauge.java index 4ec25986ef..cb4e70581e 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/composite/CompositeTimeGauge.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/composite/CompositeTimeGauge.java @@ -42,8 +42,8 @@ public double value() { } @Override - public TimeUnit getBaseTimeUnit() { - return firstChild().getBaseTimeUnit(); + public TimeUnit baseTimeUnit() { + return firstChild().baseTimeUnit(); } @Override diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/internal/DefaultFunctionTimer.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/internal/DefaultFunctionTimer.java index 2c7346a35a..b3f64dcba5 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/internal/DefaultFunctionTimer.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/internal/DefaultFunctionTimer.java @@ -80,7 +80,7 @@ public TimeUnit baseTimeUnit() { return this.baseTimeUnit; } - public Type getType() { + public Type type() { return Type.Timer; } } diff --git a/micrometer-core/src/main/java/io/micrometer/core/instrument/noop/NoopTimeGauge.java b/micrometer-core/src/main/java/io/micrometer/core/instrument/noop/NoopTimeGauge.java index 34bb5ad335..cedb074a45 100644 --- a/micrometer-core/src/main/java/io/micrometer/core/instrument/noop/NoopTimeGauge.java +++ b/micrometer-core/src/main/java/io/micrometer/core/instrument/noop/NoopTimeGauge.java @@ -26,7 +26,7 @@ public NoopTimeGauge(Id id) { } @Override - public TimeUnit getBaseTimeUnit() { + public TimeUnit baseTimeUnit() { return TimeUnit.NANOSECONDS; }