Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 1c7b9e2

Browse files
Add examples for automatic tracing on Stackdriver and Zipkin
1 parent c833eed commit 1c7b9e2

6 files changed

Lines changed: 64 additions & 0 deletions

File tree

examples/stackdriver/automatic.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var fs = require('fs');
2+
var tracing = require('opencensus-nodejs').addStackdriver('project-id').start();
3+
4+
var http = require('http');
5+
http.createServer(function (req, res) {
6+
res.writeHead(200, { 'Content-Type': 'text/html' });
7+
res.write('Hello World!');
8+
res.end();
9+
}).listen(8080);

examples/stackdriver/package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/stackdriver/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "stackdriver",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "Google Inc.",
10+
"license": "Apache-2.0"
11+
}

examples/zipkin/automatic.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var fs = require('fs');
2+
var tracing = require('opencensus-nodejs').addZipkin('http://localhost:9411/api/v2/spans', 'automatic_service');
3+
tracing.start();
4+
5+
6+
var http = require('http');
7+
http.createServer(function (req, res) {
8+
res.writeHead(200, { 'Content-Type': 'text/html' });
9+
res.write('Hello World!');
10+
res.end();
11+
}).listen(8080);

examples/zipkin/package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/zipkin/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "zipkin",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "Google Inc.",
10+
"license": "Apache-2.0",
11+
"devDependencies": {
12+
"@types/node": "^9.6.1"
13+
}
14+
}

0 commit comments

Comments
 (0)