in cloudprober/grpc_gpc_prober/spanner_probes.php [137:174]
function read($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');
# Probing Read call
$time_start = microtime_float();
$readRequest = new Google\Cloud\Spanner\V1\ReadRequest();
$readRequest->setSession($session->getName());
$readRequest->setTable('users');
$readRequest->setColumns(['username', 'firstname', 'lastname']);
$keyset = new Google\Cloud\Spanner\V1\KeySet();
$keyset->setAll(True);
$readRequest->setKeySet($keyset);
$result_set = $client->Read($readRequest);
$lantency = (microtime_float() - $time_start) * 1000;
$metrics['read_latency_ms'] = $lantency;
// TODO: Error Check for result_set
# Probing StreamingRead call
$partial_result_set = $client->StreamingRead($readRequest);
$time_start = microtime_float();
$first_result = array_values($partial_result_set->getMetadata())[0];
$lantency = (microtime_float() - $time_start) * 1000;
$metrics['streaming_read_latency_ms'] = $lantency;
//TODO: Error Check for streaming read first result
$deleteSessionRequest = new Google\Cloud\Spanner\V1\DeleteSessionRequest();
$deleteSessionRequest->setName($session->getName());
$client->deleteSession($deleteSessionRequest);
}