I have 3 services A, B and C. I have written APIs which call A -> B -> C. I have installed Jaeger as given in the official documentation of Istio (https://istio.io/latest/docs/tasks/observability/distributed-tracing/jaeger/). My Jaeger dashboard is up, it's showing traces as well but none of the traces have more than 2 spans. I can see in my docker desktop logs that my API is calling across the services.
I tried setting up jaeger-client as well in all my NodeJS services. I tried the code with prom-client (I have also installed grafana, kiali and prometheus using istio addons) given on https://github.com/jaegertracing/jaeger-client-node. That also did not work, then I tried the propagating headers as given at https://edspencer.net/2020/10/13/distributed-tracing-with-node-js/. Here is the code I added:
const {initTracer} = require('jaeger-client')
const app = express();
const config = {
serviceName: 'service-a',
reporter: {
logSpans: true,
collectorEndpoint: 'http://jaeger-collector.istio-system.svc:14268/api/traces',
},
sampler: {
type: 'const',
param: 1
}
};
const options = {
tags: {
'gateway.version': '1.0.0'
}
};
const tracer = initTracer(config, options);
app.use((req, res, next) => {
req.rootSpan = tracer.startSpan(req.originalUrl)
tracer.inject(req.rootSpan, "http_headers", req.headers)
res.on("finish", () => {
req.rootSpan.finish()
})
next()
})
But this also didn't help. Traces on Jaeger dashboard are same which were coming without these solutions.
I think istio sidecar should send traces to jaeger automatically, but I am not sure. Has anyone set Jaeger in Istio with services in NodeJS? Please help.