Uploaded image for project: 'Camunda Optimize'
  1. Camunda Optimize
  2. OPT-6119

Adjust scripts in report aggregations to be null safe for idle and work duration fields

XMLWordPrintable

    • Not defined

      Context:

      In a recent support case, we have observed completed userTasks within process instances where the idle and work duration fields were null. While in the case of the support ticket this was likely not a problem created by Optimize, it is still possible that those fields are temporarily null if a userTask has been completed (not cancelled) and not yet been imported by the CompletedUserTaskWriter but only by our CompletedActivityWriter which does not calculate the idle and work durations if the task was not cancelled. 

      This can temporarily lead to issues during report creation of userTask reports for idle or work time. While this is only temporary and shouldn't occur very often, we should still adjust our scripts to ensure they are null safe when it comes to the idle and work duration fields.

       

      method [POST], host [http://localhost:9200], URI [/optimize-process-instance-invoice/_search?typed_keys=true&max_concurrent_shard_requests=5&search_type=query_then_fetch&batched_reduce_size=512], status line [HTTP/1.1 400 Bad Request]
      {"error":{"root_cause":[{"type":"script_exception","reason":"runtime error","script_stack":["org.elasticsearch.index.fielddata.ScriptDocValues$Longs.get(ScriptDocValues.java:121)","org.elasticsearch.index.fielddata.ScriptDocValues$Longs.getValue(ScriptDocValues.java:115)","result = doc[params.idleDurationFieldName].value;}\nelse {\ndef ","                                          ^---- HERE"],"script":"def result = 0; ...","lang":"painless","position":{"offset":1261,"start":1219,"end":1281}}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"optimize-process-instance-invoice_v8","node":"T7_BTKL7S9u8SZ_vC-YaDw","reason":{"type":"script_exception","reason":"runtime error","script_stack":["org.elasticsearch.index.fielddata.ScriptDocValues$Longs.get(ScriptDocValues.java:121)","org.elasticsearch.index.fielddata.ScriptDocValues$Longs.getValue(ScriptDocValues.java:115)","result = doc[params.idleDurationFieldName].value;}\nelse {\ndef ","                                          ^---- HERE"],"script":"def result = 0; ...","lang":"painless","position":{"offset":1261,"start":1219,"end":1281},"caused_by":{"type":"illegal_state_exception","reason":"A document doesn't have a value for a field! Use doc[<field>].size()==0 to check if a document is missing a field!"}}}]},"status":400} 

      AT:

      • Idle and work duration fields are assumed to be nullable in aggregation scripts to avoid above described issue

       

        This is the controller panel for Smart Panels app

              Unassigned Unassigned
              helene.waechtler Helene Waechtler
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: