Skip to content

Commit

Permalink
[MGDSTRM-10786] Disable java-operator-sdk controller metrics by default
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Edgar <[email protected]>
  • Loading branch information
MikeEdgar committed Mar 9, 2023
1 parent 82402d8 commit de1b9ce
Showing 1 changed file with 24 additions and 0 deletions.
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
}
}

0 comments on commit de1b9ce

Please sign in to comment.