How to use the jaeger-client.opentracing function in jaeger-client

To help you get started, we’ve selected a few jaeger-client examples, based on popular ways it is used in public projects.

github moleculerjs / moleculer-metrics / packages / moleculer-jaeger / src / index.js View on Github external
const sc = span.context();
			sc.traceId = this.convertID(metric.requestID);
			sc.spanId = this.convertID(metric.id);

			if (metric.callerNodeID)
				this.addTags(span, "callerNodeID", metric.callerNodeID);

			if (metric.params)
				this.addTags(span, "params", metric.params);

			if (metric.meta)
				this.addTags(span, "meta", metric.meta);

			if (metric.error) {
				this.addTags(span, Jaeger.opentracing.Tags.ERROR, true);
				this.addTags(span, "error.message", metric.error.message);
				this.addTags(span, "error.type", metric.error.type);
				this.addTags(span, "error.code", metric.error.code);

				if (metric.error.data)
					this.addTags(span, "error.data", metric.error.data);

				if (metric.error.stack)
					this.addTags(span, "error.stack", metric.error.stack.toString());
			}

			span.finish(metric.endTime);
		},
github moleculerjs / moleculer-metrics / packages / moleculer-jaeger / src / index.js View on Github external
}

			const span = tracer.startSpan(this.getSpanName(metric), {
				startTime: metric.startTime,
				childOf: parentCtx,
				tags: {
					nodeID: metric.nodeID,
					level: metric.level,
					remoteCall: metric.remoteCall
				}
			});
			this.addTags(span, "service", serviceName);
			if (metric.action && metric.action.name)
				this.addTags(span, "action", metric.action.name);

			this.addTags(span, Jaeger.opentracing.Tags.SPAN_KIND, Jaeger.opentracing.Tags.SPAN_KIND_RPC_SERVER);

			const sc = span.context();
			sc.traceId = this.convertID(metric.requestID);
			sc.spanId = this.convertID(metric.id);

			if (metric.callerNodeID)
				this.addTags(span, "callerNodeID", metric.callerNodeID);

			if (metric.params)
				this.addTags(span, "params", metric.params);

			if (metric.meta)
				this.addTags(span, "meta", metric.meta);

			if (metric.error) {
				this.addTags(span, Jaeger.opentracing.Tags.ERROR, true);