0

すべてのリクエストを実行するためにiron-ajax何らかの方法で変更できるかどうかを知りたいです。cujojs-restアプリでのトレースに cujojs-rest zipkin インストルメンテーションを使用したいと考えています。

以下は、cujojs-rest zipkin インストルメンテーションを使用して Zipkin のトレース データを生成するアプリの例です: wingtips-cujojs-spark-example

だから私はこのようなコードを持っているとしましょう:

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);
});

私は同じことを達成したいと思いますiron-ajax

4

0 に答える 0