Skip to content

Commit 51f54c0

Browse files
committed
Add javadoc to isEnabled method
1 parent 51c8d75 commit 51f54c0

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,26 @@ default boolean checkBinderEnabledWithDefault(CapabilityEnabled config) {
7676
return false;
7777
}
7878

79+
/**
80+
* Determines if a capability is enabled based on the {@link MicrometerConfig} configurations and the following rules:
81+
* <p>
82+
* <ul>
83+
* <li>
84+
* The {@link MicrometerConfig#enabled()} has precedence over all configurations, it means that if <code>quarkus.micrometer.enabled</code>
85+
* is set to <code>false</code>, all metrics are disabled.
86+
* </li>
87+
* <li>
88+
* If the <code>quarkus.micrometer.binder.enable-all</code> is set to <code>true</code>, independently if the
89+
* parameter <code>aBoolean</code> resolve to <code>true</code> or <code>false</code> the metric will be enabled.
90+
* </li>
91+
* <li>
92+
* If the <code>quarkus.micrometer.binder.enable-all</code> is set to <code>false</code>, the parameter <code>aBoolean</code>
93+
* will be used to determine if the metric is enabled or not. If <code>aBoolean</code> is empty, the metric will be disabled.
94+
* </li>
95+
* </ul>
96+
* @param aBoolean the optional boolean value to check if the capability is enabled
97+
* @return <code>true</code> if the capability is enabled, <code>false</code> otherwise.
98+
*/
7999
default boolean isEnabled(Optional<Boolean> aBoolean) {
80100
if (enabled()) {
81101
if (this.binder().enableAll()) {
@@ -88,6 +108,27 @@ default boolean isEnabled(Optional<Boolean> aBoolean) {
88108
return false;
89109
}
90110

111+
/**
112+
* Determines if a capability is enabled based on the {@link MicrometerConfig} configurations and the following rules:
113+
* <p>
114+
* <ul>
115+
* <li>
116+
* The {@link MicrometerConfig#enabled()} has precedence over all configurations, it means that if <code>quarkus.micrometer.enabled</code>
117+
* is set to <code>false</code>, all metrics are disabled.
118+
* </li>
119+
* <li>
120+
* If the <code>quarkus.micrometer.binder.enable-all</code> is set to <code>true</code>, independently if the
121+
* parameter <code>aBoolean</code> resolve to <code>true</code> or <code>false</code> the metric will be enabled.
122+
* </li>
123+
* <li>
124+
* If the <code>quarkus.micrometer.binder.enable-all</code> is set to <code>false</code>, the parameter <code>config</code>
125+
* will be used to determine if the metric is enabled or not. If <code>config.enabled()</code> is empty, the
126+
* {@link MicrometerConfig#binderEnabledDefault()} will be used to determine if the metric is enabled or not.
127+
* </li>
128+
* </ul>
129+
* @param config the {@link CapabilityEnabled} to check if the capability is enabled
130+
* @return <code>true</code> if the capability is enabled, <code>false</code> otherwise.
131+
*/
91132
default boolean isEnabled(CapabilityEnabled config) {
92133
if (enabled()) {
93134
if (this.binder().enableAll()) {

0 commit comments

Comments
 (0)