wu-sheng commented on code in PR #13119:
URL: https://github.com/apache/skywalking/pull/13119#discussion_r2003611526
##########
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:
As it is a closure, how would you make sure of that? Are you going to
provide a new function rather than a general closure?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]