wu-sheng commented on code in PR #13119:
URL: https://github.com/apache/skywalking/pull/13119#discussion_r2003471314
##########
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:
How we could make sure the first value is enough to filter the data? As the
filter is a closure, we don't know what is logic would be placed in there,
right?
##########
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:
How we could make sure the first value is enough to filter the data? As the
filter is a closure, we don't know what logic would be placed in there, right?
--
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]