How to use @google-cloud/profiler - 6 common examples

To help you get started, we’ve selected a few @google-cloud/profiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleCloudPlatform / nodejs-serverless-microservices-demo / screenshot / server.js View on Github external
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';

// the following is a workaround:
// Cloud Storage library tries to write in /home/ when uploading a buffer
process.env.HOME = '/tmp';

// Stackdriver APM
const traceApi = require('@google-cloud/trace-agent').start();
require('@google-cloud/debug-agent').start({allowExpressions: true});
require('@google-cloud/profiler').start();

const bodyParser = require('body-parser');
const express = require('express');
const puppeteer = require('puppeteer');
const Storage = require('@google-cloud/storage');

const logger = require('./logger');

const storage = new Storage();

const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

// Ignore Favicon
app.use((req, res, next) => {
github googleapis / cloud-profiler-nodejs / samples / app.js View on Github external
// 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]
github googleapis / cloud-profiler-nodejs / samples / snippets.js View on Github external
// 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]
github GoogleCloudPlatform / nodejs-serverless-microservices-demo / image-diff / index.js View on Github external
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.
*/

/* eslint no-console: "off" */
const traceApi = require('@google-cloud/trace-agent').start({
  serviceContext: {
    service: 'image-diff'
  }
});
const Storage = require('@google-cloud/storage');
const debug = require('@google-cloud/debug-agent').start();
require('@google-cloud/profiler').start();


const diff = require('./diff');

const storage = new Storage();

/**
 * Generic background Cloud Function to be triggered by Cloud Storage.
 *
 * @param {object} event The Cloud Functions event.
 * @param {function} callback The callback function.
 */
exports.imageDiff = (event, callback) => {
  const debugReady = debug.isReady();
  debugReady.then(() => {
github GoogleCloudPlatform / cloud-ops-sandbox / src / paymentservice / index.js View on Github external
* 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
 *
 *     https://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';

require('@google-cloud/profiler').start({
    serviceContext: {
        service: 'paymentservice',
        version: '1.0.0'
    }
  });
require('@google-cloud/trace-agent').start();
require('@google-cloud/debug-agent').start({
    serviceContext: {
      service: 'paymentservice',
      version: 'VERSION'
    }
  })

const HipsterShopServer = require('./server');

const PORT = process.env['PORT'];
github GoogleCloudPlatform / cloud-ops-sandbox / src / currencyservice / server.js View on Github external
* 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.
 */

require('@google-cloud/profiler').start({
  serviceContext: {
    service: 'currencyservice',
    version: '1.0.0'
  }
});
require('@google-cloud/debug-agent').start({
  serviceContext: {
    service: 'currencyservice',
    version: 'VERSION'
  }
});

const opentelemetry = require('@opentelemetry/api');
const {NodeTracerProvider} = require('@opentelemetry/node');
const {BatchSpanProcessor} = require('@opentelemetry/tracing');
const {TraceExporter} = require('@google-cloud/opentelemetry-cloud-trace-exporter');

@google-cloud/profiler

Adds support for Cloud Profiler to Node.js applications

Apache-2.0
Latest version published 4 months ago

Package Health Score

77 / 100
Full package analysis

Popular @google-cloud/profiler functions

Similar packages