diff --git a/trace/README.md b/trace/README.md deleted file mode 100644 index ea86d7dfeb..0000000000 --- a/trace/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Stackdriver Trace sample for Node.js - -This sample demonstrates [StackDriver Trace][trace] with Node.js. - -* [Setup](#setup) -* [Running locally](#running-locally) -* [Deploying to App Engine](#deploying-to-app-engine) -* [Running the tests](#running-the-tests) - -## Setup - -Before you can run or deploy the sample, you need to do the following: - -1. Refer to the [appengine/README.md][readme] file for instructions on - running and deploying. -1. [Create a Google Analytics Property and obtain the Tracking ID][tracking]. -1. Add your tracking ID to `app.yaml`. -1. Install dependencies: - - npm install - -## Running locally - - npm start - -## Deploying to App Engine - - npm run deploy - -Use the [Stackdriver Trace dashboard](https://console.cloud.google.com/traces/traces) to inspect recorded traces. - -## Running the tests - -See [Contributing][contributing]. - -[trace]: https://cloud.google.com/trace/ -[readme]: ../README.md -[contributing]: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/CONTRIBUTING.md diff --git a/trace/app.js b/trace/app.js deleted file mode 100644 index 2a5816ed8b..0000000000 --- a/trace/app.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright 2017, Google, Inc. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -// [START trace_app] -if (process.env.NODE_ENV === 'production') { - // [START trace_setup_implicit] - require('@google-cloud/trace-agent').start(); - // [END trace_setup_implicit] -} - -const express = require('express'); -const got = require('got'); - -const app = express(); -const DISCOVERY_URL = 'https://www.googleapis.com/discovery/v1/apis'; - -// This incoming HTTP request should be captured by Trace -app.get('/', (req, res) => { - // This outgoing HTTP request should be captured by Trace - got(DISCOVERY_URL, {json: true}) - .then(response => { - const names = response.body.items.map(item => item.name); - - res - .status(200) - .send(names.join('\n')) - .end(); - }) - .catch(err => { - console.error(err); - res.status(500).end(); - }); -}); - -// Start the server -const PORT = process.env.PORT || 8080; -app.listen(PORT, () => { - console.log(`App listening on port ${PORT}`); - console.log('Press Ctrl+C to quit.'); -}); -// [END trace_app] diff --git a/trace/app.yaml b/trace/app.yaml deleted file mode 100644 index 95b81be533..0000000000 --- a/trace/app.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2016, Google, Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# [START app_yaml] -runtime: nodejs -env: flex -# [END app_yaml] diff --git a/trace/package.json b/trace/package.json deleted file mode 100644 index 3447096fbf..0000000000 --- a/trace/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "nodejs-docs-samples-trace", - "description": "Sample for Google Stackdriver Trace on Google App Engine Flexible Environment.", - "version": "0.0.1", - "private": true, - "license": "Apache-2.0", - "author": "Google Inc.", - "repository": { - "type": "git", - "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "deploy": "gcloud app deploy", - "start": "node app.js", - "test": "repo-tools test app", - "e2e-test": "repo-tools test deploy" - }, - "dependencies": { - "@google-cloud/trace-agent": "2.5.0", - "express": "4.16.4", - "got": "8.3.2" - }, - "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^3.0.0" - }, - "cloud-repo-tools": { - "test": { - "app": { - "msg": "acceleratedmobilepageurl" - } - }, - "requiresKeyFile": true, - "requiresProjectId": true - } -} diff --git a/trace/snippets.js b/trace/snippets.js deleted file mode 100644 index 9e49011ca3..0000000000 --- a/trace/snippets.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2017, Google, Inc. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -// [START trace_setup_explicit] -require('@google-cloud/trace-agent').start({ - projectId: 'your-project-id', - keyFilename: '/path/to/key.json', -}); -// [END trace_setup_explicit]