setAction method
Set action name for end-to-end application tracing.
Sets the current action within a module that appears in V$SESSION. Provides finer-grained tracking than module names alone.
Parameters:
action: Action name (e.g., 'ProcessPayment', 'GenerateInvoice')
Example - Action Tracking:
await connection.setModule('OrderProcessing');
// Step 1: Validate order
await connection.setAction('ValidateOrder');
await connection.query('SELECT * FROM orders WHERE id = :1', params: [orderId]);
// Step 2: Process payment
await connection.setAction('ProcessPayment');
await connection.executeUpdate('UPDATE payments ...');
// Step 3: Update inventory
await connection.setAction('UpdateInventory');
await connection.executeUpdate('UPDATE inventory ...');
// DBA sees: module='OrderProcessing', action='UpdateInventory'
Best Practice: Update the action as you move through workflow steps to enable precise performance analysis and troubleshooting.
See also:
Implementation
Future<void> setAction(String action) async {
_ensureConnected();
final (actionNative, actionLen) = StringUtils.toNativeUtf8WithLength(action, _memoryManager);
final result = _dpiOracle.dpiConn_setAction(
_connectionPtr.value,
actionNative,
actionLen,
);
if (result == DPI_FAILURE) {
throw OracleConnectionException('Failed to set action');
}
}