You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by "Nick Allen (JIRA)" <ji...@apache.org> on 2017/08/29 14:38:00 UTC

[jira] [Created] (METRON-1138) Improve Error Message with Bad Profile Expression

Nick Allen created METRON-1138:
----------------------------------

             Summary: Improve Error Message with Bad Profile Expression
                 Key: METRON-1138
                 URL: https://issues.apache.org/jira/browse/METRON-1138
             Project: Metron
          Issue Type: Improvement
    Affects Versions: 0.4.0
            Reporter: Nick Allen
            Assignee: Nick Allen
             Fix For: 0.4.1


I have found that it can be very natural for a new Profiler user to attempt to reference a field defined in a telemetry message, in a Profile's `groupBy` expression.  Unfortunately, this does not work as the 'groupBy' expression runs during a flush and has no single telemetry message available in scope.  

For example, this seems like a Profile that should work.
{code}
{
      "profile": "calender-effects",
      "onlyif":  "exists(ip_src_addr) and exists(timestamp)",
      "foreach": "ip_src_addr",
      "init":    { "count": 0 },
      "update":  { "count": "count + 1" },
      "result":  "count",
      "groupBy": ["DAY_OF_WEEK(timestamp)"]
    }
{code}

Currently, when this expression fails the error message looks-like this, which is not exactly enlightening.

{code}
org.apache.metron.stellar.dsl.ParseException: Bad 'groupBy' expression: Unexpected type: expected=Object, actual=null, expression=DAY_OF_WEEK(timestamp), profile=calender-effects, entity=10.0.0.1 at org.apache.metron.profiler.ProfileBuilder.execute(ProfileBuilder.java:243) at org.apache.metron.profiler.ProfileBuilder.flush(ProfileBuilder.java:164) at org.apache.metron.profiler.bolt.ProfileBuilderBolt.lambda$handleTick$2(ProfileBuilderBolt.java:183) at java.util.concurrent.ConcurrentMap.forEach(ConcurrentMap.java:114) at org.apache.metron.profiler.bolt.ProfileBuilderBolt.handleTick(ProfileBuilderBolt.java:179) at org.apache.metron.profiler.bolt.ProfileBuilderBolt.execute(ProfileBuilderBolt.java:150) at org.apache.storm.daemon.executor$fn__6573$tuple_action_fn__6575.invoke(executor.clj:734) at org.apache.storm.daemon.executor$mk_task_receiver$fn__6494.invoke(executor.clj:469) at org.apache.storm.disruptor$clojure_handler$reify__6007.onEvent(disruptor.clj:40) at org.apache.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:451) at org.apache.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:430) at org.apache.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:73) at org.apache.storm.daemon.executor$fn__6573$fn__6586$fn__6639.invoke(executor.clj:853) at org.apache.storm.util$async_loop$fn__554.invoke(util.clj:484) at clojure.lang.AFn.run(AFn.java:22) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalArgumentException: Unexpected type: expected=Object, actual=null, expression=DAY_OF_WEEK(timestamp) at org.apache.metron.stellar.common.DefaultStellarStatefulExecutor.execute(DefaultStellarStatefulExecutor.java:128) at org.apache.metron.profiler.ProfileBuilder.lambda$execute$6(ProfileBuilder.java:239) at java.util.ArrayList.forEach(ArrayList.java:1249) at org.apache.metron.profiler.ProfileBuilder.execute(ProfileBuilder.java:239) ... 15 mo
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)