Skip to content

Commit 2048a21

Browse files
authored
Adds Trace sample for App Engine PHP72 (GoogleCloudPlatform#628)
1 parent dc9fb2a commit 2048a21

File tree

13 files changed

+1988
-10
lines changed

13 files changed

+1988
-10
lines changed

appengine/php72/auth/test/DeployTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
use Google\Cloud\TestUtils\AppEngineDeploymentTrait;
2020
use PHPUnit\Framework\TestCase;
2121

22-
require_once __DIR__ . '/../../../../testing/FileUtil.php';
23-
2422
class DeployTest extends TestCase
2523
{
2624
use AppEngineDeploymentTrait;

appengine/php72/errorreporting/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ This app demonstrates how to report errors on on App Engine for PHP 7.2.
1717

1818
### Run Locally
1919

20-
These samples cannot be run locally with the Dev AppServer because gRPC has not
21-
been packaged with the Dev AppServer for PHP at this time. You can install gRPC
22-
locally and run them using PHP's build-in web server:
20+
You can run the sample locally using PHP's build-in web server:
2321
2422
```
2523
# export environemnt variables locally which are set by app engine when deployed
@@ -31,6 +29,8 @@ export GAE_VERSION=testing
3129
php -S localhost:8000
3230
```
3331

32+
Browse to `localhost:8000` to see a list of examples to execute.
33+
3434
### Deploy with gcloud
3535

3636
Deploy the samples by doing the following:

appengine/php72/errorreporting/test/DeployTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
use PHPUnit\Framework\TestCase;
2626

27-
require_once __DIR__ . '/../../../../testing/FileUtil.php';
28-
2927
class DeployTest extends TestCase
3028
{
3129
use AppEngineDeploymentTrait;

appengine/php72/helloworld/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Hello World on App Engine for PHP 7.2
22

3-
This sample application demonstrates how to access
4-
[Compute Metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata)
5-
from App Engine.
3+
This sample demonstrates how to deploy a *very* basic application to Google
4+
App Engine for PHP 7.2.
65

76
## Setup
87

appengine/php72/trace/.gcloudignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file specifies files that are *not* uploaded to Google Cloud Platform
2+
# using gcloud. It follows the same syntax as .gitignore, with the addition of
3+
# "#!include" directives (which insert the entries of the given .gitignore-style
4+
# file at that point).
5+
#
6+
# For more information, run:
7+
# $ gcloud topic gcloudignore
8+
#
9+
.gcloudignore
10+
# If you would like to upload your .git directory, .gitignore file or files
11+
# from your .gitignore file, remove the corresponding line
12+
# below:
13+
.git
14+
.gitignore
15+
16+
# PHP Composer dependencies:
17+
#vendor/

appengine/php72/trace/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# App Engine for PHP 7.2 Stackdriver Trace samples
2+
3+
This app demonstrates how to set up Stackdriver Trace on App Engine for PHP 7.2.
4+
5+
## Setup
6+
7+
- Install [`composer`](https://getcomposer.org)
8+
- Install dependencies by running:
9+
10+
```sh
11+
composer install
12+
```
13+
14+
- Install the [Google Cloud SDK](https://developers.google.com/cloud/sdk/).
15+
16+
## Deploy
17+
18+
### Run Locally
19+
20+
You can run these samples locally using PHP's build-in web server:
21+
22+
```
23+
# export environemnt variables locally which are set by app engine when deployed
24+
export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID
25+
26+
# Run PHP's built-in web server
27+
php -S localhost:8000
28+
```
29+
30+
You will then be able to see your application traces in the
31+
[Trace UI](https://console.cloud.google.com/traces/overview).
32+
33+
### Deploy with gcloud
34+
35+
Deploy the samples by doing the following:
36+
37+
```
38+
gcloud config set project YOUR_PROJECT_ID
39+
gcloud app deploy
40+
gcloud app browse
41+
```
42+
43+
The last command will open `https://{YOUR_PROJECT_ID}.appspot.com/`
44+
in your browser. Browse to `/` to execute a trace. You will then be able to see
45+
your traces in the [Trace UI](https://console.cloud.google.com/traces/overview).

appengine/php72/trace/app.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
runtime: php72
2+
3+
handlers:
4+
- url: /
5+
script: index.php

appengine/php72/trace/composer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"require": {
3+
"opencensus/opencensus-exporter-stackdriver": "^0.1.0"
4+
},
5+
"require-dev": {
6+
"google/cloud-tools": "^0.7"
7+
}
8+
}

0 commit comments

Comments
 (0)