You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2022/01/10 15:36:46 UTC

[GitHub] [incubator-eventmesh] ruanwenjun opened a new pull request #709: [ISSUE #696] Improve metrics exporters' expandability

ruanwenjun opened a new pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709


   1. Add Metrics plugin module
   2. Implement opentelemetry metrics module
   
   related issue #696
   
   ### Modifications
   
   Add metrics-api module, if user want to add other metrics exporter, they only need to add a new plugin, and implement with MetricsRegistry.java.
   
   


-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on a change in pull request #709: [ISSUE #696] Add metrics plugin

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on a change in pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#discussion_r783188962



##########
File path: eventmesh-metrics-plugin/eventmesh-metrics-opentelemetry/build.gradle
##########
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+dependencies {
+    implementation project(":eventmesh-metrics-plugin:eventmesh-metrics-api")
+    implementation project(":eventmesh-common")
+    implementation 'org.slf4j:slf4j-api'
+    implementation 'org.apache.commons:commons-lang3'
+    implementation 'com.google.guava:guava'
+
+    // todo:Can we remove some dependency?

Review comment:
       This need to discuss, currently we use opentelemetry to export metrics, but we actually are using prometheus to export metrics. So the opentelemetry dependencied is not required, we may only need to use prometheus.




-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on a change in pull request #709: [ISSUE #696] Improve metrics exporters' expandability

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on a change in pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#discussion_r782930149



##########
File path: eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java
##########
@@ -166,14 +164,22 @@ public void init() {
             String eventMeshTraceExportZipkinIpStr =
                     configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_IP);
             Preconditions.checkState(StringUtils.isNotEmpty(eventMeshTraceExportZipkinIpStr),
-                    String.format("%s error", ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_IP));
+                String.format("%s error", ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_IP));
             eventMeshTraceExportZipkinIp = StringUtils.deleteWhitespace(eventMeshTraceExportZipkinIpStr);
 
             String eventMeshTraceExportZipkinPortStr =
-                    configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_PORT);
+                configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_PORT);
             if (StringUtils.isNotEmpty(eventMeshTraceExportZipkinPortStr)) {
                 eventMeshTraceExportZipkinPort =
-                        Integer.parseInt(StringUtils.deleteWhitespace(eventMeshTraceExportZipkinPortStr));
+                    Integer.parseInt(StringUtils.deleteWhitespace(eventMeshTraceExportZipkinPortStr));
+            }
+
+            String metricsPluginType = configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_METRICS_PLUGIN_TYPE);
+            if (StringUtils.isNotEmpty(metricsPluginType)) {
+                eventMeshMetricsPluginType = Arrays.stream(metricsPluginType.split(","))

Review comment:
       Some situalitions may require the use of multiple metrics plugins, so use List here.




-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] xwm1992 commented on a change in pull request #709: [ISSUE #696] Improve metrics exporters' expandability

Posted by GitBox <gi...@apache.org>.
xwm1992 commented on a change in pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#discussion_r782822547



##########
File path: eventmesh-metrics-plugin/eventmesh-metrics-api/src/main/java/org/apache/eventmesh/metrics/api/model/Metric.java
##########
@@ -15,20 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.runtime.metrics.http;
+package org.apache.eventmesh.metrics.api.model;
 
-import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
-
-import com.codahale.metrics.MetricRegistry;
-
-public class GroupMetrics {
-
-    private EventMeshHTTPServer eventMeshHTTPServer;
-
-    private MetricRegistry metricRegistry;
-
-    public GroupMetrics(EventMeshHTTPServer eventMeshHTTPServer, MetricRegistry metricRegistry) {
-        this.eventMeshHTTPServer = eventMeshHTTPServer;
-        this.metricRegistry = metricRegistry;
-    }
+/**
+ * Top-level metric, all metrics should implement this interface.
+ */
+public interface Metric {

Review comment:
       May be abstract class is more convenient.

##########
File path: eventmesh-metrics-plugin/eventmesh-metrics-opentelemetry/src/main/java/org/apache/eventmesh/metrics/opentelemetry/OpenTelemetryMetricsRegistry.java
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.eventmesh.metrics.opentelemetry;
+
+import org.apache.eventmesh.metrics.api.MetricsRegistry;
+import org.apache.eventmesh.metrics.api.model.HttpSummaryMetrics;
+import org.apache.eventmesh.metrics.api.model.Metric;
+import org.apache.eventmesh.metrics.api.model.TcpSummaryMetrics;
+import org.apache.eventmesh.metrics.opentelemetry.metrics.OpenTelemetryHttpExporter;
+import org.apache.eventmesh.metrics.opentelemetry.metrics.OpenTelemetryTcpExporter;
+
+import java.io.IOException;
+
+import io.opentelemetry.exporter.prometheus.PrometheusCollector;
+import io.opentelemetry.sdk.metrics.SdkMeterProvider;
+import io.prometheus.client.exporter.HTTPServer;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class OpenTelemetryMetricsRegistry implements MetricsRegistry {
+
+    private volatile HTTPServer prometheusHttpServer;
+
+    @Override
+    public void start() {
+        if (prometheusHttpServer == null) {
+            synchronized (OpenTelemetryMetricsRegistry.class) {
+                if (prometheusHttpServer == null) {
+                    SdkMeterProvider sdkMeterProvider = SdkMeterProvider.builder().buildAndRegisterGlobal();
+                    PrometheusCollector
+                        .builder().setMetricProducer(sdkMeterProvider).buildAndRegister();
+                    // todo:
+                    int port = 0;

Review comment:
       Here isn't correct, right?

##########
File path: eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java
##########
@@ -166,14 +164,22 @@ public void init() {
             String eventMeshTraceExportZipkinIpStr =
                     configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_IP);
             Preconditions.checkState(StringUtils.isNotEmpty(eventMeshTraceExportZipkinIpStr),
-                    String.format("%s error", ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_IP));
+                String.format("%s error", ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_IP));
             eventMeshTraceExportZipkinIp = StringUtils.deleteWhitespace(eventMeshTraceExportZipkinIpStr);
 
             String eventMeshTraceExportZipkinPortStr =
-                    configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_PORT);
+                configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_PORT);
             if (StringUtils.isNotEmpty(eventMeshTraceExportZipkinPortStr)) {
                 eventMeshTraceExportZipkinPort =
-                        Integer.parseInt(StringUtils.deleteWhitespace(eventMeshTraceExportZipkinPortStr));
+                    Integer.parseInt(StringUtils.deleteWhitespace(eventMeshTraceExportZipkinPortStr));
+            }
+
+            String metricsPluginType = configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_METRICS_PLUGIN_TYPE);
+            if (StringUtils.isNotEmpty(metricsPluginType)) {
+                eventMeshMetricsPluginType = Arrays.stream(metricsPluginType.split(","))

Review comment:
       why are arrays used here?




-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] xwm1992 merged pull request #709: [ISSUE #696] Add metrics plugin

Posted by GitBox <gi...@apache.org>.
xwm1992 merged pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709


   


-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] Roc-00 commented on pull request #709: [ISSUE #696] Add metrics plugin

Posted by GitBox <gi...@apache.org>.
Roc-00 commented on pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#issuecomment-1011039125


   LGTM


-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on a change in pull request #709: [ISSUE #696] Improve metrics exporters' expandability

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on a change in pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#discussion_r782931334



##########
File path: eventmesh-metrics-plugin/eventmesh-metrics-api/src/main/java/org/apache/eventmesh/metrics/api/model/Metric.java
##########
@@ -15,20 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.runtime.metrics.http;
+package org.apache.eventmesh.metrics.api.model;
 
-import org.apache.eventmesh.runtime.boot.EventMeshHTTPServer;
-
-import com.codahale.metrics.MetricRegistry;
-
-public class GroupMetrics {
-
-    private EventMeshHTTPServer eventMeshHTTPServer;
-
-    private MetricRegistry metricRegistry;
-
-    public GroupMetrics(EventMeshHTTPServer eventMeshHTTPServer, MetricRegistry metricRegistry) {
-        this.eventMeshHTTPServer = eventMeshHTTPServer;
-        this.metricRegistry = metricRegistry;
-    }
+/**
+ * Top-level metric, all metrics should implement this interface.
+ */
+public interface Metric {

Review comment:
       I suggest to use interface here, this class is just as a tag.




-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] xwm1992 commented on a change in pull request #709: [ISSUE #696] Add metrics plugin

Posted by GitBox <gi...@apache.org>.
xwm1992 commented on a change in pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#discussion_r783123077



##########
File path: eventmesh-metrics-plugin/eventmesh-metrics-opentelemetry/build.gradle
##########
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+dependencies {
+    implementation project(":eventmesh-metrics-plugin:eventmesh-metrics-api")
+    implementation project(":eventmesh-common")
+    implementation 'org.slf4j:slf4j-api'
+    implementation 'org.apache.commons:commons-lang3'
+    implementation 'com.google.guava:guava'
+
+    // todo:Can we remove some dependency?

Review comment:
       Is this need to discuss or just remove it?




-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on pull request #709: [ISSUE #696] Improve metrics exporters' expandability

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#issuecomment-1009006702


   @xwm1992 @Roc-00 Take a look if you are interested in.


-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on pull request #709: [ISSUE #696] Improve metrics exporters' expandability

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#issuecomment-1010665514


   > Will trace have another plugin too?
   
   No yet, the trace code is still in runtime module now.
   
   The current trace implementation is using API to export. I think a better way is using java agent to do this work, so EventMesh don't need to export trace in code. This may need to discuss.
   
   If we also want to provide SPI trace, we can design the trace plugin interface, but I think this can be another PR.


-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] qqeasonchen commented on pull request #709: [ISSUE #696] Improve metrics exporters' expandability

Posted by GitBox <gi...@apache.org>.
qqeasonchen commented on pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#issuecomment-1010578478


   Will trace have another plugin too?


-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on a change in pull request #709: [ISSUE #696] Improve metrics exporters' expandability

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on a change in pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#discussion_r782930149



##########
File path: eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java
##########
@@ -166,14 +164,22 @@ public void init() {
             String eventMeshTraceExportZipkinIpStr =
                     configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_IP);
             Preconditions.checkState(StringUtils.isNotEmpty(eventMeshTraceExportZipkinIpStr),
-                    String.format("%s error", ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_IP));
+                String.format("%s error", ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_IP));
             eventMeshTraceExportZipkinIp = StringUtils.deleteWhitespace(eventMeshTraceExportZipkinIpStr);
 
             String eventMeshTraceExportZipkinPortStr =
-                    configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_PORT);
+                configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_TRACE_EXPORT_ZIPKIN_PORT);
             if (StringUtils.isNotEmpty(eventMeshTraceExportZipkinPortStr)) {
                 eventMeshTraceExportZipkinPort =
-                        Integer.parseInt(StringUtils.deleteWhitespace(eventMeshTraceExportZipkinPortStr));
+                    Integer.parseInt(StringUtils.deleteWhitespace(eventMeshTraceExportZipkinPortStr));
+            }
+
+            String metricsPluginType = configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_METRICS_PLUGIN_TYPE);
+            if (StringUtils.isNotEmpty(metricsPluginType)) {
+                eventMeshMetricsPluginType = Arrays.stream(metricsPluginType.split(","))

Review comment:
       Some situations may require the use of multiple metrics plugins, so use List here.




-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] ruanwenjun commented on a change in pull request #709: [ISSUE #696] Improve metrics exporters' expandability

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on a change in pull request #709:
URL: https://github.com/apache/incubator-eventmesh/pull/709#discussion_r782960056



##########
File path: eventmesh-metrics-plugin/eventmesh-metrics-opentelemetry/src/main/java/org/apache/eventmesh/metrics/opentelemetry/OpenTelemetryMetricsRegistry.java
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.eventmesh.metrics.opentelemetry;
+
+import org.apache.eventmesh.metrics.api.MetricsRegistry;
+import org.apache.eventmesh.metrics.api.model.HttpSummaryMetrics;
+import org.apache.eventmesh.metrics.api.model.Metric;
+import org.apache.eventmesh.metrics.api.model.TcpSummaryMetrics;
+import org.apache.eventmesh.metrics.opentelemetry.metrics.OpenTelemetryHttpExporter;
+import org.apache.eventmesh.metrics.opentelemetry.metrics.OpenTelemetryTcpExporter;
+
+import java.io.IOException;
+
+import io.opentelemetry.exporter.prometheus.PrometheusCollector;
+import io.opentelemetry.sdk.metrics.SdkMeterProvider;
+import io.prometheus.client.exporter.HTTPServer;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class OpenTelemetryMetricsRegistry implements MetricsRegistry {
+
+    private volatile HTTPServer prometheusHttpServer;
+
+    @Override
+    public void start() {
+        if (prometheusHttpServer == null) {
+            synchronized (OpenTelemetryMetricsRegistry.class) {
+                if (prometheusHttpServer == null) {
+                    SdkMeterProvider sdkMeterProvider = SdkMeterProvider.builder().buildAndRegisterGlobal();
+                    PrometheusCollector
+                        .builder().setMetricProducer(sdkMeterProvider).buildAndRegister();
+                    // todo:
+                    int port = 0;

Review comment:
       Yes, you are right, I have modified this.




-- 
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: dev-unsubscribe@eventmesh.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org