diff --git a/profiler/app.js b/profiler/app.js new file mode 100644 index 0000000000..213e3b3e1e --- /dev/null +++ b/profiler/app.js @@ -0,0 +1,19 @@ +// Copyright 2018 Google LLC +// +// 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 profiler_setup_nodejs_app_engine] +require('@google-cloud/profiler').start(); +// [END profiler_setup_nodejs_app_engine] diff --git a/profiler/package.json b/profiler/package.json new file mode 100644 index 0000000000..e9c107220e --- /dev/null +++ b/profiler/package.json @@ -0,0 +1,25 @@ +{ + "name": "cloud-profiler-samples", + "version": "0.1.0", + "private": true, + "description": "Google Cloud Profiler samples", + "main": "app.js", + "scripts": { + "test": "echo 'no test yet'" + }, + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/googleapis/cloud-profiler-nodejs.git" + }, + "author": "Google LLC.", + "license": "Apache-2.0", + "dependencies": { + "@google-cloud/profiler": "^5.0.3" + }, + "files": [ + "*.js" + ] +} diff --git a/profiler/snippets.js b/profiler/snippets.js new file mode 100644 index 0000000000..4a32b1a4dc --- /dev/null +++ b/profiler/snippets.js @@ -0,0 +1,24 @@ +// Copyright 2018 Google LLC +// +// 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 profiler_setup_nodejs_compute_engine] +require('@google-cloud/profiler').start({ + serviceContext: { + service: 'your-service', + version: '1.0.0', + }, +}); +// [END profiler_setup_nodejs_compute_engine]