Created
April 27, 2018 18:12
-
-
Save dwsupplee/3ec399fb43b30218ec08cb7846a72104 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$s1 = microtime(true); | |
for ($i = 0; $i < 20; $i++) { | |
exec('php gapic.php'); | |
} | |
print microtime(true) - $s1 . PHP_EOL; | |
$s2 = microtime(true); | |
for ($i = 0; $i < 20; $i++) { | |
exec('php non-gapic.php'); | |
} | |
print microtime(true) - $s2 . PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use Google\Cloud\Logging\LoggingClient; | |
// This will choose the "gRPC" connection, which is really jut a GAPIC connection. | |
// To have the GAPIC use REST override this property to "rest": https://github.com/GoogleCloudPlatform/google-cloud-php/blob/master/Core/src/GrpcTrait.php#L105 | |
$client = new LoggingClient([ | |
'transport' => 'grpc' | |
]); | |
$client->logger('test_logs_gapic')->write(['some' => 'test data'], [ | |
'labels' => [ | |
'test' => 'label' | |
], | |
'operation' => [ | |
'id' => 'myid' | |
], | |
'httpRequest' => [ | |
'requestMethod' => 'GET' | |
] | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use Google\Cloud\Logging\LoggingClient; | |
$client = new LoggingClient([ | |
'transport' => 'rest' | |
]); | |
$client->logger('test_logs_non_gapic')->write(['some' => 'test data'], [ | |
'labels' => [ | |
'test' => 'label' | |
], | |
'operation' => [ | |
'id' => 'myid' | |
], | |
'httpRequest' => [ | |
'requestMethod' => 'GET' | |
] | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment