Github user JonZeolla commented on a diff in the pull request:

    https://github.com/apache/metron/pull/873#discussion_r157385625
  
    --- Diff: 
metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/StellarExecutor.java
 ---
    @@ -289,7 +293,25 @@ public Object execute(String expression) {
         VariableResolver variableResolver = new 
MapVariableResolver(Maps.transformValues(variables, result -> 
result.getResult())
                                                                    , 
Collections.emptyMap());
         StellarProcessor processor = new StellarProcessor();
    -    return processor.parse(expression, variableResolver, functionResolver, 
context);
    +    StackWatch watch = new StackWatch("execute");
    +    watch.startTime(expression);
    +    context.setWatch(watch);
    +    try {
    +      return processor.parse(expression, variableResolver, 
functionResolver, context);
    +    } finally {
    +      watch.stopTime();
    +      final StringBuffer buff = new StringBuffer();
    +      watch.visit(((level, node) -> {
    +        for (int i = 0; i < level; i++) {
    +          buff.append("-");
    +        }
    +        buff.append("->");
    +        buff.append(node.getName()).append(" : 
").append(node.getTime()).append("ms : ").
    +            append(node.getNanoTime()).append("ns").append("\n");
    +      }));
    +      lastTiming = Optional.of(buff.toString());
    +      context.clearWatch();
    +    }
    --- End diff --
    
    That makes sense, just looking to limit the effect here.


---

Reply via email to