use of io.strimzi.operator.common.MetricsProvider in project strimzi by strimzi.
the class ConnectorMockTest method setup.
@SuppressWarnings({ "checkstyle:MethodLength" })
@BeforeEach
public void setup(VertxTestContext testContext) {
vertx = Vertx.vertx();
// Configure the Kubernetes Mock
mockKube = new MockKube2.MockKube2Builder(client).withKafkaConnectCrd().withKafkaConnectorCrd().withDeploymentController().build();
mockKube.start();
PlatformFeaturesAvailability pfa = new PlatformFeaturesAvailability(false, KubernetesVersion.V1_18);
setupMockConnectAPI();
metricsProvider = ResourceUtils.metricsProvider();
ResourceOperatorSupplier ros = new ResourceOperatorSupplier(vertx, client, new ZookeeperLeaderFinder(vertx, // Retry up to 3 times (4 attempts), with overall max delay of 35000ms
() -> new BackOff(5_000, 2, 4)), new DefaultAdminClientProvider(), new DefaultZookeeperScalerProvider(), metricsProvider, pfa, 10_000);
ClusterOperatorConfig config = ClusterOperatorConfig.fromMap(map(ClusterOperatorConfig.STRIMZI_KAFKA_IMAGES, KafkaVersionTestUtils.getKafkaImagesEnvVarString(), ClusterOperatorConfig.STRIMZI_KAFKA_CONNECT_IMAGES, KafkaVersionTestUtils.getKafkaConnectImagesEnvVarString(), ClusterOperatorConfig.STRIMZI_KAFKA_MIRROR_MAKER_2_IMAGES, KafkaVersionTestUtils.getKafkaMirrorMaker2ImagesEnvVarString(), ClusterOperatorConfig.STRIMZI_FULL_RECONCILIATION_INTERVAL_MS, Long.toString(Long.MAX_VALUE)), KafkaVersionTestUtils.getKafkaVersionLookup());
kafkaConnectOperator = spy(new KafkaConnectAssemblyOperator(vertx, pfa, ros, config, x -> api));
Checkpoint async = testContext.checkpoint();
// Fail test if watcher closes for any reason
kafkaConnectOperator.createWatch(NAMESPACE, e -> testContext.failNow(e)).onComplete(testContext.succeeding()).compose(watch -> {
connectWatch = watch;
return AbstractConnectOperator.createConnectorWatch(kafkaConnectOperator, NAMESPACE, null);
}).compose(watch -> {
connectorWatch = watch;
// async.flag();
return Future.succeededFuture();
}).onComplete(testContext.succeeding(v -> async.flag()));
}
use of io.strimzi.operator.common.MetricsProvider in project strimzi by strimzi.
the class TopicOperatorTest method createCleanMetricsProvider.
/**
* Created new MetricsProvider and makes sure it doesn't contain any metrics from previous tests.
*
* @return Clean MetricsProvider
*/
public MetricsProvider createCleanMetricsProvider() {
MetricsProvider metrics = new MicrometerMetricsProvider();
MeterRegistry registry = metrics.meterRegistry();
registry.forEachMeter(meter -> {
registry.remove(meter);
});
return metrics;
}
use of io.strimzi.operator.common.MetricsProvider in project strimzi-kafka-operator by strimzi.
the class TopicOperatorTest method createCleanMetricsProvider.
/**
* Created new MetricsProvider and makes sure it doesn't contain any metrics from previous tests.
*
* @return Clean MetricsProvider
*/
public MetricsProvider createCleanMetricsProvider() {
MetricsProvider metrics = new MicrometerMetricsProvider();
MeterRegistry registry = metrics.meterRegistry();
registry.forEachMeter(meter -> {
registry.remove(meter);
});
return metrics;
}
Aggregations