Skip to content

Instantly share code, notes, and snippets.

@tedsuo
Created November 11, 2020 23:07
Show Gist options
  • Select an option

  • Save tedsuo/341937dc2f7aabac16ac8fb2adf2eb44 to your computer and use it in GitHub Desktop.

Select an option

Save tedsuo/341937dc2f7aabac16ac8fb2adf2eb44 to your computer and use it in GitHub Desktop.
node_server_init.js
const { lightstep } = require('lightstep-opentelemetry-launcher-node');
const sdk = lightstep.configureOpenTelemetry({
accessToken: '<ACCESS_TOKEN>',
serviceName: 'hello-server-1',
serviceVersion: 'v1.2.3',
propagators: 'tracecontext,b3',
});
sdk.start().then(() => {
require('./server');
});
function shutdown() {
sdk.shutdown().then(
() => console.log("SDK shut down successfully"),
(err) => console.log("Error shutting down SDK", err),
).finally(() => process.exit(0))
};
process.on('exit', shutdown);
process.on('SIGINT', shutdown);
process.on('SIGTERM', shutdown);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment