I would like to know if it is possible to modify iron-ajax
somehow to use cujojs-rest
to perform all the requests. I would like to use cujojs-rest zipkin instrumentation for tracing in my app.
Here is an example app using cujojs-rest zipkin instrumentation to generate trace data for Zipkin: wingtips-cujojs-spark-example
So let's say I have got code like this:
const {Tracer, BatchRecorder, ExplicitContext} = require('zipkin');
const {HttpLogger} = require('zipkin-transport-http');
const {restInterceptor} = require('zipkin-instrumentation-cujojs-rest');
const rest = require('rest');
const ctxImpl = new ExplicitContext();
const recorder = new BatchRecorder({
logger: new HttpLogger({
endpoint: 'http://localhost:9411/api/v1/spans'
})
});
const tracer = new Tracer({ctxImpl, recorder});
const nameOfRemoteService = 'cujojs-client';
const client = rest.wrap(restInterceptor, {tracer, serviceName: nameOfRemoteService});
client({
method: 'GET',
path: 'http://localhost:9999/request'
}).then(function(response) {
console.log('response: ', response);
});
I would like to achieve the same in iron-ajax