1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | { "name": "demo-front", "version": "0.0.1", "description": "Example project that shows how to use zipkin with javascript", "repository": "https://github.com/openzipkin/zipkin-js", "scripts": { "lint": "eslint .", "start": "node servers.js", "browserify": "browserify browser.js -o bundle.js" }, "dependencies": { "browser-process-hrtime": "^0.1.2", "express": "^4.14.0", "rest": "^1.3.2", "zipkin": "^0.11.1", "zipkin-context-cls": "^0.11.0", "zipkin-instrumentation-cujojs-rest": "^0.11.1", "zipkin-instrumentation-express": "^0.11.1", "zipkin-instrumentation-fetch": "^0.11.1", "zipkin-transport-http": "^0.11.1" }, "devDependencies": { "browserify": "^14.1.0", "eslint": "^3.4.0", "eslint-config-airbnb": "^14.1.0", "eslint-plugin-import": "^2.2.0", "eslint-plugin-jsx-a11y": "^4.0.0", "eslint-plugin-react": "^6.2.0" } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | app.get('/redis', (req, res) => { var url_parts = url.parse(req.url, true); var query = url_parts.query; res.header('X-B3-TraceId', tracer.id.traceId); res.header('X-B3-SpanId', tracer.id.spanId); tracer.local('docs-front', () => zipkinRest(`http://localhost:8080/docs/web/callredis?msg=${query.msg}`) .then(response => res.send(response.entity)) .catch(err => console.error('Error', err.stack)) ); console.log(`tracerId : ${tracer.id.traceId}, spanId : ${tracer.id.spanId}`); }); app.get('/kafka', (req, res) => { var url_parts = url.parse(req.url, true); var query = url_parts.query; res.header('X-B3-TraceId', tracer.id.traceId); res.header('X-B3-SpanId', tracer.id.spanId); tracer.local('docs-front', () => zipkinRest(`http://localhost:8080/docs/web/callkafka?msg=${query.msg}`) .then(response => res.send(response.entity)) .catch(err => console.error('Error', err.stack)) ); console.log(`tracerId : ${tracer.id.traceId}, spanId : ${tracer.id.spanId}`); }); |
1 2 3 4 5 6 7 8 | app.get('/api', (req, res) => { var url_parts = url.parse(req.url, true); var query = url_parts.query; console.log(`docs-backend msg : ${query.msg}`); console.log(`docs-backend tracerId : ${tracer.id.traceId}, spanId : ${tracer.id.spanId}`); res.send(new Date().toString()) }); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |