-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MGDSTRM-10786] Disable java-operator-sdk controller metrics by default
Signed-off-by: Michael Edgar <[email protected]>
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
operator/src/main/java/org/bf2/operator/controllers/DisabledOperatorSdkMetrics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.bf2.operator.controllers; | ||
|
||
import io.javaoperatorsdk.operator.api.monitoring.Metrics; | ||
import io.micrometer.core.instrument.MeterRegistry; | ||
import io.micrometer.core.instrument.binder.MeterBinder; | ||
import io.quarkus.arc.properties.UnlessBuildProperty; | ||
|
||
import javax.inject.Singleton; | ||
|
||
/** | ||
* Implementation of the java-operator-sdk {@link Metrics} interface that does | ||
* will not add the SDK's reconcile/event metrics to the Micrometer registry. This | ||
* avoids a problem where the SDK's metrics accumulate and result in an OOM situation | ||
* during scraping of the `/metrics` end-point. | ||
*/ | ||
@Singleton | ||
@UnlessBuildProperty(name = "managedkafka.operator-sdk.default-metrics", stringValue = "true", enableIfMissing = true) | ||
public class DisabledOperatorSdkMetrics implements Metrics, MeterBinder { | ||
|
||
@Override | ||
public void bindTo(MeterRegistry meterRegistry) { | ||
// Do nothing with the registry | ||
} | ||
} |