Skip to content

Commit 72ef334

Browse files
author
Kapil Rastogi
authored
Merge pull request #13 from ExpediaDotCom/fix-build
create tracer using opentracing format in the example
2 parents 681374c + e923572 commit 72ef334

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test:
2828
compile:
2929
rm -rf ./dist/
3030
tsc -p tsconfig.json
31-
31+
cp -a src/proto_idl_codegen dist/
3232
.PHONY: tslnt
3333
tslint:
3434
$(shell ./node_modules/tslint/bin/tslint -t msbuild -c tslint.json 'src/**/*.ts')

examples/index.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ const config = {
4444

4545
// or
4646

47-
// type: 'haystack_agent',
48-
// agentHost: '192.168.99.100',
49-
// agentPort: '35000'
47+
// type: 'haystack_agent'
5048
},
5149
logger: logger
5250
};
@@ -57,19 +55,19 @@ const tracer = initTracer(config);
5755
/// now create a span, for e.g. at the time of incoming REST call.
5856
/// Make sure to add SPAN_KIND tag. Possible values are 'server' or 'client'.
5957
/// 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
6159

6260
const serverSpan = tracer
6361
.startSpan('dummy-operation', {
64-
callerSpanContext: new SpanContext(
62+
childOf: new SpanContext(
6563
'1848fadd-fa16-4b3e-8ad1-6d73339bbee7',
6664
'7a7cc5bf-796e-4527-9b42-13ae5766c6fd',
6765
'e96de653-ad6e-4ad5-b437-e81fd9d2d61d')
6866
})
6967
.setTag(opentracing.Tags.SPAN_KIND, 'server')
7068
.setTag(opentracing.Tags.HTTP_METHOD, 'GET');
7169

72-
/// Or if you are the root service, skip callerSpanContext and use the following
70+
/// Or if you are the root service
7371

7472
// const serverSpan = tracer
7573
// .startSpan('dummy-operation')
@@ -82,7 +80,6 @@ const serverSpan = tracer
8280
/// now say service is calling downstream service, then you start another span - a client span
8381
/// since this span is a child of the main serverSpan, so pass it along as `childOf` attribute.
8482
/// library will setup the traceId, spanId and parentSpanId by itself.
85-
/// You dont need to set the callerSpanContext if you are setting childOf
8683
const clientChildSpan = tracer.startSpan('downstream-service-call', {
8784
childOf: serverSpan,
8885
tags: {

0 commit comments

Comments
 (0)