3 Replies Latest reply on Apr 10, 2017 6:43 AM by mnudel RSS
    mnudel Explorer

    Issues with alert acknowledgement and alert history

    Hello all, earlier I asked a question about Alert History and it was confirmed that if I want to acknowledge multiple alerts (>10) on a "thing" entity, "AlertHistory" stream would not be able to capture that Choosing the most appropriate data storage method. Can anyone suggest a way around this problem? The only solution I can come up with is to use a data table instead. However, the question arises how to generate a unique key for each entry from each "thing" (concurrency problem). Thank you for your suggestions!

      • Re: Issues with alert acknowledgement and alert history
        Ankit Gupta Ninja

        mnudel,

         

        I am not sure if I understand your query completely. But did you try to add a delay in acknowledging the alert?

          • Re: Issues with alert acknowledgement and alert history
            mnudel Explorer

            Ankit Gupta, to put it simply, if I run a for-loop on a "thing" to acknowledge several alerts, only one or two will be written to "AlarmsHistory" stream. The reason being is that the for-loop will complete its cycle in less than 1 ms, meaning that all alerts processed by the for-loop will share the same timestamp. In turn, this will overwrite records in the "AlertHistory" stream. Can you suggest a way a safe way of introducing 1 ms delay? There is also a chance that another alert maybe acknowledged on another "thing" during same millisecond. Thanks.

             

            You may ask why would you like to do that?! In our application machine alarms are mapped to alerts. No intervention from the users' point of view is required, just visibility. So, if a number of Boolean properties become 'true', corresponding alerts are raised. On 'false' condition, alerts are automatically acknowledged. The reason behind such approach was to utilise various ThingWorx alert services.

          • Re: Issues with alert acknowledgement and alert history
            mnudel Explorer

            Having exhausted all my options available, I've decided to use the pause() function as suggested by Carles Coll in Re: Asyncronous Streams and Delayed Calculations Execution?

             

            pause(1); //wait 1 ms

            //acknowledge alert

             

            This way entries in "AlertHistory" stream are populated correctly with a different timestamp. Not sure though how it will affect the performance. There not as many machines as described in the above post and alerts should be a rare occasion.