function annotateSuccess(id) { tracer.letId(id, () => { tracer.recordAnnotation(new Annotation.ClientRecv()); }); }
function mkZipkinCallback(callback, id) { const originalId = tracer.id; return function zipkinCallback(...args) { const error = args[0]; tracer.letId(id, () => { if (error) tracer.recordBinary('error', error.message || String(error)); tracer.recordAnnotation(new Annotation.ClientRecv()); }); // callback runs after the client request, so let's restore the former ID tracer.letId(originalId, () => { callback.apply(this, args); }); }; }
/** * Records end of RPC request * @param {zipkin.TraceId} traceId * @param {grpc.Status} status */ onReceiveStatus(traceId, status) { const {code} = status; // TODO: In brave this is a string like UNKNOWN not a number this.tracer.letId(traceId, () => { if (code !== this.grpc.status.OK) { this.tracer.recordBinary('grpc.status_code', String(code)); this.tracer.recordBinary('error', status.details || String(code)); } this.tracer.recordAnnotation(new Annotation.ClientRecv()); }); }
function annotateError(id, error) { tracer.letId(id, () => { tracer.recordBinary('error', error.message || String(error)); tracer.recordAnnotation(new Annotation.ClientRecv()); }); }
recordResponse(rsp, clientTraceId) { this.tracer.letId(clientTraceId, () => { this.tracer.recordBinary('http.status_code', rsp.statusCode.toString()); this.tracer.recordAnnotation(new Annotation.ClientRecv()); }); }
function mkZipkinCallback(callback, id) { var originalId = tracer.id; return function zipkinCallback() { var _this = this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } tracer.letId(id, function () { var error = args[0]; if (error) { tracer.recordBinary('error', error.message || String(error)); } // TODO: parse host and port from details in callback // https://github.com/3rd-Eden/memcached#details-object tracer.recordAnnotation(new Annotation.ServerAddr({ serviceName: remoteServiceName })); tracer.recordAnnotation(new Annotation.ClientRecv()); }); // callback runs after the client request, so let's restore the former ID // TODO: add tests for this for all clients tracer.letId(originalId, function () { callback.apply(_this, args); }); }; }
tracer.recordAnnotation(new Annotation.ServerAddr({serviceName: 'test'})); tracer.recordAnnotation(new Annotation.ClientSend()); tracer.recordAnnotation(new Annotation.ClientRecv()); setTimeout(() => { scribeServer.close();
function mkZipkinCallback(callback, id) { const originalId = tracer.id; return function zipkinCallback(...args) { tracer.letId(id, () => { const error = args[0]; if (error) { tracer.recordBinary('error', error.message || String(error)); } // TODO: parse host and port from details in callback // https://github.com/3rd-Eden/memcached#details-object tracer.recordAnnotation(new Annotation.ServerAddr({ serviceName: remoteServiceName })); tracer.recordAnnotation(new Annotation.ClientRecv()); }); // callback runs after the client request, so let's restore the former ID // TODO: add tests for this for all clients tracer.letId(originalId, () => { callback.apply(this, args); }); }; }
function annotateSuccess(id) { tracer.letId(id, () => { tracer.recordAnnotation(new Annotation.ClientRecv()); }); }
function annotateError(id, error) { tracer.letId(id, () => { tracer.recordBinary('error', error.message || String(error)); tracer.recordAnnotation(new Annotation.ClientRecv()); }); }
recordResponse(rsp, clientTraceId) { this.tracer.letId(clientTraceId, () => { this.tracer.recordBinary('http.status_code', rsp.statusCode.toString()); this.tracer.recordAnnotation(new Annotation.ClientRecv()); }); }
function mkZipkinCallback(callback, id) { const originalId = tracer.id; return function zipkinCallback(...args) { const error = args[0]; tracer.letId(id, () => { if (error) tracer.recordBinary('error', error.message || String(error)); tracer.recordAnnotation(new Annotation.ClientRecv()); }); // callback runs after the client request, so let's restore the former ID tracer.letId(originalId, () => { callback.apply(this, args); }); }; }
/** * Records end of RPC request * @param {zipkin.TraceId} traceId * @param {grpc.Status} status */ onReceiveStatus(traceId, status) { const {code} = status; // TODO: In brave this is a string like UNKNOWN not a number this.tracer.letId(traceId, () => { if (code !== this.grpc.status.OK) { this.tracer.recordBinary('grpc.status_code', String(code)); this.tracer.recordBinary('error', status.details || String(code)); } this.tracer.recordAnnotation(new Annotation.ClientRecv()); }); }
function mkZipkinCallback(callback, id) { const originalId = tracer.id; return function zipkinCallback(...args) { tracer.letId(id, () => { const error = args[0]; if (error) { tracer.recordBinary('error', error.message || String(error)); } // TODO: parse host and port from details in callback // https://github.com/3rd-Eden/memcached#details-object tracer.recordAnnotation(new Annotation.ServerAddr({ serviceName: remoteServiceName })); tracer.recordAnnotation(new Annotation.ClientRecv()); }); // callback runs after the client request, so let's restore the former ID // TODO: add tests for this for all clients tracer.letId(originalId, () => { callback.apply(this, args); }); }; }
tracer.recordAnnotation(new Annotation.ServerAddr({serviceName: 'test'})); tracer.recordAnnotation(new Annotation.ClientSend()); tracer.recordAnnotation(new Annotation.ClientRecv()); setTimeout(() => { scribeServer.close();