You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/07/04 00:12:10 UTC

[GitHub] [skywalking] hanahmily commented on a diff in pull request #9299: Add `forEach`, `processRelation` function to MAL Expression, and add `expPrefix` in MAL config

hanahmily commented on code in PR #9299:
URL: https://github.com/apache/skywalking/pull/9299#discussion_r912555355


##########
oap-server/analyzer/meter-analyzer/src/main/java/org/apache/skywalking/oap/meter/analyzer/dsl/SampleFamily.java:
##########
@@ -497,6 +501,38 @@ public SampleFamily serviceRelation(DetectPoint detectPoint, List<String> source
         return createMeterSamples(new ServiceRelationEntityDescription(sourceServiceKeys, destServiceKeys, detectPoint, layer, Const.POINT));
     }
 
+    public SampleFamily forEach(List<String> array, Closure<Void> each) {

Review Comment:
    
   It's safe to iterate a static array concurrently. But `foreach` is a rare operation in streaming/functional style language. How about picking up [map](https://en.wikipedia.org/wiki/Map_(higher-order_function)) instead? We could pass each sample into the closure to update both values and labels. That seems a more resilient function. 



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

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