Showing Edge Shaped Event Duration in StreamInsight using Debugger

by Allan Mitchell 29 Dec 2010 15:54

Whilst writing some courseware I wanted to be able to see the start and end times of Edge shaped events from within the debugger.  A quick recap on Edge events

  • At the start of the event you do not know the end time and most probably cannot work it out or you should be using one of the other shapes.
  • You enqueue an event (Start Edge) with the start time and payload of the event.  The end time of the event is set to infinity
  • When you see the end edge come through, you enqueue another event (End Edge) with the previous start time and payload and restate the event’s end time.  This is the Retract Event

All seems simple enough.  The problem is the debugger is a little shy about showing you what you need but you can get it to show you everything by also reading this article

Here’s what I mean.

Here is what the Event Debugger looks like by default when viewing 2 complete edge events.  Notice how all the end times are set to infinity

EdgesNoHelp

 

The above does not tell you for how long an event was valid. 

I then add the “NewEndTime” column to the debugger output and there I can now see the duration of events.  You will see the Retract events (End Edge) have the same start time and payload as their respective start events (Start Edge)

 

EdgesWithHelp

You can follow the exact same logic when looking at Interval shape events.  They look a little different on the output adapter but using this article you can easily see what is happening.

Comments are closed