How to use the jaeger-client.SpanContext 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.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github moleculerjs / moleculer-metrics / packages / moleculer-jaeger / src / index.js View on Github external
makePayload(metric) {
			const serviceName = this.getServiceName(metric);
			const tracer = this.getTracer(serviceName);

			let parentCtx;
			if (metric.parent) {
				parentCtx = new Jaeger.SpanContext(
					this.convertID(metric.requestID), // traceId,
					this.convertID(metric.parent), // spanId,
					null, // parentId,
					null, // traceIdStr
					null, // spanIdStr
					null, // parentIdStr
					1, // flags
					{}, // baggage
					"" // debugId
				);
			}

			const span = tracer.startSpan(this.getSpanName(metric), {
				startTime: metric.startTime,
				childOf: parentCtx,
				tags: {
github vulcainjs / vulcain-corejs / src / instrumentations / trackers / JaegerInstrumentation.ts View on Github external
this.rootSpan = tracer.startSpan(name + " " + action, {childOf: parent});
            this.rootSpan.setTag("event", "cs");
        }
        else if (kind === SpanKind.Event) {
            this.rootSpan = tracer.startSpan("Event " + action, { childOf: parent });
            this.rootSpan.setTag("event", "sr");
        }
        else if (kind === SpanKind.Task) {
            this.rootSpan = tracer.startSpan("Async " + action, { childOf: parent });
            this.rootSpan.setTag("event", "sr");
        }
        else if (kind === SpanKind.Request) {
            this.rootSpan = tracer.startSpan(action, { childOf: parent });
            this.rootSpan.setTag("event", "sr");
        }
        this.rootSpan._spanContext = new jaeger.SpanContext(null, null, null, id.correlationId, id.spanId, id.parentId, 0x01);
    }
github vulcainjs / vulcain-corejs / src / instrumentations / trackers / JaegerInstrumentation.ts View on Github external
startSpan(span: ISpanTracker, name: string, action: string): ITrackerAdapter {
        const parentId = (span.context.requestTracker && span.context.requestTracker.id) || null;
        const parent = (parentId && new jaeger.SpanContext(null, null, null, parentId.correlationId, parentId.spanId, parentId.parentId, 0x01)) || null;
        return new JaegerRequestTracker(this.tracer, span.id, span.kind, name, action, parent);
    }
}