@@ -44,9 +44,7 @@ const config = {
44
44
45
45
// or
46
46
47
- // type: 'haystack_agent',
48
- // agentHost: '192.168.99.100',
49
- // agentPort: '35000'
47
+ // type: 'haystack_agent'
50
48
} ,
51
49
logger : logger
52
50
} ;
@@ -57,19 +55,19 @@ const tracer = initTracer(config);
57
55
/// now create a span, for e.g. at the time of incoming REST call.
58
56
/// Make sure to add SPAN_KIND tag. Possible values are 'server' or 'client'.
59
57
/// Important: if you are receiving TraceId, SpanId, ParentSpanId in the http headers or message payload of your incoming REST call,
60
- /// then set it in the callerSpanContext
58
+ /// then create a SpanContext with those IDs and initialize the tracer with a childOf the received SpanContext
61
59
62
60
const serverSpan = tracer
63
61
. startSpan ( 'dummy-operation' , {
64
- callerSpanContext : new SpanContext (
62
+ childOf : new SpanContext (
65
63
'1848fadd-fa16-4b3e-8ad1-6d73339bbee7' ,
66
64
'7a7cc5bf-796e-4527-9b42-13ae5766c6fd' ,
67
65
'e96de653-ad6e-4ad5-b437-e81fd9d2d61d' )
68
66
} )
69
67
. setTag ( opentracing . Tags . SPAN_KIND , 'server' )
70
68
. setTag ( opentracing . Tags . HTTP_METHOD , 'GET' ) ;
71
69
72
- /// Or if you are the root service, skip callerSpanContext and use the following
70
+ /// Or if you are the root service
73
71
74
72
// const serverSpan = tracer
75
73
// .startSpan('dummy-operation')
@@ -82,7 +80,6 @@ const serverSpan = tracer
82
80
/// now say service is calling downstream service, then you start another span - a client span
83
81
/// since this span is a child of the main serverSpan, so pass it along as `childOf` attribute.
84
82
/// library will setup the traceId, spanId and parentSpanId by itself.
85
- /// You dont need to set the callerSpanContext if you are setting childOf
86
83
const clientChildSpan = tracer . startSpan ( 'downstream-service-call' , {
87
84
childOf : serverSpan ,
88
85
tags : {
0 commit comments