SkyAPM/SkyAPM-nodejs

Does SkyAPM-nodejs support to use in Opentracing way?

ArronD opened this issue · 3 comments

Hi! We are planning to add tracing to a nodejs project. Due to some reasons, we cannot use the below way to instrument our code.
require("skyapm-nodejs").start({ serviceName: "test", });
So we are wondering if SkyAPM-nodejs supports to use in Opentracing way? Just like below:

// Replace this line with the tracer implementation of your choice.
const tracer = new opentracing.Tracer();  //any method we can new a SkyAPM-nodejs tracer ?

const span = tracer.startSpan('http_request');
const opts = {
    host : 'example.com',
    method: 'GET',
    port : '80',
    path: '/',
};
http.request(opts, res => {
    res.setEncoding('utf8');
    res.on('error', err => {
        // assuming no retries, mark the span as failed
        span.setTag(opentracing.Tags.ERROR, true);
        span.log({'event': 'error', 'error.object': err, 'message': err.message, 'stack': err.stack});
        span.finish();
    });
    res.on('data', chunk => {
        span.log({'event': 'data_received', 'chunk_length': chunk.length});
    });
    res.on('end', () => {
        span.log({'event': 'request_end'});
        span.finish();
    });
}).end();

Thank you!

I don't think we have an opentracing way in NodeJS agent, can you talk about why you cannot use the auto instrumentation way?

Thanks for your reply!

OpenTracing is not active anymore, don't follow that project. They all move into OpenTelemetry, which is less stable than OT. But to be honest, both OpenTracing and OpenTelemetry are not very high value, comparing to auto instrumentation.