Phillippko commented on code in PR #6105:
URL: https://github.com/apache/ignite-3/pull/6105#discussion_r2164264827


##########
modules/metrics-exporter-otlp/src/integrationTest/java/org/apache/ignite/internal/metrics/exporters/ItOtlpMetricsTest.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.metrics.exporters;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+import com.sun.net.httpserver.HttpServer;
+import java.net.InetSocketAddress;
+import org.apache.ignite.InitParametersBuilder;
+import org.apache.ignite.internal.ClusterPerTestIntegrationTest;
+import 
org.apache.ignite.internal.metrics.exporters.otlp.OtlpPushMetricExporter;
+import org.apache.ignite.internal.testframework.log4j2.LogInspector;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+
+/**
+ * Integration tests for OTLP metrics.
+ */
+public class ItOtlpMetricsTest extends ClusterPerTestIntegrationTest {
+    @Override
+    protected void customizeInitParameters(InitParametersBuilder builder) {
+        builder.clusterConfiguration(
+                "ignite.metrics.exporters.otlp = {"
+                        + "exporterName = otlp,"
+                        + "periodMillis = 1," // Small period is required to 
trigger possible races on node start.
+                        + "endpoint = \"http://localhost:4317\",";
+                        + "protocol = \"http/protobuf\"}"
+        );
+    }
+
+    private HttpServer server;
+
+    private final LogInspector logInspector = new LogInspector(
+            OtlpPushMetricExporter.class.getName(),
+            evt -> evt.getMessage().getFormattedMessage().contains("Metrics 
export error")
+    );
+
+    @BeforeEach
+    @Override
+    public void startCluster(TestInfo testInfo) throws Exception {
+        server = HttpServer.create(new InetSocketAddress(4317), 0);
+
+        server.createContext("/", exchange -> {
+            exchange.sendResponseHeaders(200, 0);
+            exchange.close();
+        });
+
+        server.start();
+
+        logInspector.start();
+
+        super.startCluster(testInfo);
+    }
+
+    @AfterEach
+    @Override
+    public void stopCluster() {
+        super.stopCluster();
+
+        logInspector.stop();
+
+        server.stop(0);
+    }
+
+    /**
+     * Tests that OTLP scheduled metrics are started on node start without any 
errors.
+     */
+    @Test
+    void otlpMetricsGetCorrectlyReported() {
+        assertFalse(logInspector.isMatched());

Review Comment:
   Is it possible to check that metrics are really started / reported? I assume 
this test would pass even if they didn't



##########
check-rules/spotbugs-excludes.xml:
##########
@@ -274,12 +274,6 @@
       <Field name="val"/>
     </Or>
   </Match>
-  <Match>

Review Comment:
   I didn't catch why it's not needed now if you didn't touch 
BasicMetricsExporter? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to