Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Unable to get trace to Jaeger tracing #141

Closed
bikashsharmabks opened this issue Jul 28, 2017 · 2 comments
Closed

Unable to get trace to Jaeger tracing #141

bikashsharmabks opened this issue Jul 28, 2017 · 2 comments

Comments

@bikashsharmabks
Copy link

I am new to opentracing and would like to use it, to get tracing around various microservices which we built (mostly using node).

To start with I tried to build a hello-world service using jaeger-client-node (code snippet) attached.

Below are the steps done:

  1. Docker around Jaeger Tracing
    sudo docker run -d -p5775:5775/udp -p6831:6831/udp -p6832:6832/udp -p5778:5778 -p16686:16686 -p14268:14268 jaegertracing/all-in-one:latest

  2. Here is the below code which I am trying to run to get opentracing work

var restify = require('restify');
var initTracer = require('jaeger-client').initTracer;
var bunyan = require('bunyan');
var logger = bunyan.createLogger({
  name: 'hello-world'
});

// See schema https://github.com/uber/jaeger-client-node/blob/master/src/configuration.js#L37
var config = {
  'serviceName': 'hello-world'
};
var options = {
  'tags': {
    'hello-world.version': '1.1.2'
  },
  'logger': logger
};

var tracer = initTracer(config, options);

function respond(req, res, next) {

  var span = tracer.startSpan('GET-hello');
  span.log({'name': req.params.name});
  span.finish();

  res.send('hello: ' + req.params.name);

  next();
}

var server = restify.createServer();
server.get('/hello/:name', respond);

server.listen(8080, function() {
  console.log('%s listening at %s', server.name, server.url);
});

3. >>node index.js
I Get a log from Jaeger saying

{"name":"hello-world","hostname":"P10-LAP-031","pid":2405,"level":30,"msg":"Initializing Jaeger Tracer with RemoteReporter and RemoteSampler","time":"2017-07-28T07:05:00.264Z","v":0}
restify listening at http://[::]:8080

Every 1 minute I get error in my log

**{"name":"hello-world","hostname":"P10-LAP-031","pid":2405,"level":50,"msg":"Error in parsing sampling strategy: SyntaxError: Unexpected token c in JSON at position 1.","time":"2017-07-28T07:06:04.790Z","v":0}**

And I dont get any Traces in Jaeger UI http://localhost:16686/search

Do let me know if I am missing anything

Thanks

@black-adder
Copy link
Contributor

Hi there, this ticket should contain the information you need: #135

essentially you want to pass in const sampler (sampler: { type: 'const', param: 1 }) so that all your traces are sampled. Otherwise the default sampling rate is 1 in 1000

@bikashsharmabks
Copy link
Author

Thanks @black-adder it worked for me.

Iuriy-Budnikov pushed a commit to agile-pm/jaeger-client-node that referenced this issue Sep 25, 2021
* chore: add c8 settings

* fix: add .nycrc
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants