How to Support Rewind

Viewpoint
Teradata Viewpoint is Teradata's strategic and innovative SOV (single operational view) for Teradata DB, Aster, and HDP Hadoop systems management and monitoring that enables Teradata's Unified Data Architecture (UDA).
Teradata Employee

How to Support Rewind

Rewind is a new feature in Teradata Viewpoint 13.0 that enables the user to move back in time to see what the portal looked like in the past. This is especially useful for investigating problems because the user can view the state of the system before, during, and after the problem occurred.

Should My Portlet Support Rewind?

Your portlet should support rewind if it displays time-based information. For example, monitoring portlets that show the current state of a system or application should support Rewind. Rewind is not applicable to a portlet that allows the user to type in queries and view the results.

What Do I Need to Do to Support Rewind?

Implement Refresh

The first step is to implement Refresh capability. See the topic Adding Dynamic Updates with AJAX for instructions.

View changes

Next, you need to enable Rewind using the vp:registerPortlet tag in your summary view. The four rewind parameters to this tag are:

  • supportsRewind - Set to 'true' to enable Rewind.
  • supportsOptOut - Set to 'true' to participate in Rewind by default.
  • rewindEventType - Set to 'FAST' if your portlet refreshes quickly (less than 1 second) or 'SLOW'.
  • rewindJoinType - Set to 'OPT-OUT'.

Here is an example from the MyQueries portlet:

<vp:registerPortlet
context='${context}'
dependencies='SessionController,TableController'
elementId='${context}_portlet'
refreshUrl='${refreshUrl}'
refreshExtraArguments='system,filterName'
refreshTarget='#${context}_portlet'
refreshInterval='30000'
supportsRefresh='true'
supportsManualRefresh='true'
supportsPause='true'
supportsRewind='true'
supportsOptOut='true'
rewindEventType='FAST'
rewindJoinType='OPT-OUT'
refreshResultType='SCRIPT' />

In addition, you need to include two other tags: vp:portletMenu and vp:timestamp. The portletMenu tag adds the refresh/pause/rewind menu to the portlet header bar and the timestamp tag sets the current time in the header bar.

Here is an example:

<vp:portletMenu context="${context}" />
<vp:timestamp context="${context}" time="${collectTime}"/>

This example assumes that the page attribute collectTime contains the current time. You'll see how to set this value next.

Controller changes

You normally use the same controller method to handle both Refresh and Rewind requests. You need to modify this controller to always get data for a specific time instead of getting only the most recent data.

There are two request parameters to look for in your controller:

  • rewinding - 'True' if this is a Rewind request; 'null' if it is a Refresh request.
  • timestamp - The time stamp set to the current database time for Refresh requests and to the rewind time for Rewind requests. It contain the number of milliseconds since Jan 1, 1970. The rewind time is the time currently displayed in the rewind bar:

In addition to collecting the correct data, the controller also needs to provide data for the vp:timestamp tag. The timestamp tag should always be given the time stamp for the data being displayed. In most cases this is the time stamp passed to the controller method in the browser request. The following code is an example of how to set the data for the timestamp tag.

public void summary(ControllerContext ctx)
{
String timestamp = ctx.getParameter("timestamp");
ctx.addViewObject("collectTime", timestamp);
// get portlet data for timestamp
}