How to use the @google-cloud/trace-agent.get function in @google-cloud/trace-agent

To help you get started, we’ve selected a few @google-cloud/trace-agent 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 cloudfoundry-incubator / cloud-service-broker / acceptance-tests / gcp / stack-driver-trace-test-app / index.js View on Github external
function runServer(content) {
    const tracer = require('@google-cloud/trace-agent').get();
    const server = require('restify').createServer();
    server.get('/', (_, res, next) => {
        const customSpan = tracer.createChildSpan({ name: 'gen-content' });
        res.send(`${JSON.stringify(tracer.getConfig())} ${tracer.getWriterProjectId()} ${content}`)
        customSpan.endSpan();
        next()
    });

    server.listen(process.env.PORT || 8080, function () {
        console.log('%s listening at %s', server.name, server.url);
    });

}

@google-cloud/trace-agent

Node.js Support for StackDriver Trace

Apache-2.0
Latest version published 9 months ago

Package Health Score

77 / 100
Full package analysis

Popular @google-cloud/trace-agent functions