peachisai commented on code in PR #13119:
URL: https://github.com/apache/skywalking/pull/13119#discussion_r2003605577


##########
oap-server/server-receiver-plugin/otel-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/otel/otlp/OpenTelemetryMetricRequestProcessor.java:
##########
@@ -121,11 +121,24 @@ public void processMetricsRequest(final 
ExportMetricsServiceRequest requests) {
                                .flatMap(tryIt -> MetricConvert.log(tryIt, 
"Convert OTEL metric to prometheus metric"))
                            )
                 );
-                converters.forEach(convert -> convert.toMeter(sampleFamilies));
+
+                convertSampleFamiliesToMeter(sampleFamilies);
             });
         }
     }
 
+    private void convertSampleFamiliesToMeter(ImmutableMap<String, 
SampleFamily> sampleFamilies) {
+        if (sampleFamilies.isEmpty()) {
+            return;
+        }
+        SampleFamily firstValue = sampleFamilies.values().iterator().next();
+        for (MetricConvert converter : converters) {
+            if (converter.shouldConvert(firstValue)) {

Review Comment:
   Yes, you are right. I did not consider other logic that might not have the 
same value. I think I should just compare the ```job name``` label.



-- 
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...@skywalking.apache.org

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

Reply via email to