-
-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1052 from moleculerjs/tracing_flattenTags
Add safetyTags property to tracer exporters
- Loading branch information
Showing
17 changed files
with
359 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
"use strict"; | ||
|
||
/*const tracer = require("dd-trace").init({ | ||
service: "moleculer", // shows up as Service in Datadog UI | ||
url: "http://127.0.0.1:8126", | ||
debug: true, | ||
samplingPriority: "USER_KEEP" | ||
}); | ||
tracer.use("http"); | ||
tracer.use("ioredis"); | ||
*/ | ||
const ServiceBroker = require("../src/service-broker"); | ||
("use strict"); | ||
|
||
const { MoleculerError } = require("../src/errors"); | ||
const _ = require("lodash"); | ||
const { inspect } = require("util"); | ||
|
||
const THROW_ERR = false; | ||
|
||
// Create broker | ||
const broker = new ServiceBroker({ | ||
nodeID: "node-1", | ||
logger: console, | ||
logLevel: "info", | ||
//transporter: "redis://localhost:6379", | ||
//cacher: true, //"redis://localhost:6379", | ||
|
||
tracing: { | ||
events: true, | ||
stackTrace: true, | ||
sampling: { | ||
rate: 1 | ||
//tracesPerSecond: 1 | ||
}, | ||
exporter: [ | ||
/*{ | ||
type: "Console", | ||
options: { | ||
width: 100, | ||
gaugeWidth: 30, | ||
logger: console.info | ||
} | ||
},*/ | ||
/*{ | ||
type: "Datadog", | ||
options: { | ||
tracer | ||
} | ||
}*/ | ||
{ | ||
type: "Zipkin", | ||
options: { | ||
safetyTags: false, | ||
baseURL: "http://127.0.0.1:9411" | ||
} | ||
}, | ||
{ | ||
type: "Jaeger", | ||
options: { | ||
safetyTags: false, | ||
endpoint: "http://localhost:14268/api/traces" | ||
} | ||
} | ||
/*{ | ||
type: "Event", | ||
options: { | ||
} | ||
}*/ | ||
/*{ | ||
type: "EventLegacy" | ||
}*/ | ||
] | ||
} | ||
}); | ||
|
||
broker.createService({ | ||
name: "greeter", | ||
actions: { | ||
hello: { | ||
tracing: { | ||
safetyTags: true | ||
}, | ||
handler(ctx) { | ||
return `Hello!`; | ||
} | ||
} | ||
} | ||
}); | ||
|
||
// Start server | ||
broker.start().then(() => { | ||
broker.repl(); | ||
|
||
const a = { | ||
aa: 5, | ||
c: "John" | ||
}; | ||
const b = { | ||
bb: 10, | ||
a: a | ||
}; | ||
|
||
a.b = b; | ||
|
||
// Call action | ||
setInterval(() => { | ||
broker.call("greeter.hello", a).then(console.log).catch(console.error); | ||
}, 5000); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Moleculer Trace Exporters | ||
|
||
## Running Jaeger | ||
|
||
```bash | ||
docker run -d --name jaeger -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 14250:14250 -p 14268:14268 -p 14269:14269 jaegertracing/all-in-one:latest | ||
``` | ||
|
||
**UI:** http://<docker-ip>:16686/ | ||
|
||
## Running Zipkin | ||
|
||
```bash | ||
docker run -d -p 9411:9411 --name=zipkin openzipkin/zipkin | ||
``` | ||
|
||
## Running DataDog Agent | ||
|
||
```bash | ||
docker run -d --name dd-agent --restart unless-stopped -v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro -e DD_API_KEY=123456 -e DD_APM_ENABLED=true -e DD_APM_NON_LOCAL_TRAFFIC=true -p 8126:8126 datadog/agent:latest | ||
``` |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.