none
measuring the rate, or changes in the rate, of specific events

    Question

  • I'm new to StreamInsight and not sure where to start with this business case.  Let's say that event A represents a click on a web advertisement.  Each click represents a new event.  What I want to display on a dashboard is the rate of clicks in x/t, or some configured number of clicks, x, per some configured time period, x.  For instance, I might not want to see a change in click rate of less than 100 clicks per second.  Vertical steps in my dashboard chart might, then, be 100 clicks per step.  If the rate goes down 100 clicks per second, my line chart drops by one vertical step.

    So I want to count events over time periods.  

    Can you provide some hints or keywords that will point me in the right direction so I can search it out?  

    Thanks,

    Dale

    Wednesday, October 16, 2013 5:35 AM

Answers

  • Hey Dale,

    There are a number of approaches you could take here.

    1. Use a count window with a time-sensitive User Defined Aggregate (UDA). Given your example, I would set my count window to be 100 events. Then in my UDA, I would take the number of events (100) and divide that by the duration of the window (start time minus end time). Then return that value.

    2. Use a hopping window with a time-sensitive UDA. The hopping window will be useful if you want to check the event rate at a set interval. Given your example, I would set my hopping window to be 1 second. Then with a UDA I would divide the number of events in the window by the duration of the window to get the event rate.

    3. The third way (and probably the way you want to do it) would be with snapshot windows. Given your example, I would extend the lifetime of each click event by 1 second and then with a snapshot window, count the number of events in the window.

    Take a look at Count WindowsHopping Windows and Snapshot Windows.

    • Marked as answer by Dale2K9 Wednesday, October 16, 2013 3:19 PM
    Wednesday, October 16, 2013 2:14 PM

All replies

  • Hey Dale,

    There are a number of approaches you could take here.

    1. Use a count window with a time-sensitive User Defined Aggregate (UDA). Given your example, I would set my count window to be 100 events. Then in my UDA, I would take the number of events (100) and divide that by the duration of the window (start time minus end time). Then return that value.

    2. Use a hopping window with a time-sensitive UDA. The hopping window will be useful if you want to check the event rate at a set interval. Given your example, I would set my hopping window to be 1 second. Then with a UDA I would divide the number of events in the window by the duration of the window to get the event rate.

    3. The third way (and probably the way you want to do it) would be with snapshot windows. Given your example, I would extend the lifetime of each click event by 1 second and then with a snapshot window, count the number of events in the window.

    Take a look at Count WindowsHopping Windows and Snapshot Windows.

    • Marked as answer by Dale2K9 Wednesday, October 16, 2013 3:19 PM
    Wednesday, October 16, 2013 2:14 PM
  • Thanks,, TXPower125.  That information will help.  Now I just have a lot of reading and trial and error.

    Wednesday, October 16, 2013 3:19 PM
  • This is more, I think, a function of your chart than anything else. Or ... you could do the rounding (which is what you are doing) either in the UI or the query.

    It sounds like a tumbling window is probably your best option. Tumbling windows give you an aggregate window per time period t every time period t. (It's really a hopping window with the same window and hop size.) The only thing is that you can't change the window size once the query is started so you'd have to know what the window size is when starting the query. This can be done several ways; you could even abstract it in the UI so that the user enters the desired window size and then you create the query from that. In this case, if you are using the 2.1 model, you'd publish the raw, data stream as a subject and then use that as your source for the user-defined query. Rather than installing full StreamInsight in the client app, you'd install the StreamInsight client, which will allow you to connect to a remote management service and create your queries. The only condition is that the user would also need to be in the StreamInsight users group for the instance.


    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    Wednesday, October 16, 2013 9:07 PM
    Moderator