I am trying to implement Jaeger in the node js project. I have deployed this node js project(using docker image) and Jaegaer in k8s (kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-kubernetes/master/all-in-one/jaeger-all-in-one-template.yml)
Both are working individually but traces are not visible in the service
var initTracer = require('jaeger-client').initTracer;
const opentracing = require("opentracing");
const bodyParser = require('body-parser');
var config = {
'serviceName': 'user-service',
'local_agent': {
'reporting_host': 'jaeger',
'reporting_port': '6831',
},
'reporter': {
'logSpans': true
},
'sampler': {
'type': 'probabilistic',
'param': 1.0
}
};
var options = {
'tags': {
'user-service': '1.1.2'
}
};
var tracer = initTracer(config, options);
opentracing.initGlobalTracer(tracer);
console.log(tracer);
const express = require('express');
const app = express();
app.use(bodyParser.json({ type: 'application/*+json' }));
app.get('/users/:id',(req, res) => {
const span = tracer.startSpan('get user by user_id');
res.send(JSON.stringify('hello'));
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);
});
Have you tried looking at the logs being generated by your pods?
In my case I got the following
ERROR Failed to flush spans in reporter: error sending spans over UDP: Error: getaddrinfo ENOTFOUND http://jaeger-agent, packet size: 984, bytes sent: undefined
Changing it to jaeger-agent worked for me.
Also if it helps I have declared this under my jaeger image in docker-compose.yml:
+ ports: - "5775:5775/udp" - "6831:6831/udp" - "6832:6832/udp" - "5778:5778" - "16686:16686" - "14268:14268" - "9411:9411"`