vADC Docs

Finding a needle in your haystack, using the connection.getCompletionReasonCode() and connection.getCompletionReasonInfo() functions for diagnostics analysis.

by pwallace_1 on ‎09-22-2014 05:40 AM - edited on ‎07-14-2015 01:50 PM by PaulWallace (747 Views)

SteelApp includes some great tools for graphical analysis, and for drilling down into the details of individual transaction connections. But when you are trying to debug high-throughput production applications, the number of connections in the log history can make it very difficult to trace and identify critical transactions on the Activity > Connections GUI on the user interface.

 

STM-Connections.png

 

Although you can use the “Filter” option to track down particular types of transaction, there is now a new way to include or exclude just the transactions you want to be stored in the connection history!

 

From SteelApp Traffic Manager 9.8, TrafficScript includes two new functions connection.getCompletionReasonCode() and connection.getCompletionReasonInfo() which are designed to be used in transaction completion rules to give information about why a transaction ended. For example, it might have completed normally, or it might have timed out, or there may even have been a client or server error.

 

By using these two functions to identify specific transaction faults, you can use recentconns.include() and recentconns.exclude() to save only the trace information for connections that encountered problems that need further analysis: these two functions allow close control of which transactions should be retained, which means that the Activity > Connections page will only show the transactions you specifically wanted to trace.

 

connection.getCompletionReasonCode()

This function returns a single reason code for the transaction, which could include “COMPLETE” if the transaction was successful, or “TIMEOUT” or a number of other potential problems. Other reason codes include “NODE_LOST” and “BAD_REQUEST” – see the user documentation for a complete list. In the following example, we would trace all transactions which did not complete for any reason.

 

1
2
3
4
5
6
$reasonCode = connection.getCompletionReasonCode(); 
   
if ( $reasonCode != "COMPLETE" ) { 
     # Failed transaction 
     recentconns.include(); 

 

connection.getCompletionReasonInfo()

However, there is a way of extracting even more detailed information about the completion: this function contains information about whether the transaction ended due to client error, or to server error and other, all encoded in a hash returned by the function:

 

Key

Details

code

Reason (from connection.getCompletionReasonCode();

message

A detailed message describing the reason code.

Iserror

1 if the transaction ended due to an error.

Isservererror

1 if the transaction ended due to a server error.

Isclienterror

1 if the transaction ended due to a client error.

Istimeout

1 if the transaction ended because it exceeding any timeout duration.

isprocessingtimeout

1 if the transaction ended because it exceeded rule or optimization processing timeouts.

 

Using this detailed information, we can pick out particular types of failure in the Activity > Connections page. Alternatively, we could raise an external event or create a log record. In this example, instead of sending the transaction detail to the Activity > Connections display, we emit a log record with detailed information about this transaction, inserting the “code” and “message” into the log file:

 

1
2
3
4
5
6
7
8
$info = connection.getCompletionReasonInfo(); 
   
if( $info['iserror'] ) { 
     log.info( "Transaction error detected. Code: "
              $info['code'] . " Message: "
              $info['message'
              ); 

 

For more information on these new TrafficScript functions, as well as how to use with recentconns.include() and recentconns.exclude() to control capture of transaction information in functions in the Activity > Connections display, see the SteelApp TrafficScript Guide in the User Documentation.

 

The SteelApp Developer Edition allows you to use Riverbed SteelApp Traffic Manager completely free within your test and development environments to experiment with this and other TrafficScript features, and to support the applications that you're building before you put them into production.

 

Find out more - and download your free trial here.

Contributors