in cloudprober/grpc_gpc_prober/prober.php [39:95]
function executeProbes($api){
global $_OAUTH_SCOPE;
global $_SPANNER_TARGET;
global $_FIRESTORE_TARGET;
global $spanner_probes;
global $firestore_probes;
$util = new StackdriverUtil($api);
$auth = Google\Auth\ApplicationDefaultCredentials::getCredentials($_OAUTH_SCOPE);
$opts = [
'credentials' => Grpc\ChannelCredentials::createSsl(),
'update_metadata' => $auth->getUpdateMetadataFunc(),
];
if($api == 'spanner'){
$client = new SpannerGrpcClient($_SPANNER_TARGET, $opts);
$probe_functions = $spanner_probes;
}
else if($api == 'firestore'){
$client = new FirestoreGrpcClient($_FIRESTORE_TARGET, $opts);
$probe_functions = $firestore_probes;
}
else{
echo 'grpc not implemented for '.$api;
exit(1);
}
$total = sizeof($probe_functions);
$success = 0;
$metrics = [];
# Execute all probes for given api
foreach ($probe_functions as $probe_name => $probe_function) {
try{
$probe_function($client, $metrics);
$success++;
}
catch(Exception $e){
$util->reportError($e);
}
}
if($success == $total){
$util->setSuccess(True);
}
$util->addMetrics($metrics);
$util->outputMetrics();
if($success != $total){
# TODO: exit system
exit(1);
}
}