Created
November 11, 2020 23:07
-
-
Save tedsuo/341937dc2f7aabac16ac8fb2adf2eb44 to your computer and use it in GitHub Desktop.
node_server_init.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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