I'm trying to get a little example of Jaeger working using Node.js, but I can't get the Jaeger UI to display any data or show anything.
I have read this question: uber/jaeger-client-node: backend wont receive data but this hasn't helped in my case.
I'm running the Jaeger back end in a docker container using:
docker run -d -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -p5775:5775/udp -p6831:6831/udp -p6832:6832/udp -p5778:5778 -p16686:16686 -p14268:14268 -p9411:9411 jaegertracing/all-in-one:latest
The code for my example is:
var initTracer = require('jaeger-client').initTracer;
// See schema https://github.com/jaegertracing/jaeger-client-node/blob/master/src/configuration.js#L37
var config = {
'serviceName': 'my-awesome-service'
};
var options = {
'tags': {
'my-awesome-service.version': '1.1.2'
}
//'metrics': metrics,
//'logger': logger
};
var tracer = initTracer(config, options);
const express = require('express');
const app = express();
// Handle a GET request on the root path
app.get('/', (req, res) => {
const span = tracer.startSpan('http_request');
res.send('Hello Jaeger');
span.log({'event': 'request_end'});
span.finish();
});
// Set up server
const server = app.listen(8000, () => {
let host = server.address().address;
let port = server.address().port;
console.log('Service_1 listening at http://%s:%s', host, port);
});
Any help as to what I am doing wrong would be much appreciated!
You need to add some more properties to your config options. For reporter deployed on localhost and local sampler strategy :
var config = {
'serviceName': 'my-awesome-service',
'reporter': {
'logSpans': true,
'agentHost': 'localhost',
'agentPort': 6832
},
'sampler': {
'type': 'probabilistic',
'param': 1.0
}
};
Replace localhost
by server or route name to target another host for Jeager runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With