|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -import {CoreTracer, logger} from '@opencensus/core'; |
| 17 | +import {CoreTracer, LinkType, logger} from '@opencensus/core'; |
18 | 18 | import * as assert from 'assert'; |
19 | | -import {JaegerTraceExporter, JaegerTraceExporterOptions} from '../src/'; |
20 | | -import {spanToThrift, ThriftUtils, UDPSender} from '../src/jaeger-driver'; |
21 | | - |
22 | | -const DEFAULT_BUFFER_TIMEOUT = 10; // time in milliseconds |
23 | 19 |
|
| 20 | +import {JaegerTraceExporter, JaegerTraceExporterOptions,} from '../src/'; |
| 21 | +import {spanToThrift, ThriftReferenceType, ThriftUtils, UDPSender} from '../src/jaeger-driver'; |
24 | 22 | import {ThriftProcess} from '../src/jaeger-driver'; |
25 | 23 | import {SenderCallback} from '../src/jaeger-driver'; |
26 | 24 |
|
| 25 | +const DEFAULT_BUFFER_TIMEOUT = 10; // time in milliseconds |
27 | 26 |
|
28 | 27 | /** |
29 | 28 | * Controls if the tests will use a real network or not |
@@ -116,6 +115,13 @@ describe('Jaeger Exporter', () => { |
116 | 115 | span.addAnnotation('something happened', { |
117 | 116 | 'error': true, |
118 | 117 | }); |
| 118 | + const traceIdHigh = '6e0c63257de34c92'; |
| 119 | + const traceIdLow = 'bf9efcd03927272e'; |
| 120 | + const traceId = traceIdHigh + traceIdLow; |
| 121 | + const spanId = '6e0c63257de34c92'; |
| 122 | + span.addLink(traceId, spanId, LinkType.CHILD_LINKED_SPAN); |
| 123 | + span.addLink(traceId, spanId, LinkType.PARENT_LINKED_SPAN); |
| 124 | + span.addLink(traceId, spanId, LinkType.UNSPECIFIED); |
119 | 125 | span.end(); |
120 | 126 | rootSpan.end(); |
121 | 127 | const thriftSpan = spanToThrift(span); |
@@ -146,6 +152,22 @@ describe('Jaeger Exporter', () => { |
146 | 152 |
|
147 | 153 | assert.ok(testBoolSeen && testStringSeen && testNumSeen); |
148 | 154 |
|
| 155 | + assert.equal(thriftSpan.references.length, 2); |
| 156 | + assert.deepEqual(thriftSpan.references, [ |
| 157 | + { |
| 158 | + refType: ThriftReferenceType.CHILD_OF, |
| 159 | + traceIdHigh: Buffer.from([110, 12, 99, 37, 125, 227, 76, 146]), |
| 160 | + traceIdLow: Buffer.from([191, 158, 252, 208, 57, 39, 39, 46]), |
| 161 | + spanId: Buffer.from([110, 12, 99, 37, 125, 227, 76, 146]) |
| 162 | + }, |
| 163 | + { |
| 164 | + refType: ThriftReferenceType.FOLLOWS_FROM, |
| 165 | + traceIdHigh: Buffer.from([110, 12, 99, 37, 125, 227, 76, 146]), |
| 166 | + traceIdLow: Buffer.from([191, 158, 252, 208, 57, 39, 39, 46]), |
| 167 | + spanId: Buffer.from([110, 12, 99, 37, 125, 227, 76, 146]) |
| 168 | + } |
| 169 | + ]); |
| 170 | + |
149 | 171 | assert.strictEqual(thriftSpan.logs.length, 1); |
150 | 172 | thriftSpan.logs.forEach((log) => { |
151 | 173 | let descriptionSeen = false; |
|
0 commit comments