in cloudprober/grpc_gpc_prober/spanner_probes.php [184:237]
function transaction($client, &$metrics){
global $_DATABASE;
$createSessionRequest = new Google\Cloud\Spanner\V1\CreateSessionRequest();
$createSessionRequest->setDatabase($_DATABASE);
list($session, $status) = $client->CreateSession($createSessionRequest)->wait();
hardAssertIfStatusOk($status);
hardAssert($session !== null, 'Call completed with a null response');
$txn_options = new Google\Cloud\Spanner\V1\TransactionOptions();
$rw = new Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite();
$txn_options->setReadWrite($rw);
$txn_request = new Google\Cloud\Spanner\V1\BeginTransactionRequest();
$txn_request->setSession($session->getName());
$txn_request->setOptions($txn_options);
# Probing BeginTransaction call
$time_start = microtime_float();
list($txn, $status) = $client->BeginTransaction($txn_request)->wait();
$lantency = (microtime_float() - $time_start) * 1000;
$metrics['begin_transaction_latency_ms'] = $lantency;
hardAssertIfStatusOk($status);
hardAssert($txn !== null, 'Call completed with a null response');
# Probing Commit Call
$commit_request = new Google\Cloud\Spanner\V1\CommitRequest();
$commit_request->setSession($session->getName());
$commit_request->setTransactionId($txn->getId());
$time_start = microtime_float();
$client->Commit($commit_request);
$latency = (microtime_float() - $time_start) * 1000;
$metrics['commit_latency_ms'] = $lantency;
# Probing Rollback call
list($txn, $status) = $client->BeginTransaction($txn_request)->wait();
$rollback_request = new Google\Cloud\Spanner\V1\RollbackRequest();
$rollback_request->setSession($session->getName());
$rollback_request->setTransactionId($txn->getId());
hardAssertIfStatusOk($status);
hardAssert($txn !== null, 'Call completed with a null response');
$time_start = microtime_float();
$client->Rollback($rollback_request);
$latency = (microtime_float() - $time_start) * 1000;
$metrics['rollback_latency_ms'] = $latency;
$deleteSessionRequest = new Google\Cloud\Spanner\V1\DeleteSessionRequest();
$deleteSessionRequest->setName($session->getName());
$client->deleteSession($deleteSessionRequest);
}