Created
January 8, 2020 16:34
-
-
Save ericmustin/9625e2fb27a98bc7d0b9e144a73f048b to your computer and use it in GitHub Desktop.
example request-promise distributed header id injection
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
Example app listening on port 5000! | |
Inject into carrier: {"x-datadog-trace-id":"4975767728554009637","x-datadog-parent-id":"4633592010209712543","x-datadog-sampling-priority":"1"} |
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 tracer = require('dd-trace').init({debug: true}) | |
const rp = require('request-promise'); | |
const express = require('express') | |
async function init(req, res) { | |
const response = await rp.get('http://www.google.com') | |
res.send('Hello World!') | |
} | |
const app = express() | |
const port = 5000 | |
app.get('/', init) | |
app.listen(port, () => console.log(`Example app listening on port ${port}!`)) |
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
{ | |
"name": "node_tracing", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"dd-trace": "^0.16.2", | |
"express": "^4.17.1", | |
"request": "^2.88.0", | |
"request-promise": "^4.2.5" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment